AY2324S2-CS2113T-T09-1 / tp

0 stars 6 forks source link

[PE-D][Tester E] Invalid json file causes `list -t today` feature to not work #164

Closed soc-se-bot closed 7 months ago

soc-se-bot commented 7 months ago

Classified this bug as low as a user editting the JSON file may not necessarily be a very common case.

Note that i went to set the json file to an invalid file. image.png

The list -l today initially works, however, after editing the JSON file to be invalid and starting the app again, list -t today returns an exception.

image.png


Labels: severity.Low type.FunctionalityBug original: itsmejr257/ped#9

annoy-o-mus commented 7 months ago
  1. As per discussion just now, there will be a few possible cases during the import process from JSON to DailyMedicationmanager (DailyMgr)

  2. The core idea is to preserve (past) daily medication data for the future implementation of being able to retrieve taking of medication history (Name, taken, dosage), even if the medication no longer exist in the MedicationManager (MedMgr). On that note, DailyMgr will have to refer to MedMgr on a best-effort basis rather than a fail-if-not-found idea. (Remove the assumption that what is on the today list is also on the main list)

  3. Possible cases of corruption

Case 1.1: JSON is corrupt and is unable to recover any data but the daily txt file is not corrupt

Case 1.2: JSON is partially corrupt (able to recover some data) but the daily txt file is not corrupt

Case 2: Json is not corrupt, Daily txt file is corrupt

  1. Things of things to mention in the User Guide

    • a. That the DailyMgr function "separately" from the MedMgr; That some data (except dosage information) can still be shown even if there is no MedMgr. Put a note over the "list -t today", "take" and "untake" commands to remind users that those are still available even when there is no medication information.
    • b. With regards to corrupt data: That the program will still try to load whatever data that is available, but may have fields missing, or start with a clean slate
    • c. It will be helpful to inform the user that DailyMgr and MedMgr function mostly separately and independently of each other (and introduce their individual roles in 1-2 sentence), that other side will still work even if one side is missing.
    • d. Under the list -t command, mention that the all and today results are separate; that information of one does not affect the information of the other.
  2. Mention with comments below whichever part is closed once implemented