Open Nuytemans-Dieter opened 3 years ago
Did a first attempt at this in the commit above (that mentioned this issue). Not all fields are present in Recipe/Review at the time of creation, this should be fixed in a next update. Before committing, I made sure the new code does not interfere.
Okay. It's an interesting dilemma. Currently, when we create a recipe or review, unspecified fields get a default value in the ".toMap" methods. For Firestore purposes, this proved to be convenient. I understand that we need to change this to support caching.
Possible fix 1: Change the Recipe / Review constructor. Possible fix 2: Make an additional method in the Recipe and Review class. This method (e.g. getCompleteRecipe) will give a default value to fields that don't exist (null).
Personally, I think fix 1 will be better. I just don't know how yet. You can always participate in this issue. If the issue still exists after my last exam, I will most likely fix it myself. Thanks for bringing this to my attention
I absolutely agree, fix 1 is way better and can be used consistently without the need to investigate a bunch of code. It's most likely constructor syntax that you're struggling with? I could fix this or set you in the right direction when we'll be working on this again.
Note: Better fix this one before #3.
I would like that. For some reason, constructors confuse me tremendously. I will have to read or watch a tutorial of some sorts.
Another problem arrises: medals are not awarded immediately (neither are the points) when the user's reviews or recipes were loaded earlier. Fixing this issue will most likely resolve this problem automatically.
Agreed. I do want to point out that this will not occur for all medals.. Only medals that use the cache system (write reviews, receive reviews and create recipes) will be affected by this issue. The other medals work fine (e.g. save recipes, set preferences).
Small code adjustment with big UX improvement.