Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate members when importing a project from CSV #97

Closed
mrclschstr opened this issue Oct 28, 2021 · 11 comments
Closed

Duplicate members when importing a project from CSV #97

mrclschstr opened this issue Oct 28, 2021 · 11 comments
Labels
bug Something isn't working testing

Comments

@mrclschstr
Copy link

mrclschstr commented Oct 28, 2021

I just noticed that there is a bug regarding the CSV import when you have members containing a blank. The import strips the whitespaces resulting in duplicate members and incorrect balances.

Example: You have a project with members "John Doe" and "Jane Doe". After importing this project from CSV you have the four members "John Doe", "Jane Doe", "JohnDoe" and "JaneDoe".

I had a quick look at the code and noticed the following line. This replaces all whitespaces from the owners CSV column, which is probably the reason for the error. https://github.com/eneiluj/cospend-nc/blob/d24998d591403f67ddf68ee3e833208dcf622885/lib/Service/ProjectService.php#L5401

EDIT:

  • Nextcloud version: 22.2.0
  • Cospend version: 1.4.1
@helloha82
Copy link

Was this fixed? Because I'm having this issue...

@mrclschstr
Copy link
Author

Unfotunately not. My workaround was to edit the CSV with a texteditor like Notepad++ to have member namens without spaces and renaming them after import.

julien-nc pushed a commit that referenced this issue Mar 11, 2022
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
@julien-nc julien-nc added bug Something isn't working testing labels Mar 11, 2022
@julien-nc
Copy link
Owner

Hey there. Thanks for the bug report. It's now fixed. New release is coming soon.

@falzonv
Copy link

falzonv commented Jul 20, 2022

Hello @eneiluj,

First of all, thank you very much for developing Cospend!

Using v1.4.8 on Nextcloud 24, I noticed a similar bug with white-spaces following commas when the members are enumerated.

Given the following example (line anonymized but structure copy-pasted from an exported CSV file)...

"Description",20,2022-07-20,1530248900,"Jean",1,1,"Jean, Pierre, Paul, Jacques",n,1,0,,0,n,""

... the members Pierre, Paul and Jacques will be added twice when importing the CSV in Cospend (the first member of the enumeration, in this case Jean, is not duplicated).

Remark: as a workaround, removing all the spaces after these commas using a text editor fixes the issue (this can be done rather quickly using the substitution :%s/, /,/g in Vim).

Best regards.

julien-nc pushed a commit that referenced this issue Jul 20, 2022
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
@julien-nc
Copy link
Owner

@falzonv Thanks for reporting this. Are you sure there are spaces following comas for the owers field in csv files produced by Cospend? There shouldn't be any.

Anyway, the import process now trims each ower. This is available in latest nightly (v1.4.9-2-nightly). It would be nice if you could try it.

@falzonv
Copy link

falzonv commented Jul 21, 2022

Hello,

You are right, actually the exports came from an older version of Cospend (yesterday I had to reinstall Nextcloud, looking at my DB backup it was Cospend 1.3.7 on Nextcloud 21). I noticed the bug when importing projects back in the new instance (*).
I just tested an export now with Cospend 1.4.8 on Nextcloud 24.0.3 and indeed the spaces are not there.

(*) By the way, in my exports I also had some members with spaces in their name and those ones were properly imported so I can confirm that the original bug of this ticket is solved.

Regarding testing, I would prefer to let my Nextcloud instance on the stable channel.
Is there a way to update only Cospend to latest nightly?

Best regards.

@falzonv
Copy link

falzonv commented Jul 21, 2022

Regarding testing, I would prefer to let my Nextcloud instance on the stable channel.
Is there a way to update only Cospend to latest nightly?

Sorry, just found it at the bottom of the README...

@falzonv
Copy link

falzonv commented Jul 21, 2022

I was able to test version 1.4.9-2 but unfortunately the fix doesn't seem to work properly:

  • With an older export (containing spaces between members), the import process stops and an error is displayed at the first line of a cost containing spaces between members (spaces in the name of a member are ok)
  • With a normal export (containing no spaces between members) everything works as expected

Here is an example file that I just created and where I added spaces like in the older exports, if you want to test:
test_2022-07-21.csv

julien-nc pushed a commit that referenced this issue Jul 21, 2022
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
@julien-nc
Copy link
Owner

@falzonv Thanks for the precise feedback. Yeah right I didn't test my fix. It's now properly fixed and available in v1.4.9-3-nightly.

@falzonv
Copy link

falzonv commented Jul 24, 2022

Hello @eneiluj,

Just checked with v1.4.9-3 and indeed the issue is solved, thank you very much!

Best regards.

@julien-nc
Copy link
Owner

@falzonv Nice! Thanks for testing it.

Closing this, feel free to reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working testing
Projects
None yet
Development

No branches or pull requests

4 participants