-
Notifications
You must be signed in to change notification settings - Fork 4
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
Refactor commands #35
Refactor commands #35
Conversation
…ekyll-config Patch site-wide settings
src/main/java/seedu/address/logic/parser/EditCommandParser.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This review covers the rest of the production classes (I haven't reviewed the tests yet).
Also the getAddressBookFilePath
method in the Logic
interface/LogicManager
class might have been missed out in the refactoring hehe but I couldn't leave a comment cos those lines weren't marked as diffs.
src/main/java/seedu/address/storage/JsonSerializableAddressBook.java
Outdated
Show resolved
Hide resolved
for (JsonAdaptedModule jsonAdaptedModule : modules) { | ||
Module module = jsonAdaptedModule.toModelType(); | ||
if (gradPad.hasModule(module)) { | ||
throw new IllegalValueException(MESSAGE_DUPLICATE_MODULE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a suggestion/request for change, but I was just wondering why the original code does this redundant check here when it could just call gradPad's setModules
fxn, which already uses UniqueModuleList
to ensure all modules are unique.
I just put this comment here first in case we want to improve code quality next time.
for (JsonAdaptedModule jsonAdaptedModule : modules) { | |
Module module = jsonAdaptedModule.toModelType(); | |
if (gradPad.hasModule(module)) { | |
throw new IllegalValueException(MESSAGE_DUPLICATE_MODULE); | |
List<Modules> gradPadModules = modules.stream().map(JsonAdaptedModule::toModelType).collect(Collectors.toList()); | |
try { | |
gradpad.setModules(gradPadModules); | |
} catch (DuplicateModuleException ex) { | |
throw new IllegalValueException(MESSAGE_DUPLICATE_MODULE); | |
} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the test classes and mostly looks great man; just a few nits!
src/test/java/seedu/address/logic/parser/EditCommandParserTest.java
Outdated
Show resolved
Hide resolved
src/test/java/seedu/address/logic/commands/EditCommandTest.java
Outdated
Show resolved
Hide resolved
src/test/java/seedu/address/logic/commands/EditModuleDescriptorTest.java
Outdated
Show resolved
Hide resolved
src/test/java/seedu/address/testutil/EditModuleDescriptorBuilder.java
Outdated
Show resolved
Hide resolved
src/test/java/seedu/address/testutil/EditModuleDescriptorBuilder.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NICE ONE 👍
src/test/java/seedu/address/logic/commands/DeleteCommandTest.java
Outdated
Show resolved
Hide resolved
src/test/java/seedu/address/logic/commands/EditCommandTest.java
Outdated
Show resolved
Hide resolved
src/test/java/seedu/address/logic/commands/EditCommandTest.java
Outdated
Show resolved
Hide resolved
src/test/java/seedu/address/logic/commands/FindCommandTest.java
Outdated
Show resolved
Hide resolved
src/test/java/seedu/address/logic/commands/FindCommandTest.java
Outdated
Show resolved
Hide resolved
src/test/java/seedu/address/testutil/EditModuleDescriptorBuilder.java
Outdated
Show resolved
Hide resolved
src/test/java/seedu/address/testutil/EditModuleDescriptorBuilder.java
Outdated
Show resolved
Hide resolved
Great find guys, I've edited accordingly to your comments. Thanks :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Steady brother 👍 Thanks for addressing all the comments 💯
Refactored Command, Parser and Storage packages.
Changes to Production Classes:
Name -> ModuleCode
Phone -> ModularCredits
Deleted Email and Address fields
Person -> Module
EditPersonDescriptor -> EditModuleDescriptor
AddressBookParser -> GradPadParser
AddressBookStorage -> GradPadStorage
JsonAdaptedPerson -> JsonAdaptedModule
JsonAddressBookStorage -> JsonGradPadStorage
Changes to Test Classes:
EditPersonDescriptorTest -> EditModuleDescriptorTest
AddressBookParserTest -> GradPadParserTest
JsonAdaptedPersonTest -> JsonAdaptedModuleTest
JsonAddressBookStorageTest -> JsonGradPadStorageTest
JsonSerializableAddressBookTest -> JsonSerializableGradPadTest
Changes to Test Util:
EditPersonDescriptorBuilder -> EditModuleDescriptorBuilder
AddressBookBuilder -> GradPadBuilder
Changes to test/data folders and files:
JsonAddressBookStorageTest -> JsonGradPadStorageTest (FOLDER)
invalidAndValidPersonAddressBook.json -> invalidAndValidModuleGradPad.json
invalidPersonAddressBook.json -> invalidModuleGradPad.json
notJsonFormatAddressBook -> notJsonFormatGradPad
JsonSerializableAddressBookTest -> JsonSerializableGradPadTest (FOLDER)
duplicatePersonAddressBook.json -> duplicateModuleGradPad.json
invalidPersonAddressBook.json -> invalidModuleGradPad.json
typicalPersonsAddressBook.json -> typicalModulesGradPad.json
Contents of the test data has also been changed from Person to Module
Notes
When refactoring, changed some names from the UI package (person -> module, name -> modulecode, etc).
Currently passes all tests from the Command and Parser packages and passes most of the tests from the Storage package (currently failing 3 tests)