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,23 +189,30 @@
last-text="»"> last-text="»">
</ul> </ul>
<div class="text-danger"> <div class="spacer-top-lg">
<i class="fa fa-exclamation-triangle"></i> <div class="text-danger" ng-if="usersWillNotBeImported > 0">
{{ usersWillNotBeImported }} <i class="fa fa-exclamation-triangle"></i>
<translate>participants will be not imported.</translate> {{ usersWillNotBeImported }}
</div> <translate>participants will be not imported.</translate>
<div> </div>
<i class="fa fa-check-circle-o fa-lg"></i> <div class="text-danger" ng-if="duplicates > 0">
{{ usersWillBeImported }} <i class="fa fa-exclamation-triangle"></i>
<translate>participants will be imported.</translate> {{ duplicates }}
</div> <translate>duplicates</translate>!
<div ng-repeat="user in usersImported = (users | filter:{imported:true})"></div> </div>
<div ng-if="usersImported.length > 0" class="text-success"> <div>
<hr class="smallhr"> <i class="fa fa-check-circle-o fa-lg"></i>
<i class="fa fa-check-circle fa-lg"></i> {{ usersWillBeImported }}
{{ usersImported.length }} <translate>participants will be imported.</translate>
<translate>participants were successfully imported.</translate> </div>
(<translate>Groups created</translate>: {{ groupsCreated }}) <div ng-repeat="user in usersImported = (users | filter:{imported:true})"></div>
<div ng-if="usersImported.length > 0" class="text-success">
<hr class="smallhr">
<i class="fa fa-check-circle fa-lg"></i>
{{ usersImported.length }}
<translate>participants were successfully imported.</translate>
(<translate>Groups created</translate>: {{ groupsCreated }})
</div>
</div> </div>
<div class="spacer"> <div class="spacer">