Skip to content

Commit

Permalink
Merge branch 'master' into update-ug-name
Browse files Browse the repository at this point in the history
  • Loading branch information
saiutkarsh33 authored Apr 11, 2024
2 parents bff5295 + 92775d6 commit 03b0672
Show file tree
Hide file tree
Showing 23 changed files with 1,104 additions and 303 deletions.
618 changes: 447 additions & 171 deletions docs/DeveloperGuide.md

Large diffs are not rendered by default.

579 changes: 478 additions & 101 deletions docs/UserGuide.md

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions docs/_markbind/_macros.nj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{# macro allows you to define reusable chunks of content. It is similar to a function in a programming language. #}
{# Macros are useful only when the the text to format is more than one line. #}
{# It takes more time to build the page with macros, but it ensures that things the formatting is more consistent. #}



{# Define something inside a box #}
{% macro definitionBox(name, description) %}
<box type="definition" light>

**{{ name }}**: {{ description }}
</box>

{% endmacro %}



{# Keyboard key formatting #}
{% macro keyFormat(name, icon='') %}<span class="badge bg-light text-dark border">{% if icon %}{{ icon }} {% endif %}{{ name | upper }}</span>{% endmacro %}
4 changes: 3 additions & 1 deletion docs/_markbind/layouts/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<li><a href="{{baseUrl}}/UserGuide.html" class="nav-link">User Guide</a></li>
<li><a href="{{baseUrl}}/DeveloperGuide.html" class="nav-link">Developer Guide</a></li>
<li><a href="{{baseUrl}}/AboutUs.html" class="nav-link">About Us</a></li>
<li><a href="https://github.com/se-edu/addressbook-level3" target="_blank" class="nav-link"><md>:fab-github:</md></a>
<li><a href="https://github.com/AY2324S2-CS2103T-F13-1/tp" target="_blank" class="nav-link"><md>:fab-github:</md></a>
</li>
<li slot="right">
<form class="navbar-form">
Expand Down Expand Up @@ -41,6 +41,8 @@
* [Appendix: Requirements]({{ baseUrl }}/DeveloperGuide.html#appendix-requirements)
* [Appendix: Instructions for manual testing]({{ baseUrl }}/DeveloperGuide.html#appendix-instructions-for-manual-testing)
* [Appendix: Design Decisions]({{ baseUrl }}/DeveloperGuide.html#appendix-design-decisions)
* [Appendix: Effort]({{ baseUrl }}/DeveloperGuide.html#appendix-effort)
* [Appendix: Planned Enhancements]({{ baseUrl }}/DeveloperGuide.html#appendix-planned-enhancements)
* [About Us]({{ baseUrl }}/AboutUs.html)
</site-nav>
</div>
Expand Down
10 changes: 10 additions & 0 deletions docs/_markbind/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,13 @@
To inject this HTML segment in your markbind files, use {{ example }} where you want to place it.
More generally, surround the segment's id with double curly braces.
</variable>

<variable name="threeStars"><i class="fa-solid fa-star"></i><i class="fa-solid fa-star"></i><i class="fa-solid fa-star"></i></variable>
<variable name="twoStars"><i class="fa-solid fa-star"></i><i class="fa-solid fa-star"></i></variable>
<variable name="oneStar"><i class="fa-solid fa-star"></i></i></variable>

<variable name="newPage">
<markdown class="d-print-none">---</markdown>
<div style="page-break-after: always;"></div>
<br>
</variable>
4 changes: 2 additions & 2 deletions docs/diagrams/ArchitectureSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Participant ":Logic" as logic LOGIC_COLOR
Participant ":Model" as model MODEL_COLOR
Participant ":Storage" as storage STORAGE_COLOR

user -[USER_COLOR]> ui : "delstu e1234567"
user -[USER_COLOR]> ui : "delstu nn/E1234567"
activate ui UI_COLOR

ui -[UI_COLOR]> logic : execute("delstu e1234567")
ui -[UI_COLOR]> logic : execute("delstu nn/E1234567")
activate logic LOGIC_COLOR

logic -[LOGIC_COLOR]> model : deletePerson(p)
Expand Down
2 changes: 1 addition & 1 deletion docs/diagrams/BetterModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ Person *--> Name
Person *--> NusNetId
Person *--> Phone
Person *--> Email
Person *--> Address
Person *--> Major
@enduml
8 changes: 4 additions & 4 deletions docs/diagrams/DeleteSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ box Model MODEL_COLOR_T1
participant "m:Model" as Model MODEL_COLOR
end box

[-> LogicManager : execute("delstu e1234567")
[-> LogicManager : execute("delstu nn/E1234567")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("delstu e1234567")
LogicManager -> AddressBookParser : parseCommand("delstu nn/E1234567")
activate AddressBookParser

create DeleteCommandParser
Expand All @@ -27,7 +27,7 @@ activate DeleteCommandParser
DeleteCommandParser --> AddressBookParser
deactivate DeleteCommandParser

AddressBookParser -> DeleteCommandParser : parse("e1234567")
AddressBookParser -> DeleteCommandParser : parse("E1234567")
activate DeleteCommandParser

create DeleteCommand
Expand All @@ -49,7 +49,7 @@ deactivate AddressBookParser
LogicManager -> DeleteCommand : execute(m)
activate DeleteCommand

DeleteCommand -> Model : deletePerson(e1234567)
DeleteCommand -> Model : deletePerson(E1234567)
activate Model

Model --> DeleteCommand
Expand Down
8 changes: 4 additions & 4 deletions docs/diagrams/ModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Class CourseName
Class UniquePersonList
Class Person
Class NusNetId
Class Address
Class Major
Class Email
Class Name
Class Phone
Expand Down Expand Up @@ -47,7 +47,7 @@ Person *--> Name
Person *--> NusNetId
Person *--> Phone
Person *--> Email
Person *--> Address
Person *--> Major
Person *--> "*" Tag
Person *--> "*" WeekNumber

Expand All @@ -56,8 +56,8 @@ UniquePersonList -[hidden]right-> I

Name -[hidden]right-> NusNetId
NusNetId -[hidden]right-> Phone
Phone -[hidden]right-> Address
Address -[hidden]right-> Email
Phone -[hidden]right-> Major
Major -[hidden]right-> Email

ModelManager --> "~* filtered" Person
@enduml
2 changes: 1 addition & 1 deletion docs/diagrams/UndoRedoState1.puml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ skinparam ClassFontColor #000000
skinparam ClassBorderColor #000000
skinparam ClassBackgroundColor #FFFFAA

title After command "delstu e1234567"
title After command "delstu nn/E1234567"

package States <<rectangle>> {
class State1 as "<u>ab0:AddressBook</u>"
Expand Down
Binary file added docs/images/TAProLogo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 1 addition & 8 deletions src/main/java/seedu/address/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@
import seedu.address.logic.autocomplete.AutoComplete;
import seedu.address.logic.autocomplete.AutoCompleteCommand;
import seedu.address.logic.autocomplete.AutoCompleteResult;
import seedu.address.logic.commands.AddPersonCommand;
import seedu.address.logic.commands.ClearCommand;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.DeletePersonCommand;
import seedu.address.logic.commands.EditPersonCommand;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.logic.parser.AddressBookParser;
import seedu.address.logic.parser.exceptions.ParseException;
Expand Down Expand Up @@ -59,10 +55,7 @@ public CommandResult execute(String commandText) throws CommandException, ParseE
CommandResult commandResult = command.execute(model);

// Update the attributes value generation for prefix autocompletion.
if (command instanceof AddPersonCommand
|| command instanceof DeletePersonCommand
|| command instanceof EditPersonCommand
|| command instanceof ClearCommand) {
if (command.isModification()) {
AttributeValueGeneratorManager.updateAddressBook(getAddressBook());
}

Expand Down
8 changes: 7 additions & 1 deletion src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,13 @@ public static String format(Person person) {
.append("; Major: ")
.append(person.getMajor())
.append("; Attendance: ");
person.getAttendance().forEach(builder::append);
String combinedString = person.getAttendance().stream()
.map(weekNumber -> weekNumber.toString() + ", ")
.collect(Collectors.joining());
if (!combinedString.isEmpty()) {
combinedString = combinedString.substring(0, combinedString.length() - 2);
}
builder.append(combinedString);
builder.append("; Tags: ");
person.getTags().forEach(builder::append);
return builder.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public CommandResult execute(Model model) throws CommandException {
return new CommandResult(String.format(MESSAGE_SUCCESS, Messages.format(toAdd)));
}

@Override
public boolean isModification() {
return true;
}

@Override
public boolean equals(Object other) {
if (other == this) {
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/seedu/address/logic/commands/ClearCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ public CommandResult execute(Model model) {
model.setAddressBook(new AddressBook());
return new CommandResult(MESSAGE_SUCCESS);
}

@Override
public boolean isModification() {
return true;
}
}
8 changes: 8 additions & 0 deletions src/main/java/seedu/address/logic/commands/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,12 @@ public abstract class Command {
*/
public abstract CommandResult execute(Model model) throws CommandException;

/**
* Returns true if the command potentially modifies the model in a way that should be saved to storage.
*
* @return True if the command potentially modifies the model, otherwise false.
*/
public boolean isModification() {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public CommandResult execute(Model model) throws CommandException {
return new CommandResult(String.format(MESSAGE_DELETE_PERSON_SUCCESS, Messages.format(personToDelete)));
}

@Override
public boolean isModification() {
return true;
}

@Override
public boolean equals(Object other) {
if (other == this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ public CommandResult execute(Model model) throws CommandException {
return new CommandResult(String.format(MESSAGE_EDIT_PERSON_SUCCESS, Messages.format(editedPerson)));
}

@Override
public boolean isModification() {
return true;
}

/**
* Creates and returns a {@code Person} with the details of {@code personToEdit}
* edited with {@code editPersonDescriptor}.
Expand All @@ -111,7 +116,6 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript
return new Person(updatedName, updatedPhone, updatedEmail, updatedNusNet,
updatedMajor, updatedAttendance, updatedTags);
}

@Override
public boolean equals(Object other) {
if (other == this) {
Expand Down Expand Up @@ -164,7 +168,6 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) {
setAttendance(toCopy.attendance);
setTags(toCopy.tags);
}

/**
* Returns true if at least one field is edited.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ public CommandResult execute(Model model) throws CommandException {
return new CommandResult(formattedMessage);
}

@Override
public boolean isModification() {
return true;
}

@Override
public boolean equals(Object other) {
if (other == this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public CommandResult execute(Model model) throws CommandException {
return new CommandResult(MESSAGE_SUCCESS);
}

@Override
public boolean isModification() {
return true;
}

@Override
public boolean equals(Object other) {
if (other == this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class UnmarkAttendanceCommand extends Command {
public static final String MESSAGE_USAGE = generateMessageUsage(
COMMAND_WORD,
"Unmarks the attendance of the student identified by their NUSNet ID "
+ "by removing the specified week to their attendance set. ",
+ "by removing the specified week from their attendance set. ",
PARAMETER_NUSNET, PARAMETER_WEEK);

public static final String MESSAGE_UNMARKED_ATTENDANCE_SUCCESS = "Unmarked attendance for student: ";
Expand Down Expand Up @@ -82,7 +82,11 @@ public CommandResult execute(Model model) throws CommandException {
updatedPerson.getName(), updatedPerson.getNusNet(), weekNumber);

return new CommandResult(formattedMessage);
}

@Override
public boolean isModification() {
return true;
}

@Override
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/seedu/address/model/weeknumber/WeekNumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ public WeekNumber(String weekNumber) {
public static boolean isValidWeekNumber(String test) {
return test.matches(VALIDATION_REGEX);
}

@Override
public String toString() {
return value.toString();
}

@Override
public boolean equals(Object other) {
if (other == this) {
Expand All @@ -55,4 +49,8 @@ public boolean equals(Object other) {
public int hashCode() {
return value.hashCode();
}
@Override
public String toString() {
return value.toString();
}
}
Loading

0 comments on commit 03b0672

Please sign in to comment.