Implement local save and load buttons #28

Merged
mslw merged 15 commits from local-save into master 2022-06-29 09:20:26 +00:00
mslw commented 2022-06-10 18:37:32 +00:00 (Migrated from github.com)

This PR implements https://github.com/psychoinformatics-de/sfb1451_org/issues/33

Added two buttons:

  • Daten Lokal Speichern saves the entered data as a json file (triggers download of the file). The content is based on what previously went into ContentString (used for checksumming) with minor changes. Subject pseudonym is used as the file name.
  • Lokale Daten Laden loads such a file and puts the content into respective fields.

I am not sure if the save / load implementation is optimal, but that's what I came up with.

I was able to save - load - save entered data, but manual testing is always welcome.

This PR implements https://github.com/psychoinformatics-de/sfb1451_org/issues/33 Added two buttons: - _Daten Lokal Speichern_ saves the entered data as a json file (triggers download of the file). The content is based on what previously went into ContentString (used for checksumming) with minor changes. Subject pseudonym is used as the file name. - _Lokale Daten Laden_ loads such a file and puts the content into respective fields. I am not sure if the save / load implementation is optimal, but that's what I came up with. I was able to save - load - save entered data, but manual testing is always welcome.
christian-monch commented 2022-06-27 11:53:17 +00:00 (Migrated from github.com)

If "Probanden-Pseudonym" is not set, a file name json is locally saved.

Either saving should be refused, if "Probanden-Pseudonym" is unset, or there should be the possibility to choose a name manually in case it is unset

If "Probanden-Pseudonym" is not set, a file name `json` is locally saved. Either saving should be refused, if "Probanden-Pseudonym" is unset, or there should be the possibility to choose a name manually in case it is unset
christian-monch (Migrated from github.com) requested changes 2022-06-27 14:14:38 +00:00
christian-monch (Migrated from github.com) left a comment

Generally looks good to me. Can be merged if the comments are addressed.

Generally looks good to me. Can be merged if the comments are addressed.
christian-monch (Migrated from github.com) commented 2022-06-27 12:13:21 +00:00

Just for my understanding: why is subject-group not present in getContentString()-results?

Just for my understanding: why is `subject-group` not present in `getContentString()`-results?
@ -3070,9 +3092,278 @@
updatedLines();
christian-monch (Migrated from github.com) commented 2022-06-27 12:15:26 +00:00

If subject-pseudonym is not set, fname will be .json (there is also a comment in the PR discussion). Maybe decline to save without subject-pseudonym or ask for a value?

If `subject-pseudonym` is not set, `fname` will be `.json` (there is also a comment in the PR discussion). Maybe decline to save without `subject-pseudonym` or ask for a value?
christian-monch (Migrated from github.com) commented 2022-06-27 12:17:03 +00:00

Maybe remove element a again?

Maybe remove element `a` again?
christian-monch (Migrated from github.com) commented 2022-06-27 14:13:02 +00:00

Generally it would be nice if you could unify tab and space, more precisly, replace tabs with 4 spaces

Generally it would be nice if you could unify tab and space, more precisly, replace tabs with 4 spaces
mslw (Migrated from github.com) reviewed 2022-06-27 14:30:48 +00:00
mslw (Migrated from github.com) commented 2022-06-27 14:30:48 +00:00

It wasn't when I started. The old getContentString explicitly defines an array with a list of ids, and subject-group wasn't there. May be a simple omission.

I chose to tack it on to contentObj (for saving) rather then change the existng getContentString behaviour.

It wasn't when I started. The old `getContentString` explicitly defines an array with a list of ids, and `subject-group` wasn't there. May be a simple omission. I chose to tack it on to contentObj (for saving) rather then change the existng getContentString behaviour.
mslw (Migrated from github.com) reviewed 2022-06-28 13:17:06 +00:00
@ -3070,9 +3092,278 @@
updatedLines();
mslw (Migrated from github.com) commented 2022-06-28 13:17:05 +00:00

I'm going for "decline to save" - it makes little sense to save records not attributed to any subject.

I also don't know an easy way to ask for value. I found showSaveFilePicker in JS, but it's new and currently supported only by Chromium-based browsers.

I'm going for "decline to save" - it makes little sense to save records not attributed to any subject. I also don't know an easy way to ask for value. I found [showSaveFilePicker](https://developer.mozilla.org/en-US/docs/Web/API/Window/showSaveFilePicker) in JS, but it's new and currently supported only by Chromium-based browsers.
mslw (Migrated from github.com) reviewed 2022-06-28 13:32:25 +00:00
@ -3070,9 +3092,278 @@
updatedLines();
mslw (Migrated from github.com) commented 2022-06-28 13:32:25 +00:00

I thought I knew my editor, but apparently not... I'll clean it up (probably I'll run prettier on the script blocks).

I thought I knew my editor, but apparently not... I'll clean it up (probably I'll run prettier on the script blocks).
mslw commented 2022-06-28 16:16:02 +00:00 (Migrated from github.com)

I made the suggested changes (commented above). I used prettier to clean up not only tabs, but also quotes, semicolons, spaces, and the like.

I made the suggested changes (commented above). I used prettier to clean up not only tabs, but also quotes, semicolons, spaces, and the like.
christian-monch (Migrated from github.com) approved these changes 2022-06-29 09:20:18 +00:00
christian-monch (Migrated from github.com) left a comment

LGTM, will merge
Thx a lot

LGTM, will merge Thx a lot
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sfb1451/z03-assessment-center-data-entry!28
No description provided.