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

Mark command #1

Merged
merged 23 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2aaeae8
Create and test Status class
jason-raiin Oct 25, 2023
8e6f6e0
Add Status field to Meeting and test
jason-raiin Oct 25, 2023
db598ed
Change Status of meeting to MeetingStatus
jason-raiin Oct 26, 2023
19798d7
Update Meeting equality
jason-raiin Oct 26, 2023
d1be724
Add Mark command and tests
jason-raiin Oct 26, 2023
83e62cb
Add parser for Mark command and tests
jason-raiin Oct 26, 2023
85ec663
Merge pull request #100 from howenc/Update_docs
LoMaply Oct 28, 2023
d1fe232
Hook mark command into address book
jason-raiin Oct 31, 2023
77a33be
Fix logger and storage bugs
jason-raiin Oct 31, 2023
bc299c5
Fix User Guide errors due to merging
LoMaply Nov 1, 2023
75ee950
Add UI elements for meeting status
jason-raiin Nov 1, 2023
b877b3e
Add method to get person from person list by name
jason-raiin Nov 1, 2023
715c0f8
Merge branch 'master' into mark-command
jason-raiin Nov 1, 2023
d3c696c
Update DG with edit commands
LoMaply Nov 1, 2023
b445bc2
Fix checkstyle
LoMaply Nov 1, 2023
eb9ed80
Clean up typical instance utils
jason-raiin Nov 1, 2023
002df70
Add updating of last contacted time in mark command
jason-raiin Nov 2, 2023
d6e3214
Update docs
jason-raiin Nov 2, 2023
cdbc32a
Fix checkstyles
jason-raiin Nov 2, 2023
0b40868
Merge pull request #104 from LoMaply/update-guides
howenc Nov 2, 2023
c08849c
Merge pull request #103 from howenc/Update_docs
howenc Nov 2, 2023
c8fed5d
Merge branch 'master' into mark-command
jason-raiin Nov 2, 2023
d13925a
Fix merge errors
jason-raiin Nov 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 72 additions & 39 deletions docs/DeveloperGuide.md

Large diffs are not rendered by default.

311 changes: 147 additions & 164 deletions docs/UserGuide.md

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions docs/diagrams/edit/CreateEditMeetingCommand.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@startuml
!include ../style.puml
skinparam ArrowFontStyle plain

title Create EditMeetingCommand

Participant ":LogicManager" as logic LOGIC_COLOR
Participant ":AddressBookParser" as abp LOGIC_COLOR
Participant ":EditMeetingCommandParser" as emcp LOGIC_COLOR
Participant "editMeetingDescriptor:EditMeetingDescriptor" as emd LOGIC_COLOR
Participant "command:EditMeetingCommand" as emc LOGIC_COLOR

activate logic
logic -> abp ++: parseCommand(commandText)
create emcp
abp -> emcp ++: parse(arguments)
create emd
emcp -> emd ++: EditMeetingDescriptor()
emd --> emcp --:
create emc
emcp -> emc ++: EditMeetingCommand(targetIndex, editMeetingDescriptor)
emc --> emcp --: command
emcp --> abp --: command
abp --> logic --: command

@enduml
33 changes: 33 additions & 0 deletions docs/diagrams/edit/EditMeetingClassDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@startuml
!include ../style.puml
skinparam arrowThickness 1.1
skinparam arrowColor LOGIC_COLOR_T4
skinparam classBackgroundColor LOGIC_COLOR

package Parser as ParserPackage {
Class "<<interface>>\nParser" as Parser
Class EditMeetingCommandParser
}

package Command as CommandPackage {
Class EditMeetingCommand
Class EditMeetingDescriptor
Class "{abstract}\nCommand" as Command
}

Class Index
Class AddressBookParser
Class LogicManager

AddressBookParser .down.> EditMeetingCommandParser : creates >
EditMeetingCommandParser ..> EditMeetingCommand : creates >
EditMeetingCommand -down->"1" EditMeetingDescriptor
EditMeetingCommand -down->"1" Index
EditMeetingCommand -left-|> Command
EditMeetingCommandParser .down.|> Parser
EditMeetingCommandParser .left.> EditMeetingDescriptor : creates >
EditMeetingCommandParser .down.> Index : creates >
LogicManager -right->"1" AddressBookParser
LogicManager .down.> EditMeetingCommand : executes >

@enduml
36 changes: 36 additions & 0 deletions docs/diagrams/edit/EditMeetingSequenceDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@startuml
!include ../style.puml
skinparam ArrowFontStyle plain

title Execute EditMeetingCommand

box Logic LOGIC_COLOR_T1
Participant ":LogicManager" as logic LOGIC_COLOR
Participant "command:EditMeetingCommand" as emc LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
Participant ":ModelManager" as model MODEL_COLOR
Participant "editedMeeting:Meeting" as meet MODEL_COLOR
end box

[->logic : execute
activate logic
ref over logic, emc: Create EditMeetingCommand
logic -> emc ++: execute(model)
emc -> model ++: getFilteredMeetingList
model --> emc --:
emc -> emc ++: createEditedMeeting
create meet
emc -> meet ++: Meeting()
meet --> emc --:
emc --> emc --:
emc -> model ++: setMeeting
model --> emc --:
emc -> model ++:updateFilteredMeetingList
model --> emc --:
emc --> logic --: CommandResult
[<--logic
deactivate logic

@enduml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
!include ../style.puml
skinparam ArrowFontStyle plain

title View Contact Command Sequence
title Create ViewContactCommand

Participant ":LogicManager" as logic LOGIC_COLOR
Participant ":AddressBookParser" as abp LOGIC_COLOR
Expand All @@ -13,11 +13,10 @@ Participant "command:ViewContactCommand" as ec LOGIC_COLOR
activate logic
logic -> abp ++: parseCommand(commandText)
create vccp
abp -> vccp
abp -> vccp ++: parse(arguments)
create ec
vccp -> ec ++: index
ec --> vccp --
vccp -> ec ++: ViewContactCommand(targetIndex)
ec --> vccp --: command
vccp --> abp --: command
abp --> logic --: command

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
!include ../style.puml
skinparam ArrowFontStyle plain

title Store viewed Items to Model
title Store Viewed Items to Model

box Logic LOGIC_COLOR_T1
Participant ":LogicManager" as logic LOGIC_COLOR
Participant ":AddressBookParser" as abp LOGIC_COLOR
Participant "command:ViewContactCommand" as vcc LOGIC_COLOR
end box

Expand All @@ -16,7 +15,7 @@ end box

[->logic : execute
activate logic
ref over logic, abp, vcc: View Contact Command Sequence
ref over logic, vcc: Create ViewContactCommand
logic -> vcc ++: execute(model)
vcc -> model ++: setViewedPersonIndex(targetIndex)
model --> vcc --:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/edit/EditMeetingClassDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 12 additions & 8 deletions docs/team/jason-raiin.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,40 @@ My contributions to the project are listed below.

- **New Feature**: Remove contact from meeting command
- Added command and parser
- Thorough testing

- **New Feature**: Mark meeting command
- Added command and parser
- Updates last contacted time for contacts

- **Code contributed**: [RepoSense link](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=jason-raiin&breakdown=true)

- **Project management**:

- to be added soon
- Contributed issues
- Reviewed PRs

- **Enhancements to existing features**:

- Add Tag to meetings: logic and UI
- Add Tags field to meetings
- Convert Tag to factory class with no duplicates
- Added Status field to meetings

- **Documentation**:

- User Guide
- Remove meeting contact command
- `rmmc` command
- `mark` command
- Minor edits

- Developer Guide
- `rmmc` command
- `mark` command
- User profile
- Value proposition
- User stories
- Use cases

- **Community**:

- to be added soon

- **Tools**:

- Added util method `parseIndexes`
- Improved methods for `typicalMeetings` and `typicalAddressBook`
4 changes: 2 additions & 2 deletions docs/team/lomaply.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ My contributions to the project are listed below.
- Review and merge pull requests

- **Enhancements to existing features**:

- Sort contacts by last contacted time
- New Command
- "editm"
Expand All @@ -39,7 +39,7 @@ My contributions to the project are listed below.
- First draft of User Guide with initial plans for v1.2
- Update parts of User Guide on `viewm`, `viewc`, `editm`
- Developer Guide
- Add Implementation notes on `viewm` & `viewc`
- Add Implementation notes on `viewm`, `viewc`, `editc` and `editm`

- **Community**:

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ public static String format(Meeting meeting) {
.append(meeting.getEnd())
.append("; Attendees: ");
meeting.getAttendees().forEach(builder::append);
builder.append("; Completed: ")
.append(meeting.getStatus());
return builder.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static Meeting addAttendee(Meeting meeting, Attendee attendeeToAdd) {
Set<Attendee> updatedAttendees = new LinkedHashSet<>(meeting.getAttendees());
updatedAttendees.add(attendeeToAdd);
Meeting updatedMeeting = new Meeting(meeting.getTitle(), meeting.getLocation(), meeting.getStart(),
meeting.getEnd(), updatedAttendees, meeting.getTags());
meeting.getEnd(), updatedAttendees, meeting.getTags(), meeting.getStatus());

return updatedMeeting;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import seedu.address.model.meeting.Attendee;
import seedu.address.model.meeting.Location;
import seedu.address.model.meeting.Meeting;
import seedu.address.model.meeting.MeetingStatus;
import seedu.address.model.meeting.MeetingTime;
import seedu.address.model.meeting.Title;
import seedu.address.model.tag.Tag;
Expand Down Expand Up @@ -102,12 +103,13 @@ static Meeting createEditedMeeting(Meeting meetingToEdit,
LocalDateTime updatedEnd = editMeetingDescriptor.getEnd().orElse(meetingToEdit.getEnd());
Set<Attendee> attendees = meetingToEdit.getAttendees();
Set<Tag> updatedTags = editMeetingDescriptor.getTags().orElse(meetingToEdit.getTags());
MeetingStatus status = meetingToEdit.getStatus();

if (!MeetingTime.isValidMeetingTime(updatedStart, updatedEnd)) {
throw new CommandException(MeetingTime.MESSAGE_CONSTRAINTS);
}

return new Meeting(updatedTitle, updatedLocation, updatedStart, updatedEnd, attendees, updatedTags);
return new Meeting(updatedTitle, updatedLocation, updatedStart, updatedEnd, attendees, updatedTags, status);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class FindMeetingCommand extends Command {
* @param predicate The predicate that will be used by the FindMeetingCommand object.
*/
public FindMeetingCommand(GeneralMeetingPredicate predicate) {
assert predicate != null;
requireNonNull(predicate);
this.predicate = predicate;
}

Expand Down
105 changes: 105 additions & 0 deletions src/main/java/seedu/address/logic/commands/MarkMeetingCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;

import java.time.LocalDateTime;
import java.util.Iterator;
import java.util.List;

import seedu.address.commons.core.index.Index;
import seedu.address.commons.util.ToStringBuilder;
import seedu.address.logic.Messages;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.model.Model;
import seedu.address.model.meeting.Attendee;
import seedu.address.model.meeting.Meeting;
import seedu.address.model.meeting.MeetingStatus;
import seedu.address.model.person.Person;

/**
* Marks a meeting as complete.
*/
public class MarkMeetingCommand extends Command {

public static final String COMMAND_WORD = "mark";

public static final String MESSAGE_MARK_MEETING_SUCCESS = "Meeting marked as complete: %1$s";

public static final String MESSAGE_MEETING_ALREADY_COMPLETE = "Meeting has already been marked as complete.";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Marks the meeting identified by the index number used in the displayed meetings list as complete.\n"
+ "Parameters: INDEX (must be a positive integer)\n" + "Example: " + COMMAND_WORD + "1";

private final Index targetIndex;

public MarkMeetingCommand(Index targetIndex) {
this.targetIndex = targetIndex;
}

@Override
public CommandResult execute(Model model) throws CommandException {
requireNonNull(model);
List<Meeting> lastShownList = model.getFilteredMeetingList();

if (targetIndex.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_MEETING_DISPLAYED_INDEX);
}

Meeting meetingToMark = lastShownList.get(targetIndex.getZeroBased());
Meeting updatedMeeting = markMeeting(meetingToMark);
model.setMeeting(meetingToMark, updatedMeeting);

Iterator<Attendee> attendeeIterator = meetingToMark.getAttendees().iterator();
while (attendeeIterator.hasNext()) {
Attendee attendee = attendeeIterator.next();
Person person = model.getPerson(attendee.getAttendeeName());
Person updatedPerson = updateLastContactedTime(person, meetingToMark.getEnd());
model.setPerson(person, updatedPerson);
}

return new CommandResult(String.format(MESSAGE_MARK_MEETING_SUCCESS, Messages.format(updatedMeeting)));
}

static Meeting markMeeting(Meeting meeting) throws CommandException {
if (meeting.getStatus().isComplete) {
throw new CommandException(MESSAGE_MEETING_ALREADY_COMPLETE);
}

Meeting markedMeeting = new Meeting(meeting.getTitle(), meeting.getLocation(), meeting.getStart(),
meeting.getEnd(), meeting.getAttendees(), meeting.getTags(), new MeetingStatus(true));

return markedMeeting;
}

static Person updateLastContactedTime(Person person, LocalDateTime lastContactedTime) {
if (lastContactedTime.isBefore(person.getLastContactedTime())) {
return person;
}

Person updatedPerson = new Person(person.getName(), person.getPhone(), person.getEmail(), lastContactedTime,
person.getStatus(), person.getRemark(), person.getTags());

return updatedPerson;
}

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}

// instanceof handles nulls
if (!(other instanceof MarkMeetingCommand)) {
return false;
}

MarkMeetingCommand otherMarkMeetingCommand = (MarkMeetingCommand) other;
return targetIndex.equals(otherMarkMeetingCommand.targetIndex);
}

@Override
public String toString() {
return new ToStringBuilder(this).add("targetIndex", targetIndex).toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static Meeting removeAttendee(Meeting meeting, Attendee attendeeToRemove) {
Set<Attendee> updatedAttendees = new LinkedHashSet<>(meeting.getAttendees());
updatedAttendees.remove(attendeeToRemove);
Meeting updatedMeeting = new Meeting(meeting.getTitle(), meeting.getLocation(), meeting.getStart(),
meeting.getEnd(), updatedAttendees, meeting.getTags());
meeting.getEnd(), updatedAttendees, meeting.getTags(), meeting.getStatus());

return updatedMeeting;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import seedu.address.model.meeting.Attendee;
import seedu.address.model.meeting.Location;
import seedu.address.model.meeting.Meeting;
import seedu.address.model.meeting.MeetingStatus;
import seedu.address.model.meeting.MeetingTime;
import seedu.address.model.meeting.Title;
import seedu.address.model.tag.Tag;
Expand Down Expand Up @@ -56,8 +57,9 @@ public AddMeetingCommand parse(String args) throws ParseException {
}
Set<Attendee> attendeeList = ParserUtil.parseAttendees(argMultimap.getAllValues(PREFIX_NAME));
Set<Tag> tagList = ParserUtil.parseTags(argMultimap.getAllValues(PREFIX_TAG));
MeetingStatus status = new MeetingStatus(false);

Meeting meeting = new Meeting(title, location, start, end, attendeeList, tagList);
Meeting meeting = new Meeting(title, location, start, end, attendeeList, tagList, status);

return new AddMeetingCommand(meeting);
}
Expand Down
Loading
Loading