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

Import previously exported json data #518

Merged
merged 20 commits into from Jan 13, 2020
Merged

Conversation

NVanvyve
Copy link
Contributor

@NVanvyve NVanvyve commented Dec 17, 2019

In order to solve the issue #417, I added a tab to load a JSON, as well as a way to add the data found there, in an existing (or empty) project.
I realize that this was not the best way to manage the front end. But I couldn't add the form in the options section. So I did it like that to focus on the rest.
I had to add some messages, I have already noted their translation into French in fr/LC_MESSAGES/messages.po

@Natim
Copy link
Member

Natim commented Dec 17, 2019

This is really appalling, do you mind adding a test for the upload_form?

@NVanvyve
Copy link
Contributor Author

I can do that.
You mean, test if the file is a correct json?
Because I don't see how else to test the form, especially since I didn't find a test for the other types of forms

@Natim
Copy link
Member

Natim commented Dec 17, 2019

I meant adding a test to make sure that importing a given json will create the project with the expected members and bills.

@NVanvyve
Copy link
Contributor Author

I added a test as requested and also modified some of what I had done before. I realized that it was possible to search for a user that had been deactivated. At first, I considered that they were two different people

@NVanvyve
Copy link
Contributor Author

Is there anything else I can do?

@almet
Copy link
Member

almet commented Jan 2, 2020

Thank you, we just need to have someone review your changes and validate them. Let me summon @Glandos and @Natim on this :-)

ihatemoney/tests/tests.py Outdated Show resolved Hide resolved
ihatemoney/tests/tests.py Outdated Show resolved Hide resolved
ihatemoney/utils.py Outdated Show resolved Hide resolved
ihatemoney/web.py Outdated Show resolved Hide resolved
ihatemoney/web.py Outdated Show resolved Hide resolved
@NVanvyve NVanvyve requested a review from Natim January 11, 2020 15:12
Co-Authored-By: Rémy HUBSCHER <hubscher.remy@gmail.com>
Copy link
Member

@Glandos Glandos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that using json.dump instead of json.dumps is really worthwhile. We are talking about importing projects with unknown sizes, so let's not hammer the memory twice.

I suggested some changes to tests. They are all passing on my installation.

ihatemoney/web.py Outdated Show resolved Hide resolved
ihatemoney/web.py Outdated Show resolved Hide resolved
ihatemoney/tests/tests.py Outdated Show resolved Hide resolved
ihatemoney/tests/tests.py Outdated Show resolved Hide resolved
ihatemoney/tests/tests.py Outdated Show resolved Hide resolved
@Glandos Glandos merged commit 9aa7e62 into spiral-project:master Jan 13, 2020
Jojo144 pushed a commit to Jojo144/ihatemoney that referenced this pull request Mar 21, 2020
Fix spiral-project#417 

* New tab upload

* Extract data from JSON

* Add users

* Black format

* Try to add bill

* Import bills

* Add french translation msg

* Black reformat missing

* Deactivated users are supported

* Test import

* Remove temp file in upload_json()

* Incomplete tests

* tests import

* Update ihatemoney/translations/fr/LC_MESSAGES/messages.po

Co-Authored-By: Rémy HUBSCHER <hubscher.remy@gmail.com>

* Remove useless variable and check json format

* Use String.IO and test for wrong json

* Remove coma

Co-authored-by: Rémy HUBSCHER <hubscher.remy@gmail.com>
@zorun zorun added this to the v5 milestone Jul 17, 2020
TomRoussel pushed a commit to TomRoussel/ihatemoney that referenced this pull request Mar 2, 2024
Fix spiral-project#417 

* New tab upload

* Extract data from JSON

* Add users

* Black format

* Try to add bill

* Import bills

* Add french translation msg

* Black reformat missing

* Deactivated users are supported

* Test import

* Remove temp file in upload_json()

* Incomplete tests

* tests import

* Update ihatemoney/translations/fr/LC_MESSAGES/messages.po

Co-Authored-By: Rémy HUBSCHER <hubscher.remy@gmail.com>

* Remove useless variable and check json format

* Use String.IO and test for wrong json

* Remove coma

Co-authored-by: Rémy HUBSCHER <hubscher.remy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants