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 Calendar Model #26

Merged

Conversation

lihongguang00
Copy link

Added model for calendar, along with addEvent feature.

Storage feature for events not implemented yet.

Created model for event for calendar
Add JavaDoc for Event class
Work in Progress
Added basic CML Calendar

Included features:
- Add event
Added JavaDocs to the following
-AddEventCommandParser
-AddressBookParser
-CalendarParser
-ComponentParser
-Calendar
-Event
-EventDecsription
-EventPeriod
Fixed Checkstyle and added more javadocs
Added necessary methods to fix JUnit test bugs
@codecov
Copy link

codecov bot commented Oct 8, 2023

Codecov Report

Attention: 36 lines in your changes are missing coverage. Please review.

Files Coverage Δ
...rc/main/java/seedu/address/logic/LogicManager.java 77.27% <100.00%> (ø)
src/main/java/seedu/address/logic/Messages.java 90.47% <100.00%> (+2.97%) ⬆️
...ain/java/seedu/address/logic/parser/CliSyntax.java 88.88% <100.00%> (+5.55%) ⬆️
...in/java/seedu/address/logic/parser/ParserUtil.java 96.15% <100.00%> (+1.03%) ⬆️
src/main/java/seedu/address/model/Model.java 100.00% <ø> (ø)
src/main/java/seedu/address/model/event/Event.java 100.00% <100.00%> (ø)
...va/seedu/address/model/event/EventDescription.java 100.00% <100.00%> (ø)
...in/java/seedu/address/model/event/EventPeriod.java 100.00% <100.00%> (ø)
.../seedu/address/model/event/SingleDayEventList.java 100.00% <100.00%> (ø)
...el/event/exceptions/ConflictingEventException.java 100.00% <100.00%> (ø)
... and 10 more

📢 Thoughts on this report? Let us know!.

Added JUnit test for AddEventCommand
Included updated dependencies for AddEventCommand JUnit Testing
Fixed checkstyle for AddEventCommandTest
Fixed AddEventCommandTest checkstyle
Fixed AddEventCommandTest checkstyle
Added JUnit testing for:
-parseEventDescription
-parseEventPeriod
Fixed checkstyle erros for ParserUtilTest
@lihongguang00 lihongguang00 added this to the v1.2 milestone Oct 9, 2023
@lihongguang00 lihongguang00 linked an issue Oct 9, 2023 that may be closed by this pull request
Updated user guide for AddEvent command to reflect new syntax
Added JUnit testing for AddEventCommandParser
Fixed checkstyle for AddEventCommandParserTest
Fixed checkstyle for AddEventCommandParserTest
Added JUnit testing for Calendar class
Deleted CalendarParser and ApplicationParser
Integerated all parsers into UniMateParser
Added more test cases for testing Calendar class
Fixed Checkstyle for more Calendar JUnit testing
Abstracted out:
-Daily events into a single SingleDayEventList class
-Collection of SingleDayEventList class into AllDaysEventListManager

Additionally, changed underlying data structure storing events in Calendar class into a single AllDaysEventListManager
Fixed checkstyle for previous commit
Fixed even more checkstyle for previous commit
Fix logic error causing addEvent command to not work
Fixed JUnit testing for AddEventCommandParser
Fixed Checkstyle for AddEventCommandParserTest
Added 100% code coverage for EventPeriod class
Fixed Checkstyle for EventPeriodTest
Fixed more checktyle for EventPeriodTest
Fixed more checktyle for EventPeriodTest
Fixed even more checkstyle for EventPeriodTest
Add full code coverage for EventDescription class
Added JUnit testing for Event class
Fix JUnit testing for Event class
Added full code coverage for SingleDayEventList class
@lihongguang00 lihongguang00 added the enhancement New feature or request label Oct 14, 2023
@lihongguang00 lihongguang00 self-assigned this Oct 14, 2023
Copy link

@Fallman2 Fallman2 left a comment

Choose a reason for hiding this comment

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

Generally looks good aside from a few small formatting issues.


/**
* Constructs a {@code LogicManager} with the given {@code Model} and {@code Storage}.
*/
public LogicManager(Model model, Storage storage) {
this.model = model;
this.storage = storage;
addressBookParser = new AddressBookParser();
this.uniMateParser = new UniMateParser();

Choose a reason for hiding this comment

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

The keyword "this' can be removed.


public static final String MESSAGE_SUCCESS = "New event added: %1$s";

public static final String MESSAGE_EVENT_CONFLICT = "This event is conflicting with another event";

Choose a reason for hiding this comment

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

Add a full-stop or ! after the sentence to keep it consistent with other messages.

Copy link
Author

Choose a reason for hiding this comment

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

For AddCommand given in AB3, theres no full-stop and ! after the sentence too

requireNonNull(description);
String trimmedDescription = description.trim();
if (trimmedDescription.isEmpty()) {
throw new ParseException(EventDescription.MESSAGE_CONSTRAINTS);

Choose a reason for hiding this comment

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

Consider putting this check into the EventDescription constructor instead as a validity check.

Copy link
Author

Choose a reason for hiding this comment

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

Abstracted out the checking of whether the trimmedDescription is a valid description by adding a static method in EventDescription isValid(String) to check.

Will still keep the check to be consistent with parseIndex, parseName, parsePhone, parseAddress and parseEmail methods in the same ParserUtil.java file

String trimmedStartDate = startDate.trim();
String trimmedEndDate = endDate.trim();
if (!EventPeriod.isValidPeriod(trimmedStartDate, trimmedEndDate)) {
throw new ParseException(EventPeriod.MESSAGE_CONSTRAINTS);

Choose a reason for hiding this comment

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

Same as above. Consider putting this check into EventPeriod constructor instead.

Copy link
Author

Choose a reason for hiding this comment

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

Will still keep the check to be consistent with parseIndex, parseName, parsePhone, parseAddress and parseEmail methods in the same ParserUtil.java file

Choose a reason for hiding this comment

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

Since there is only 1 class that extends Component Parser it might be better to put the methods of this class into UniMateParser instead.

//=========== Calendar ===================================================================================
@Override
public boolean canAddEvent(Event event) {
return this.calendar.canAddEvent(event);

Choose a reason for hiding this comment

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

Can remove "this" keyword here.

public void addEvent(Event event) {
requireAllNonNull(event);

this.calendar.addEvent(event);

Choose a reason for hiding this comment

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

Can remove "this" here as well.

* @param other The EventPeriod to compare with.
* @return 1 if this EventPeriod is after the other, -1 if it's before, 0 if they are the same.
*/
public int compareTo(EventPeriod other) {

Choose a reason for hiding this comment

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

Since there is a compareTo method, this class might want to implement Comparable

lihongguang00 and others added 11 commits October 14, 2023 23:15
Resolved all comments except for:
-ParserUtil lines 136-139
-ParserUtil lines 154-157
Let's migrate the docs site from Jekyll to MarkBind.

Primary author: @tlylt in se-edu/addressbook-level3/pull/156
Further tweaks: @damithc in se-edu/addressbook-level3/pull/206
Added User Stories
Completed Requirements section of DG for UniMate
Deleted johndoe.md and resolved merge conflicts with origin master
Resolved merge conflict
Fixed checkstyle
Copy link

@junhonglow junhonglow left a comment

Choose a reason for hiding this comment

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

LGTM

@lihongguang00 lihongguang00 merged commit fd4bd9d into AY2324S1-CS2103-F13-4:master Oct 15, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Calendar Model
3 participants