frksteenhoff / ClimApp

Codebase for prototype and final version of the smartphone application ClimApp, a project under the European Research Area for Climate Services. The application is available for iOS and Android in App Stroe and Google Play respectively.
https://www.lth.se/climapp/
4 stars 2 forks source link

Segment knowledgebase to avoid overwrite of user info on update. #101

Closed frksteenhoff closed 5 years ago

frksteenhoff commented 5 years ago

Some parts of the data stored in local storage should only be allowed to be updated by the user and not change as a result of an update. This way we can persist the user's own data so that they don't need to input anything previously provided. As a result we need to segment the knowledgebase.

I propose two solutions

1. creating two "knowledgebases" separating app configuration and screen text from user information.

In the description the knowledgebases are named:

All in kb_config can/will be overwritten on update, all in kb_userInfo will remain the same or be updated without overwrite.

Content/values to persist in kb_userInfo:

All else go in kb_config, which we can update as we please without interfering with the individual user values.

Possible complexities


2. Copying current contents of user's knowledgebase into the new version of knowledgebase when updating

Pseudo code:

if user_kb_version > new_kb_version:
   tmp_kb = user_kb_version; 
   user_kb_version = new_kb_version;
   *merge tmp_kb into user_kb_version*

Basically merging the new and old version of the knowledgebases (if that is possible in javascript). This makes sure that wee keep all user information while also getting the new.

Something like this procedure: https://stackoverflow.com/questions/43306832/javascript-merging-two-multidimensional-arrays-with-common-matching-elements (except we want a set join)

Possible complexities

BorisKingma commented 5 years ago

Good suggestion.

for point 1: good.

for point 2: we are going to make this change only at a specific kb version (e.g. version: 2.0), and only in case the "user_info" key does not exist in the localStorage.

Therefore here I suggest that we create a conversion function that creates the "user_info" associative array, copies the values in the respective fields.

the app_config field gets updated as currently implemented for the 'legacy' knowledgebase the user_info field gets created only once and updated on respective user actions.

We will proceed with this after our oncoming update.

frksteenhoff commented 5 years ago

Branch dev_heste_kb_segmentation (based on current master) created to implement a first version of the new implementation, not started yet.

frksteenhoff commented 5 years ago

Implemented and discussed in #114 with updates in #115, now closing.