Merge pull request #3201 from emanuelschuetze/fixCSVUserImport

Fixed compare of duplicated users while csv user import.
This commit is contained in:
Emanuel Schütze 2017-04-19 13:50:28 +02:00 committed by GitHub
commit f2e287e4a3
3 changed files with 47 additions and 23 deletions

View File

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

View File

@ -1021,9 +1021,17 @@ angular.module('OpenSlidesApp.users.site', [
// Check for duplicates
user.duplicate = false;
users.forEach(function(user_) {
if (user_.first_name == user.first_name &&
user_.last_name == user.last_name &&
user_.structure_level == user.structure_level) {
user_.fullname = [
user_.title,
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) {
// there are multiple duplicates!
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
var deletePromises = [];
existingUsers.forEach(function(user_) {
if (user_.first_name == user.first_name &&
user_.last_name == user.last_name &&
user_.structure_level == user.structure_level) {
user_.fullname = [
user_.title,
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));
}
});

View File

@ -189,23 +189,30 @@
last-text="»">
</ul>
<div class="text-danger">
<i class="fa fa-exclamation-triangle"></i>
{{ usersWillNotBeImported }}
<translate>participants will be not imported.</translate>
</div>
<div>
<i class="fa fa-check-circle-o fa-lg"></i>
{{ usersWillBeImported }}
<translate>participants will be imported.</translate>
</div>
<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 class="spacer-top-lg">
<div class="text-danger" ng-if="usersWillNotBeImported > 0">
<i class="fa fa-exclamation-triangle"></i>
{{ usersWillNotBeImported }}
<translate>participants will be not imported.</translate>
</div>
<div class="text-danger" ng-if="duplicates > 0">
<i class="fa fa-exclamation-triangle"></i>
{{ duplicates }}
<translate>duplicates</translate>!
</div>
<div>
<i class="fa fa-check-circle-o fa-lg"></i>
{{ usersWillBeImported }}
<translate>participants will be imported.</translate>
</div>
<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 class="spacer">