diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 2f9ff8a690..42f8c0af61 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -17,10 +17,61 @@ Additional Packages used: - GitHub's built-in Jekyll integration to allow us to render the documentation in a slightly different style. # Overview - +* [MediTracker Developer Guide](#meditracker-developer-guide) + * [Acknowledgements](#acknowledgements) +* [Overview](#overview) +* [Setting up and getting started](#setting-up-and-getting-started) + * [Setting up the project in your computer](#setting-up-the-project-in-your-computer) +* [Design & implementation](#design--implementation) + * [Add Medication Command](#add-medication-command) + * [Expanding Step 7](#expanding-step-7) + * [List Medication Command](#list-medication-command) + * [Utilising the Period and TimeRange](#utilising-the-period-and-timerange) + * [View Medication Command](#view-medication-command) + * [Search Medication Command](#search-medication-command) + * [Utilising the argument parser](#utilising-the-argument-parser) + * [Storage Design component](#storage-design-component) + * [Exporting data](#exporting-data-) + * [Importing data](#importing-data) + * [Simulated Time](#simulated-time) +* [Product scope](#product-scope) + * [Target user profile](#target-user-profile) + * [Value proposition](#value-proposition) + * [User Stories](#user-stories) + * [Non-Functional Requirements](#non-functional-requirements) +* [Glossary](#glossary) +* [Instructions for manual testing](#instructions-for-manual-testing) + * [Launching the Program](#launching-the-program) + * [Adding some medication information](#adding-some-medication-information) + * [Modifying some medication information](#modifying-some-medication-information) + * [Taking the medication](#taking-the-medication) + * [Saving data](#saving-data) # Setting up and getting started +## Setting up the project in your computer +
+:warning: Warning: + +Follow the steps in the following guide precisely... + +
+ +First, fork this [repo](https://github.com/AY2324S2-CS2113T-T09-1/tp), +and clone the fork into your computer. + +We highly recommend you to use Intellij IDEA. +1. **Configure the JDK**: Follow the +[guide IDEA: Configuring the JDK](https://www.jetbrains.com/help/idea/sdk.html#set-up-jdk) +to ensure Intellij is configured to use JDK 11. +2. **Import the project as a Gradle project**: Follow the +[guide IDEA: Importing a Gradle project](https://se-education.org/guides/tutorials/intellijImportGradleProject.html) +to import the project into IDEA. +3. **Verify the setup**: + 1. meditracker.MediTracker and try a few commands. + You can refer to our [UserGuide](UserGuide.md). + 2. Run the tests to ensure they all pass using Gradle. + Open a console and run the command gradlew clean test (Mac/Linux: ./gradlew clean test) # Design & implementation @@ -46,28 +97,37 @@ parsing the arguments. - Step 7. Checks and updates daily medication records in `DailyMedicationManager`. - Step 8. `Ui` displays success or error messages to the user. +### Expanding Step 7 +![sublist](images/AddToSubLists.png) +- Every medication is checked if they contain dosage for each `period` (morning, afternoon, evening) of the day. +- If `getDosage()` in each period is not null, then a new `dailyMedication` object is created with the `name`, `dosage` +and `period` values. +- This `dailyMedication` is then added to the respective sub lists according to the `period`. +- Finally, the `dailyMedication` is saved into the text file and returns `true` if saved successfully. + --- - ## List Medication Command +![sublist](images/ListCommand.png) The list medication command extends from Command parent class and contains the following methods: -- execute(MedicationManager medicationManager) - Executes the list command and performs its specific task, -t. -```Where the task can be either 'list -t all' to list all medications or 'list -t today' to list medications for the day, which is divided into three categories -> Morning, Afternoon and Evening. ``` - - +- execute(MedicationManager medicationManager) - Executes the list command and performs its specific task, -t. +- The task can be either `list -t all` to list all medications or `list -t today` to list medications for the day, +which is divided into three categories -> Morning, Afternoon and Evening. + **The 'list -t' command requires the following:** - 'all' - to run printAllMedications() from the MedicationManager. **The following commands print medications to be taken in a day:** -1. 'today' - to run printMedications() from the DailyMedicationManager. -2. 'today -m' to run printTodayMedications(List medications, List subList, String period) +1. `today` - to run printMedications() from the DailyMedicationManager. +2. `today -m` to run printTodayMedications(List medications, List subList, String period) from the DailyMedicationManager -3. 'today -a' to run printTodayMedications(List medications, List subList, String period) +3. `today -a` to run printTodayMedications(List medications, List subList, String period) from the DailyMedicationManager -4. 'today -e' to run printTodayMedications(List medications, List subList, String period) +4. `today -e` to run printTodayMedications(List medications, List subList, String period) from the DailyMedicationManager -* On first run, the programs reads into the MedicationManager and determines if a medication is to be added to today's list, based on the repeat value. +* On first run, the programs reads into the MedicationManager and determines if a medication is to be added to today's +list, based on the repeat value. * The repeat value ranges from `1 to 7` (number of days in a week) * This verifies if the user is taking that medication every day / every 2 days / every 3 days etc. * Then, based on the dosage flags (from `add` command), @@ -101,11 +161,11 @@ view command behaves at each step. - Step 5. `If` the parsed arguments is one, then `ViewCommand` calls `execute()` to show the specific medication - Step 6. `execute()` calls `printSpecificMedication(medication) in `MedicationManager`. - Step 7. `MedicationManager` then gets the medication via `getMedication(medication)` -and displays the the medication via `printSpecificMed(medicationDetails)` in `Ui`. +and displays the medication via `printSpecificMed(medicationDetails)` in `Ui`. - Step 8. `Ui` displays a success message to the user. - Step 9. `Else`, if the parsed arguments is more than one, then `Ui` displays an error message to the user. -### Search Medication Command +## Search Medication Command The search medication command extends from Command parent class and contains the following methods: - execute(MedicationManager, DailyMedicationManager, Ui) - Searches the local medication library for medication names, what illnesses they treat and their side effects, and prints the results to the user. @@ -209,19 +269,27 @@ Ensuring that you would not forget your next dose of medication. ## User Stories -| Version | As a ... | I want to ... | So that I can ... | -|---------|----------|--------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| -| v1.0 | user | enter my medications with its relevant information in one go | add my medication entry efficiently and refer to them when I forget my medication information | -| v1.0 | user | indicate the medications that I have taken | know when is my next dose and how well I am following doctors orders, and show how well I am taking my medications at the appropriate times of the day | -| v1.0 | user | know what medications i have to take throughout the day | mark them as taken or not, thus not miss or forget to take what I have to take for the day | -| v1.0 | user | edit the details in my medication list | ensure that its medication information is up-to-date with my modifications | -| v1.0 | user | delete medications medication list | remove medications that I do not need will not be there anymore | -| v1.0 | user | search medications from existing medicine library | search medications locally to have a quick preview of them and their purpose without the web | -| v1.0 | user | know the list of medications I have added | have a quick overview of the medication list and check the quantity and expiry date of each medication | -| v1.0 | user | Save data locally | Use the application and see the data even when offline between sessions (data is persistent) | -| v2.0 | user | Be able to save the file to a place of my choosing | I can easily refer or transfer the files to another system | -| v1.0 | user | Be able to load existing data | I don't have to start from a fresh state everytime | -| v2.0 | user | Be able to load existing data from a place I choose | load the data by typing rather than dragging to the default save location | +| Version | As a ... | I want to ... | So that I can ... | +|---------|----------|------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| +| v1.0 | user | enter my medications with its relevant information in one go | add my medication entry efficiently and refer to them when I forget my medication information | +| v1.0 | user | indicate the medications that I have taken | know when is my next dose and how well I am following doctors orders, and show how well I am taking my medications at the appropriate times of the day | +| v1.0 | user | know what medications i have to take throughout the day | mark them as taken or not, thus not miss or forget to take what I have to take for the day | +| v1.0 | user | edit the details in my medication list | ensure that its medication information is up-to-date with my modifications | +| v1.0 | user | delete medications medication list | remove medications that I do not need will not be there anymore | +| v1.0 | user | search medications from existing medicine library | search medications locally to have a quick preview of them and their purpose without the web | +| v1.0 | user | know the list of medications I have added | have a quick overview of the medication list and check the quantity and expiry date of each medication | +| v2.0 | user | see how much to be taken at each specific time of the day | have a quick overview of the list of medications to take at the specific period of the day | +| v2.0 | user | retrieve all the values related to a medication | have a quickly verify all the details I have input for that particular medication | +| v2.0 | user | search medications by their side effects from existing medicine library | search medications by their side effects locally to have a quick preview of them and their purpose without the web | +| v2.0 | user | search medications by their illness treatment from existing medicine library | search medications by their illness treatment locally to have a quick preview of them and their purpose without the web | +| v2.0 | user | mark a medication as taken without specifying the period | reduce the hassle of telling the program explicitly that I have taken a medication for that period of the day | +| v2.1 | user | know which medications are low in quantity | filter from my list of medications and see which ones need to be restock soon | +| v2.1 | user | know which medications are going to be expired | filter from my list of medications and see which ones are going to be expired | +| v2.1 | user | filter my medications based on a keyword | have a quick overview of the medication list and check the quantity and expiry date of each medication | +| v1.0 | user | Save data locally | Use the application and see the data even when offline between sessions (data is persistent) | +| v2.0 | user | Be able to save the file to a place of my choosing | I can easily refer or transfer the files to another system | +| v1.0 | user | Be able to load existing data | I don't have to start from a fresh state everytime | +| v2.0 | user | Be able to load existing data from a place I choose | load the data by typing rather than dragging to the default save location | ## Non-Functional Requirements - The user's program data (medication, daily medication) should be persistent between program sessions. @@ -231,11 +299,13 @@ Ensuring that you would not forget your next dose of medication. # Glossary -| Term | Meaning | -|-----------------------|---------------------------------------------------------------------------| -| JSON | A text-based file format to save data | -| Medication Data | Data related to the overview of the medication itself | -| Daily Medication Data | Data related to the medication's current day dosage, including its status | +| Term | Explanation | +|-----------------------|---------------------------------------------------------------------------------------------------------------------------------| +| JSON | JSON stands for JavaScript Object Notation, which is used to save **all** medications added by the user. | +| text file | Medications to be taken for a particular day is saved in the text file, and a new text file is created at the start of the day. | +| Flags | Most commands in MediTracker uses the flags with the "-" to recognise values within certain fields. Eg. `-n`, `-a`, `-l`, etc. | +| Medication Data | Data related to the overview of the medication itself | +| Daily Medication Data | Data related to the medication's current day dosage, including its status | # Instructions for manual testing
diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 19fec9d54d..c0b81e0cc1 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -16,10 +16,10 @@ data storage so that you can review your past medication intake.
@@ -277,7 +277,7 @@ Morning: :information_source: Info: If you want to mark the medication you have taken, you can refer to the Take -Command here. +Command.
@@ -791,7 +791,7 @@ See the part on Editing the File for warnings on ### Editing the file The medication information are saved in a `.json` format while the daily medication information are saved -in the `.txt` format (two independent files). Advanced users can modify the text files directly. +in the `.txt` format (two independent files). Advanced users can modify either files directly.
:bangbang: Danger: @@ -868,11 +868,22 @@ This folder resides at the same level as the `meditracker.jar` file. To transfer the data, just copy/shift the `data` folder to the new computer, making sure it is at the same level as the `.jar` file. +**Q**: Why does the program keep returning "Invalid index specified"? + +**A**: Please make sure you are referring to the correct list. MediTracker uses [`list -t all`](#all-medications) +and [`list -t today`](#daily-medications) commands to display all medications and medications to be taken for the day, +respectively. You may also use the ` -h` to see how the command works. +
## Glossary +| Term | Explanation | +|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| .json | JSON stands for JavaScript Object Notation, which is used to save **all** medications added by the user. | +| .txt | It represents a text file that contains plain text in the form of lines.
Medications to be taken for a particular day is saved in the text file, and a new text file is created at the start of the day. | +| Flags | Most commands in MediTracker uses the flags with the "-" to recognise values within certain fields. Eg. `-n`, `-a`, `-l`, etc. |
diff --git a/docs/diagrams/AddCommand.puml b/docs/diagrams/AddCommand.puml index 26d1813099..cab822ce64 100644 --- a/docs/diagrams/AddCommand.puml +++ b/docs/diagrams/AddCommand.puml @@ -6,7 +6,7 @@ participant "<>\n MedicationManager" as MedicationManager participant "<>\n DailyMedicationManager" as DailyMedicationManager participant "<>\n Ui" as Ui -User -> AddCommand: new AddCommand(arguments) +User -> AddCommand ** : new AddCommand(arguments) activate AddCommand AddCommand -> ArgumentList: parse(arguments) activate ArgumentList diff --git a/docs/diagrams/AddToSubLists.puml b/docs/diagrams/AddToSubLists.puml new file mode 100644 index 0000000000..fe98b13494 --- /dev/null +++ b/docs/diagrams/AddToSubLists.puml @@ -0,0 +1,34 @@ +@startuml +'https://plantuml.com/sequence-diagram +actor User + +participant "<>\n :DailyMedicationManager" as DailyMedicationManager +participant "period:Period" as Period +participant "medication:Medication" as Medication + +User -> DailyMedicationManager: addToSublists(medication) +activate DailyMedicationManager + loop all periods + DailyMedicationManager -> Period: gePeriod() + activate Period + return period + deactivate Period + DailyMedicationManager -> Medication: getDosage(), getName() + activate Medication + return dosage, name + deactivate Medication + DailyMedicationManager -> "dailyMedication:DailyMedication" as DailyMeds ** : new DailyMedication(name, dosage, period) + activate DailyMeds + return dailyMedication + deactivate DailyMeds + DailyMedicationManager -> DailyMedicationManager: addDailyMedication(dailyMedication) + activate DailyMedicationManager + return + participant "<>\n :FileReaderWriter" as FileReaderWriter + DailyMedicationManager -> FileReaderWriter: saveDailyMedicationData(null) + activate FileReaderWriter + return true + end +DailyMedicationManager --> User +deactivate DailyMedicationManager +@enduml \ No newline at end of file diff --git a/docs/diagrams/ListCommand.puml b/docs/diagrams/ListCommand.puml new file mode 100644 index 0000000000..21f10e4042 --- /dev/null +++ b/docs/diagrams/ListCommand.puml @@ -0,0 +1,48 @@ +@startuml +'https://plantuml.com/sequence-diagram + +actor User + +participant ":ListCommand" as LC +participant "ARGUMENT_LIST:ArgumentList" as AL + +User -> LC ** : new \nListCommand\n(argument) +activate LC +LC -> AL: parse(argument) +activate AL +AL -> "parsedArguments:ArgumentParser" as AP ** : new ArgumentParser(argument) +activate AP +return argumentParser.parsedArguments +return parsedArguments +deactivate AP +deactivate AL + +participant ":ArgumentName" as AN +participant "<>\n :MedicationManager" as MM +participant "<>\n :DailyMedicationManager" as DM +participant "<>\n :Ui" as UI +LC -> AN: parsedArguments.get() +return listTypeString +LC -> LC: execute() +activate LC + alt listTypeString.equals("all") + LC -> MM: printAllMeds() + activate MM + return + deactivate MM + else listTypeString.equals("today") + LC -> DM: printTodayMeds() + activate DM + return + deactivate DM + else else + LC -> UI: showErrorMessage("Unknown list type") + activate UI + return + deactivate UI + end +LC --> LC +deactivate LC +LC --> User +deactivate LC +@enduml \ No newline at end of file diff --git a/docs/diagrams/ViewCommand.puml b/docs/diagrams/ViewCommand.puml index 3883e23373..534060d0b3 100644 --- a/docs/diagrams/ViewCommand.puml +++ b/docs/diagrams/ViewCommand.puml @@ -1,52 +1,53 @@ @startuml -actor User +actor User #e67678 title View Command Sequence Diagram participant ":ViewCommand" as ViewCommand -participant ":ArgumentList" as ArgumentList +participant "ARGUMENT_LIST:ArgumentList" as ArgumentList participant ":ArgumentParser" as ArgumentParser +participant ":ArgumentName" as ArgumentName participant "<>\n MedicationManager" as MedicationManager participant "<>\n Ui" as Ui -User --> ViewCommand: new ViewCommand(args) +User --> ViewCommand ** : new ViewCommand(argument) activate ViewCommand -ViewCommand -> ArgumentList: parse(args) - -activate ArgumentList -ArgumentList -> ArgumentParser: parse(args) -deactivate ArgumentList - -activate ArgumentParser -ArgumentParser --> ViewCommand: return parsedArgs +ViewCommand -> ArgumentList: parse(argument) +activate ArgumentList #e67678 +ArgumentList -> ArgumentParser ** : New ArgumentParser(argument) +activate ArgumentParser #a67671 +ArgumentParser --[#red]> ArgumentList: parsedArguments deactivate ArgumentParser +ArgumentList --[#red]> ViewCommand: parsedArguments +deactivate ArgumentList -alt #transparent oneParsedArgs - ViewCommand -> ViewCommand: execute(medication) - activate ViewCommand #65c2a6 +ViewCommand -> ViewCommand: execute(medication) +activate ViewCommand #65c2a6 - ViewCommand -> MedicationManager: printSpecificMedication(medication) - activate MedicationManager #d192d0 - MedicationManager -> MedicationManager: getMedication(medication) + alt oneParsedArgument + ViewCommand -> MedicationManager: printSpecificMedication(medication) + activate MedicationManager #d192d0 + MedicationManager -> MedicationManager: getMedication(medication) - MedicationManager -> Ui: printSpecificMed(medicationDetails) - activate Ui #c6d67e - Ui --[#red]> MedicationManager: return - MedicationManager --[#red]> ViewCommand: return - deactivate MedicationManager + MedicationManager -> Ui: printSpecificMed(medicationDetails) + activate Ui #c6d67e + Ui --[#red]> MedicationManager: + MedicationManager --[#red]> ViewCommand: + deactivate MedicationManager - ViewCommand -> Ui: showSuccessMessage("Medication details has been retrieved") - Ui --[#red]> ViewCommand: return - deactivate Ui + ViewCommand -> Ui: showSuccessMessage("Medication details has been retrieved") + Ui --[#red]> ViewCommand: + deactivate Ui -else #transparent more\nThanOne\nParsed\nArgs - ViewCommand -> Ui: showErrorMessage("You can only have one flag!") - activate Ui #c6d67e - Ui --[#blue]> ViewCommand: return - deactivate Ui -end + else #transparent more\nThanOne\nParsed\nArgs + ViewCommand -> Ui: showErrorMessage("You can only have one flag!") + activate Ui #c6d67e + Ui --[#red]> ViewCommand: + deactivate Ui + end +ViewCommand --[#blue]> ViewCommand deactivate ViewCommand -User <-- ViewCommand +User <[#red]-- ViewCommand deactivate ViewCommand @enduml \ No newline at end of file diff --git a/docs/images/AddCommand.png b/docs/images/AddCommand.png index 7552a1661b..e4cac70407 100644 Binary files a/docs/images/AddCommand.png and b/docs/images/AddCommand.png differ diff --git a/docs/images/AddToSubLists.png b/docs/images/AddToSubLists.png new file mode 100644 index 0000000000..ffcb329cc5 Binary files /dev/null and b/docs/images/AddToSubLists.png differ diff --git a/docs/images/ListCommand.png b/docs/images/ListCommand.png new file mode 100644 index 0000000000..d4b268cb51 Binary files /dev/null and b/docs/images/ListCommand.png differ diff --git a/docs/images/ViewCommand.png b/docs/images/ViewCommand.png index c01eeb25d4..2f740b2654 100644 Binary files a/docs/images/ViewCommand.png and b/docs/images/ViewCommand.png differ diff --git a/docs/team/e0958902.md b/docs/team/e0958902.md index 9b0e08244d..3532120edf 100644 --- a/docs/team/e0958902.md +++ b/docs/team/e0958902.md @@ -1,38 +1,101 @@ # Eric Sim Chong Li - Project Portfolio Page +## MediTracker + ## Overview -The following contains my contribution summary and pull request reviews. +The following contains my contribution summary and pull request reviews on our product, MediTracker. +MediTracker is a command-line interface application where it allows users to keep track of their +daily medications and get reminded of low quantity and nearing expiry medications.
+ + +* [Overview](#overview) +* [Summary of Contributions](#summary-of-contributions) + * [Code Contributed](#code-contributed) + * [Enhancements implemented](#enhancements-implemented) + * [Developer Guide Contributions](#developer-guide-contributions) + * [User Guide Contributions](#user-guide-contributions) + * [Review/mentoring contributions](#reviewmentoring-contributions) + * [Team-based tasks and contributions beyond the project team](#team-based-tasks-and-contributions-beyond-the-project-team) + + +
+ +
### Summary of Contributions -- Created relevant milestones labels -- Map some of the user stories to issues -- Reviewed multiple pull requests (PR) -- Added guide on how to improve on ListCommand in the developer guide -- Issue #49: list all medications from 'MedicationManager' -- Issue #15: Show detailed view of a medication -- Issue #162: Update view feature to have more supported flags -- Issue #175: Fix `IndexOutOfBoundsException` for `view` command (Related issues: #171, #169, #165, #152) -- Issue #153: Fix `NumberFormatException` for `view` command -- Issue #181: Fix unaligned medication list output (Related issue: #166) -- Issue #214: Fix User Guide to explicitly state the requirements for every flag -- Issue #202: Fix Expiry date issues (Related Issued: #192, #188, #187, #186, #161) +- Created relevant tags and milestones. +- Map some of the user stories to issues. +- Reviewed multiple pull requests (PR). +- Added guide on how to improve on ListCommand and ViewCommand in the developer guide. +- [PR #49:](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/49) List all medications from 'MedicationManager'. +- [PR #15:](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/127) Show detailed view of a medication. +- [PR #206](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/206) + - Update view feature to have more supported flags. + - Fix `IndexOutOfBoundsException` for `view` command
+ (Related issues: #171, #169, #165, #152). + - Fix `NumberFormatException` for `view` command. + - Fix unaligned medication list output (Related issue: #166). +- [PR #214:](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/214) +Fix User Guide to explicitly state the requirements for every flag. +- [PR #202:](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/220) +Fix Expiry date issues (Related Issues: #192, #188, #187, #186, #161).
+ +### Code Contributed +Here is the [RepoSense link](https://nus-cs2113-ay2324s2.github.io/tp-dashboard/?search=e0958902&breakdown=true) +of my code contributions.
+ +### Enhancements implemented +- Implemented the ListCommand to query relevant fields in the Medication Manager +containing the medication list. e.g `list -t all`. +- Implemented the ViewCommand to display all relevant fields of a medication, +where it supports different flags with its argument. e.g `view -e 2025`. +- Performed JUnit tests on the methods used in List and View Commands. +- Ensured that the User Guide is consistent across all commands/features.
### Developer Guide Contributions -- Information on how ListCommand works and how to use it. -- Relevant user stories done in milestone v1.0 +- Information on how ListCommand and ViewCommand works, and how to use it. +- Included relevant diagrams to illustrate how ListCommand and ViewCommand works. +- Relevant user stories done in milestones.
### User Guide Contributions -- Updated user guide to include listing of all medications -- Updated user guide to include viewing of specific medications -- Ensured that the formatting, alignment, and consistency is in place across all pages +- Updated user guide to include listing of all medications. +- Updated user guide to include viewing of specific medications. +- Ensured that the formatting, alignment, and consistency is in place across all pages. -### PR Reviews -#9, #18, #20, #23, #53, #73, #75, #84, #88, -#89, #90, #95, #98, #115, #116, #126, #127, -#129, #134, #139, #210, #212, #213, #238, -#239, #243 +
-### Team-based tasks -- Created relevant tags and milestones. +
+ +### Review/mentoring contributions +- [#9](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/17) Add JavaDoc and other documentation to Ui. +- [#18](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/18) Created class to test for searching medication from external database. +- [#20](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/20) feat: Mark medication taken. +- [#23](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/23) Misc: change package name and update PR Template. +- [#53](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/53) Add medication info into daily. +- [#73](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/73) refactor: Modify Ui to be static. +- [#75](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/75) feat: More flags for Add command, Exception Handling and Double casting +- [#84](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/84) Separate daily medications to sub lists. +- [#88](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/88) Update list all medication. +- [#89](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/89) DG: Adds DG from Lin Htet. +- [#90](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/90) DG: Add DG by kyuichyi. +- [#95](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/95) feat: Add take untake enhancements. +- [#98](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/98) Update style: styling update. +- [#115](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/115) test: add tests for search command functionality +- [#116](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/116) Obj for each sub list. +- [#126](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/126) refactor: Remove prompt from Argument classes. +- [#127](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/127) Query specific medication. +- [#129](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/129) fix(bug): ModifyCommand handle erroneous data and fix AddCommand error handling. +- [#134](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/134) Updates UG: Lin Htet. +- [#139](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/139) docs: Update DG for Add command with sequence diagram. +- [#210](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/210) fix: Fix Add Command PE-D issues. +- [#212](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/212) docs: Update Dev Guide based on comments. +- [#213](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/213) Improve logging: Song Xuan. +- [#238](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/238) docs: Update search in UG. +- [#239](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/239) style: fix style. +- [#243](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/243) test: Add modify tests. + +### Team-based tasks and contributions beyond the project team +- Created relevant tags and milestones to have a soft and hard deadline. +- Answered some questions in the forum and encouraged others to join and verify. - Ensured that assertions is enabled in Gradle. -- Polish up the consistency of sections in User . \ No newline at end of file +- Polish up the consistency of sections in the User Guide.
\ No newline at end of file diff --git a/docs/team/t0nylin.md b/docs/team/t0nylin.md index 7ca0d703ab..3b229451f7 100644 --- a/docs/team/t0nylin.md +++ b/docs/team/t0nylin.md @@ -24,20 +24,26 @@ The following contains my contribution summary and pull request reviews. - Issue #198: Specifying the correct list index to refer when using take command - Issue #201: Stating the usage of -h in list command - Issue #200: Stating in UG that entering the command word alone with print the help message +- Issue #147: Abidance to a stricter checkstyle ### Developer Guide Contributions - Added some user stories into the table +- Added a sequence diagram for how a medication is added into dailyMedicationManager - Added command guide for how list -t today -m/-a/-e will print - - Explained how the time ranges affects the addition of each medication into their sub lists + - Explained how the time ranges affect the addition of each medication into their sub lists +- Added more user stories for v2.0 and v.21 +- Added a Glossary section ### User Guide Contributions - Summary of list for the Daily Medication - Added breakdown of sub lists within the Daily Medication list - Helped to construct clearer instructions in UG, especially issues found from PE-D +- Added a Glossary section ### PR Reviews -#4, #5, #8, #10, #54, #56, #57, #68, #75, #78, #85, #88, #133, #135, #144, #207, #213 #223 +#4, #5, #8, #10, #54, #56, #57, #68, #75, #78, #85, #88, #133, #135, #144, #207, #213, #223, +#229, #242, #247, #248 ### Team-based tasks - Book room for weekly project meetings diff --git a/src/main/java/meditracker/dailymedication/DailyMedication.java b/src/main/java/meditracker/dailymedication/DailyMedication.java index 46a23d2201..ed770db77e 100644 --- a/src/main/java/meditracker/dailymedication/DailyMedication.java +++ b/src/main/java/meditracker/dailymedication/DailyMedication.java @@ -1,10 +1,10 @@ package meditracker.dailymedication; +import java.util.logging.Logger; + import meditracker.logging.MediLogger; import meditracker.time.Period; -import java.util.logging.Logger; - // @@author T0nyLin /** * Stores name and the status of daily medication (taken or not) diff --git a/src/main/java/meditracker/dailymedication/DailyMedicationManager.java b/src/main/java/meditracker/dailymedication/DailyMedicationManager.java index 6afa6664f1..296d119ec3 100644 --- a/src/main/java/meditracker/dailymedication/DailyMedicationManager.java +++ b/src/main/java/meditracker/dailymedication/DailyMedicationManager.java @@ -1,5 +1,9 @@ package meditracker.dailymedication; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.List; + import meditracker.exception.InsufficientQuantityException; import meditracker.exception.MedicationNotFoundException; import meditracker.exception.MedicationUnchangedException; @@ -10,10 +14,6 @@ import meditracker.time.Period; import meditracker.ui.Ui; -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.List; - /** * Manages a list of DailyMedication and CRUD-operations (Create, Read, Update, Delete) * @@ -355,7 +355,7 @@ public static boolean doesBelongToDailyList(Medication medication) { switch (num) { case 1: - return true; //everyday + return true; //everyday case 2: return isNDay(medication, 2); //every 2 days case 3: @@ -384,7 +384,7 @@ private static boolean isNDay(Medication medication, int n) { int dateNum = medication.getDayAdded(); int currentDayValue = currentDate.getDayOfYear(); int daysDiff = currentDayValue - dateNum; - return daysDiff % n == 0; //modulo to find out if dailyMedication can be added to today's list + return daysDiff % n == 0; //modulo to find out if dailyMedication can be added to today's list } /** diff --git a/src/test/java/meditracker/command/ListCommandTest.java b/src/test/java/meditracker/command/ListCommandTest.java index f154c925e1..87eb4871b2 100644 --- a/src/test/java/meditracker/command/ListCommandTest.java +++ b/src/test/java/meditracker/command/ListCommandTest.java @@ -31,7 +31,7 @@ * This test file is to perform tests on ListCommands */ class ListCommandTest { - private ArgumentList testArgumentList = new ArgumentList( + private final ArgumentList testArgumentList = new ArgumentList( new NameArgument(false), new QuantityArgument(false), new DosageMorningArgument(false), @@ -209,8 +209,8 @@ void listAllMedication_unknownFlagAfterCommand_showErrorMessage() { String testArgumentString = "list -t all -asdf"; assertThrows( - ArgumentException.class, - () -> testArgumentList.parse(testArgumentString) + ArgumentException.class, () + -> testArgumentList.parse(testArgumentString) ); } @@ -267,8 +267,8 @@ void listDailyMedication_unknownFlagAfterCommand_showErrorMessage() { String testArgumentString = "list -t today -a -asd"; assertThrows( - ArgumentException.class, - () -> testArgumentList.parse(testArgumentString) + ArgumentException.class, () + -> testArgumentList.parse(testArgumentString) ); } @@ -277,8 +277,8 @@ void listDailyMedication_extraWordsAfterFlag_showErrorMessage() { String testArgumentString = "list -t today -a asdf"; assertThrows( - ArgumentException.class, - () -> testArgumentList.parse(testArgumentString) + ArgumentException.class, () + -> testArgumentList.parse(testArgumentString) ); } } diff --git a/src/test/java/meditracker/dailymedication/DailyMedicationManagerTest.java b/src/test/java/meditracker/dailymedication/DailyMedicationManagerTest.java index 239872bafd..dd8079e8aa 100644 --- a/src/test/java/meditracker/dailymedication/DailyMedicationManagerTest.java +++ b/src/test/java/meditracker/dailymedication/DailyMedicationManagerTest.java @@ -1,5 +1,19 @@ package meditracker.dailymedication; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + import meditracker.command.AddCommand; import meditracker.exception.ArgumentException; import meditracker.exception.HelpInvokedException; @@ -11,19 +25,6 @@ import meditracker.medication.MedicationManager; import meditracker.medication.MedicationManagerTest; import meditracker.time.Period; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.time.LocalDate; -import java.time.format.DateTimeFormatter; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; public class DailyMedicationManagerTest { @@ -31,8 +32,8 @@ public class DailyMedicationManagerTest { // @@author T0nyLin public static void resetDailyMedicationManager() throws InvocationTargetException, IllegalAccessException, NoSuchMethodException { - Method resetDailyMedicationManagerMethod - = DailyMedicationManager.class.getDeclaredMethod("clearDailyMedication"); + Method resetDailyMedicationManagerMethod = + DailyMedicationManager.class.getDeclaredMethod("clearDailyMedication"); resetDailyMedicationManagerMethod.setAccessible(true); resetDailyMedicationManagerMethod.invoke(DailyMedicationManager.class); } @@ -129,8 +130,8 @@ public void takeDailyMedication_lowQuantityMedication_insufficientQuantity() thr int actualIndex = 1; // 1-based indexing assertThrows( - InsufficientQuantityException.class, - () -> DailyMedicationManager.takeDailyMedication(actualIndex, Period.MORNING)); + InsufficientQuantityException.class, () + -> DailyMedicationManager.takeDailyMedication(actualIndex, Period.MORNING)); } @Test diff --git a/src/test/java/meditracker/ui/UiTest.java b/src/test/java/meditracker/ui/UiTest.java index 4648e3ddec..8815dce1fa 100644 --- a/src/test/java/meditracker/ui/UiTest.java +++ b/src/test/java/meditracker/ui/UiTest.java @@ -1,16 +1,17 @@ package meditracker.ui; -import meditracker.dailymedication.DailyMedication; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.ByteArrayOutputStream; import java.io.PrintStream; import java.util.ArrayList; import java.util.List; -import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import meditracker.dailymedication.DailyMedication; //Solution below adapted by https://stackoverflow.com/questions/58665761 class UiTest { @@ -36,8 +37,8 @@ void printMedsList_sizeOfMedicationList_expectPrintedList() { for (DailyMedication dailyMedication : medications) { int numbering = medications.indexOf(dailyMedication) + 1; - expectedOutput.append("\t"). - append(numbering).append(". ").append(dailyMedication) + expectedOutput.append("\t") + .append(numbering).append(". ").append(dailyMedication) .append(System.lineSeparator()); } assertEquals(expectedOutput.toString(), output.toString());