Fixed compare of duplicated users while csv user import.

This commit is contained in:
Emanuel Schütze 2017-04-18 09:55:53 +02:00
parent 146b49c4aa
commit 3614ba9451
3 changed files with 47 additions and 23 deletions

View File

@ -32,6 +32,7 @@ Users:
permissions [#3191]. permissions [#3191].
- Added support for password validation using Django or custom validators - Added support for password validation using Django or custom validators
e. g. for minimum password length [#3200]. e. g. for minimum password length [#3200].
- Fixed compare of duplicated users while csv user import [#3201].
Version 2.1.1 (2017-04-05) Version 2.1.1 (2017-04-05)

View File

@ -1021,9 +1021,17 @@ angular.module('OpenSlidesApp.users.site', [
// Check for duplicates // Check for duplicates
user.duplicate = false; user.duplicate = false;
users.forEach(function(user_) { users.forEach(function(user_) {
if (user_.first_name == user.first_name && user_.fullname = [
user_.last_name == user.last_name && user_.title,
user_.structure_level == user.structure_level) { user_.first_name,
user_.last_name,
user_.structure_level].join(' ').trim();
user.fullname = [
user.title,
user.first_name,
user.last_name,
user.structure_level].join(' ').trim();
if (user_.fullname === user.fullname) {
if (user.duplicate) { if (user.duplicate) {
// there are multiple duplicates! // there are multiple duplicates!
user.duplicate_info += '\n' + gettextCatalog.getString('There are more than one duplicates of this user!'); user.duplicate_info += '\n' + gettextCatalog.getString('There are more than one duplicates of this user!');
@ -1130,9 +1138,17 @@ angular.module('OpenSlidesApp.users.site', [
// delete existing user // delete existing user
var deletePromises = []; var deletePromises = [];
existingUsers.forEach(function(user_) { existingUsers.forEach(function(user_) {
if (user_.first_name == user.first_name && user_.fullname = [
user_.last_name == user.last_name && user_.title,
user_.structure_level == user.structure_level) { user_.first_name,
user_.last_name,
user_.structure_level].join(' ').trim();
user.fullname = [
user.title,
user.first_name,
user.last_name,
user.structure_level].join(' ').trim();
if (user_.fullname === user.fullname) {
deletePromises.push(User.destroy(user_.id)); deletePromises.push(User.destroy(user_.id));
} }
}); });

View File

@ -189,11 +189,17 @@
last-text="»"> last-text="»">
</ul> </ul>
<div class="text-danger"> <div class="spacer-top-lg">
<div class="text-danger" ng-if="usersWillNotBeImported > 0">
<i class="fa fa-exclamation-triangle"></i> <i class="fa fa-exclamation-triangle"></i>
{{ usersWillNotBeImported }} {{ usersWillNotBeImported }}
<translate>participants will be not imported.</translate> <translate>participants will be not imported.</translate>
</div> </div>
<div class="text-danger" ng-if="duplicates > 0">
<i class="fa fa-exclamation-triangle"></i>
{{ duplicates }}
<translate>duplicates</translate>!
</div>
<div> <div>
<i class="fa fa-check-circle-o fa-lg"></i> <i class="fa fa-check-circle-o fa-lg"></i>
{{ usersWillBeImported }} {{ usersWillBeImported }}
@ -207,6 +213,7 @@
<translate>participants were successfully imported.</translate> <translate>participants were successfully imported.</translate>
(<translate>Groups created</translate>: {{ groupsCreated }}) (<translate>Groups created</translate>: {{ groupsCreated }})
</div> </div>
</div>
<div class="spacer"> <div class="spacer">
<button ng-click="clear()" class="btn btn-default btn-sm" translate> <button ng-click="clear()" class="btn btn-default btn-sm" translate>