OpenSlides / openslides-client

Webclient for OpenSlides 4+
MIT License
3 stars 31 forks source link

User Import - small import improvement (Mail / gender recognition) #3823

Closed MSoeb closed 1 week ago

MSoeb commented 2 months ago

Description: When importing accounts or participants, there is always the problem that some attributes (e-mail and gender) can have spaces BEFORE and AFTER the value. This leads to problems during import. The conflict must be resolved manually.

Example of the csv file with additional spaces. First mail column has spaces before and after the mail. Second mail has no spaces: image

What should happen: It would be good if spaces BEFORE and AFTER certain attributes were automatically ignored when uploading the csv file, as these are not logically possible.

Affected attributes:

Info: Issue is part of META issue #3809

vkrasnovyd commented 3 weeks ago

@MSoeb Hi Marcus! I've done some research before writing a solution and found 2 options how to resolve this issue. I need your help to choose which approach would be more suitable.

First, some context. While recreating the problem I found out, that actually all attributes may be affected by it: removing spaces at the beginning and end of a string during parsing is not currently configured. But only some of such fields with extra whitespaces trigger errors: email, gender (mentioned in this issue) and username.

There are 2 ways to deal with this:

  1. Remove extra spaces only for the attributes that cause errors (email, gender, username) - as described in this issue.
  2. Remove spaces at the beginning and end of each line for all attributes. In both cases, the spaces in the middle of the lines will not be changed or removed.

Option 1 (only fields that cause errors) is a better choice if whitespaces in the begginning or end of some other fields (for example name) are important. But I can't think of a case where this would be relevant for this project.

Option 2 (cleanup all data) is as easy to implement as option 1, but it will produce cleaner parsed data.

Please let me know which option you think is more appropriate.

MSoeb commented 2 weeks ago

Option 2 sounds good. You could solve it this way.