Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add module storage #35

Merged
merged 10 commits into from
Mar 20, 2024
Merged

Conversation

yadunut
Copy link

@yadunut yadunut commented Mar 18, 2024

WIP PR to add module storage. This works by

  1. adding a new JsonModuleMapStorage which handles reading the JSON file from within the resources
    • The path is hardcoded and not parameterised as this file is not updatable.
    • This returns a ModuleMap, a mapping of ModuleCode to Module.
  2. Separates the storage layer and the Model layer with JsonAdaptedModule and Module

Closes #32
Closes #23

@yadunut yadunut added this to the v1.2 milestone Mar 18, 2024
@yadunut yadunut marked this pull request as ready for review March 18, 2024 06:16
@yadunut yadunut requested a review from a team March 18, 2024 06:17
@taufiq
Copy link

taufiq commented Mar 18, 2024

Holy cowabunga! This is a heavy PR 😮 Will get on it ASAP! 🤠

Copy link

codecov bot commented Mar 18, 2024

Codecov Report

Attention: Patch coverage is 37.17949% with 49 lines in your changes are missing coverage. Please review.

Project coverage is 72.80%. Comparing base (31eee46) to head (8f89cdd).

Files Patch % Lines
...va/seedu/address/storage/JsonModuleMapStorage.java 15.00% 17 Missing ⚠️
.../java/seedu/address/storage/JsonAdaptedModule.java 0.00% 14 Missing ⚠️
...in/java/seedu/address/model/module/ModuleCode.java 50.00% 7 Missing ⚠️
src/main/java/seedu/address/MainApp.java 0.00% 6 Missing ⚠️
...ain/java/seedu/address/storage/StorageManager.java 40.00% 3 Missing ⚠️
...ain/java/seedu/address/model/module/ModuleMap.java 66.66% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #35      +/-   ##
============================================
- Coverage     75.10%   72.80%   -2.31%     
- Complexity      430      432       +2     
============================================
  Files            76       78       +2     
  Lines          1386     1434      +48     
  Branches        128      129       +1     
============================================
+ Hits           1041     1044       +3     
- Misses          314      360      +46     
+ Partials         31       30       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yadunut yadunut requested review from taufiq and removed request for a team March 18, 2024 09:45
Copy link

@blaukc blaukc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for fixing my code LOL. Maybe taufiq can look thru first as well then merge since its good to read thru before doing his part i feel.

@yadunut
Copy link
Author

yadunut commented Mar 18, 2024

Thanks for fixing my code LOL.

There isn't anything particularly wrong with the way you did, its how I would have done in almost any other project. In this project, they are very explicit with their separation between the Model and Storage, and thus, the code is extremely verbose as seen above. There are benefits to doing it like this, for example, when you'll be implementing the student <-> module integration. We can have completely different representations at the Model Layer as compared to the Storage Layer. Whereas if the JSON structures was embedded in the Model and Student, it would be very hard to separate the storage representation and the Model representation of our data.

Copy link

@taufiq taufiq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@taufiq taufiq merged commit fb6e29b into AY2324S2-CS2103T-W12-2:master Mar 20, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As a user, I should be able to store information about modules
3 participants