diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md index 11b0b38d4c8..d5dad2f839e 100644 --- a/docs/DeveloperGuide.md +++ b/docs/DeveloperGuide.md @@ -131,12 +131,13 @@ How the parsing works: -The `Assignment` component, +The `Assignment`, `InternshipRole`, `InternshipTask` component, -* stores the address book data i.e., all `Assignment` objects (which are contained in a `UniqueList` object). -* stores the currently 'selected' `Assignment` objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change. +* these components implement the Unique Interface. +* stores the address book data i.e., all `Assignment`, `InternshipRole`, `InternshipTask` objects (are contained in a separate `UniqueList` object). +* stores the currently 'selected' component objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change. * stores a `UserPref` object that represents the user’s preferences. This is exposed to the outside as a `ReadOnlyUserPref` objects. -* does not depend on any of the other three components (as the `Assignment` represents data entities of the domain, they should make sense on their own without depending on other components) +* does not depend on any of the other three components (as these components represent data entities of the domain, they should make sense on their own without depending on other components) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 2dd69c28935..33a21143431 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -551,7 +551,7 @@ To add an internship role into CampusCompanion. #### Editing an internship role -```edit-i-role i/INDEX d/DESCRIPTION``` +```edit-i-role i/INDEX [c/CYCLE] [d/DESCRIPTION] [p/PAY] [o/OUTCOME] [l/LOCATION]``` To view internship role parameter information, click [here](#internship-role-parameters) diff --git a/docs/diagrams/ModelClassDiagram.puml b/docs/diagrams/ModelClassDiagram.puml index d36e480aa56..6ff9afbc834 100644 --- a/docs/diagrams/ModelClassDiagram.puml +++ b/docs/diagrams/ModelClassDiagram.puml @@ -14,10 +14,17 @@ Class UserPrefs Class UniqueList Class Assignment +Class InternshipRole +Class InternshipTask Class Status Class IsoDate +Class Cycle +Class Pay +Class Role +Class Location +Class ApplicationOutcome +Class TaskOutcome Class Name -Class Date Class Description Class Tag @@ -36,23 +43,39 @@ ModelManager -left-> "1" AddressBook ModelManager -right-> "1" UserPrefs UserPrefs .up.|> ReadOnlyUserPrefs -AddressBook *--> "1" UniqueList +AddressBook *--> "3" UniqueList UniqueList --> "~* all" Assignment -Assignment *--> Name -Assignment *--> IsoDate -Assignment *--> Status -Assignment *--> Description -Assignment *--> Date +UniqueList --> "~* all" InternshipRole +UniqueList --> "~* all" InternshipTask +Assignment *--> "1" Name +Assignment *--> "1" IsoDate +Assignment *--> "1" Status +Assignment *--> "0..1" Description Assignment *--> "*" Tag +InternshipRole *--> "1" Name +InternshipRole *--> "1" Role +InternshipRole *--> "1" Cycle +InternshipRole *--> "0..1" Description +InternshipRole *--> "0..1" Pay +InternshipRole *--> "1" ApplicationOutcome +InternshipRole *--> "0..1" Location +InternshipRole *--> "*" Tag + +InternshipTask *--> "1" Name +InternshipTask *--> "1" InternshipRole +InternshipTask *--> "1" TaskOutcome +InternshipTask *--> "1" Status +InternshipTask *--> "1" IsoDate +InternshipTask *--> "*" Tag + + Assignment -[hidden]up--> I UniqueList -[hidden]right-> I Name -[hidden]right-> IsoDate IsoDate -[hidden]right-> Status Status -[hidden]right-> Description -Description -[hidden]right-> Date -Date -[hidden]right-> Tag ModelManager --> "~* filtered" Assignment @enduml diff --git a/docs/diagrams/UiClassDiagram.puml b/docs/diagrams/UiClassDiagram.puml index 95473d5aa19..20a91ee2e92 100644 --- a/docs/diagrams/UiClassDiagram.puml +++ b/docs/diagrams/UiClassDiagram.puml @@ -11,10 +11,16 @@ Class UiManager Class MainWindow Class HelpWindow Class ResultDisplay -Class PersonListPanel -Class PersonCard +Class AssignmentListPanel +Class AssignmentCard Class StatusBarFooter Class CommandBox +Class InternPanel +Class InternshipRolePanel +Class InternshipTaskPanel +Class InternshipRoleCard +Class InternshipTaskCard +Class Calendar } package Model <> { @@ -32,26 +38,42 @@ UiManager .left.|> Ui UiManager -down-> "1" MainWindow MainWindow *-down-> "1" CommandBox MainWindow *-down-> "1" ResultDisplay -MainWindow *-down-> "1" PersonListPanel +MainWindow *-down-> "1" AssignmentListPanel +MainWindow *-down-> "1" InternPanel +MainWindow *-down-> "1" Calendar MainWindow *-down-> "1" StatusBarFooter MainWindow --> "0..1" HelpWindow -PersonListPanel -down-> "*" PersonCard + +AssignmentListPanel -down-> "*" AssignmentCard +InternPanel -down-> "1" InternshipRolePanel +InternPanel -down-> "1" InternshipTaskPanel +InternshipRolePanel -down-> "*" InternshipRoleCard +InternshipTaskPanel -down-> "*" InternshipTaskCard MainWindow -left-|> UiPart ResultDisplay --|> UiPart CommandBox --|> UiPart -PersonListPanel --|> UiPart -PersonCard --|> UiPart +AssignmentListPanel --|> UiPart +AssignmentCard --|> UiPart StatusBarFooter --|> UiPart HelpWindow --|> UiPart +InternPanel --|> UiPart +InternshipRolePanel --|> UiPart +InternshipTaskPanel --|> UiPart +InternshipRoleCard --|> UiPart +InternshipTaskCard --|> UiPart +Calendar --|> UiPart -PersonCard ..> Model +AssignmentCard ..> Model +InternshipRoleCard ..> Model +InternshipTaskCard ..> Model +Calendar ..> Model UiManager -right-> Logic MainWindow -left-> Logic -PersonListPanel -[hidden]left- HelpWindow +AssignmentListPanel -[hidden]left- HelpWindow HelpWindow -[hidden]left- CommandBox CommandBox -[hidden]left- ResultDisplay ResultDisplay -[hidden]left- StatusBarFooter diff --git a/docs/images/ModelClassDiagram.png b/docs/images/ModelClassDiagram.png index a19fb1b4ac8..d1c5fb78e8b 100644 Binary files a/docs/images/ModelClassDiagram.png and b/docs/images/ModelClassDiagram.png differ diff --git a/docs/images/Ui.png b/docs/images/Ui.png index fb36232cda4..537b04ad758 100644 Binary files a/docs/images/Ui.png and b/docs/images/Ui.png differ diff --git a/docs/images/UiClassDiagram.png b/docs/images/UiClassDiagram.png index 11f06d68671..cbe63e94c09 100644 Binary files a/docs/images/UiClassDiagram.png and b/docs/images/UiClassDiagram.png differ diff --git a/src/main/java/seedu/address/logic/Messages.java b/src/main/java/seedu/address/logic/Messages.java index 4a3bb7e7352..3dab09f700a 100644 --- a/src/main/java/seedu/address/logic/Messages.java +++ b/src/main/java/seedu/address/logic/Messages.java @@ -26,7 +26,10 @@ public class Messages { + " provided is invalid"; public static final String MESSAGE_DUPLICATE_FIELDS = "Multiple values specified for the following single-valued field(s): "; - + public static final String MESSAGE_EDIT_LEADS_TO_DUPLICATE_ROLES = "This will lead to duplicate internship roles" + + " existing!"; + public static final String MESSAGE_EDITED_FIELDS_ARE_THE_SAME = "You do not have to specify fields if they are" + + " to remain the same"; /** * Returns an error message indicating the duplicate prefixes. */ diff --git a/src/main/java/seedu/address/logic/commands/internship/role/DeleteInternshipRoleCommand.java b/src/main/java/seedu/address/logic/commands/internship/role/DeleteInternshipRoleCommand.java index de57a75926c..242ff350f7c 100644 --- a/src/main/java/seedu/address/logic/commands/internship/role/DeleteInternshipRoleCommand.java +++ b/src/main/java/seedu/address/logic/commands/internship/role/DeleteInternshipRoleCommand.java @@ -41,7 +41,7 @@ public CommandResult execute(Model model) throws CommandException { requireNonNull(model); List lastShownRoleList = model.getFilteredInternshipRoleList(); - List lastShownTaskList = model.getFilteredInternshipTaskList(); + List unfilteredTaskList = model.getUnfilteredInternshipTaskList(); List taskListToDelete = new ArrayList<>(); if (targetIndex.getZeroBased() >= lastShownRoleList.size()) { @@ -49,7 +49,7 @@ public CommandResult execute(Model model) throws CommandException { } InternshipRole internshipRoleToDelete = lastShownRoleList.get(targetIndex.getZeroBased()); - lastShownTaskList.stream() + unfilteredTaskList.stream() .forEach(task -> { if (new InternshipTaskHasSameInternshipRolePredicate(internshipRoleToDelete).test(task)) { taskListToDelete.add(task); diff --git a/src/main/java/seedu/address/logic/commands/internship/role/EditInternshipRoleCommand.java b/src/main/java/seedu/address/logic/commands/internship/role/EditInternshipRoleCommand.java index c195dbff062..50a90c19724 100644 --- a/src/main/java/seedu/address/logic/commands/internship/role/EditInternshipRoleCommand.java +++ b/src/main/java/seedu/address/logic/commands/internship/role/EditInternshipRoleCommand.java @@ -1,8 +1,14 @@ package seedu.address.logic.commands.internship.role; import static java.util.Objects.requireNonNull; +import static seedu.address.logic.Messages.MESSAGE_EDITED_FIELDS_ARE_THE_SAME; +import static seedu.address.logic.Messages.MESSAGE_EDIT_LEADS_TO_DUPLICATE_ROLES; +import static seedu.address.logic.parser.assignment.CliSyntax.PREFIX_DESCRIPTION; import static seedu.address.logic.parser.assignment.CliSyntax.PREFIX_INDEX; +import static seedu.address.logic.parser.internship.role.CliSyntax.PREFIX_CYCLE; +import static seedu.address.logic.parser.internship.role.CliSyntax.PREFIX_LOCATION; import static seedu.address.logic.parser.internship.role.CliSyntax.PREFIX_OUTCOME; +import static seedu.address.logic.parser.internship.role.CliSyntax.PREFIX_PAY; import java.util.List; @@ -14,7 +20,12 @@ import seedu.address.logic.commands.internship.InternshipCommand; import seedu.address.model.Model; import seedu.address.model.fields.ApplicationOutcome; +import seedu.address.model.fields.Cycle; +import seedu.address.model.fields.Description; +import seedu.address.model.fields.Location; +import seedu.address.model.fields.Pay; import seedu.address.model.internship.role.InternshipRole; +import seedu.address.model.internship.task.InternshipTask; /** * A command that edits the application outcome of an InternshipRole when executed. @@ -25,25 +36,39 @@ public class EditInternshipRoleCommand extends InternshipCommand { public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the application outcome of an InternshipRole. " + "Parameters: " - + PREFIX_INDEX + "INDEX (must be a positive integer)" + "\n" - + PREFIX_OUTCOME + "OUTCOME" + "\n" - + "Example: " + COMMAND_WORD + "i/ 1" + " o/ accepted"; + + PREFIX_INDEX + "INDEX (must be a positive integer) and AT LEAST one of the following: " + + "[" + PREFIX_CYCLE + "CYCLE " + "]" + + "[" + PREFIX_DESCRIPTION + "DESCRIPTION " + "]" + + "[" + PREFIX_PAY + "PAY " + "]" + + "[" + PREFIX_OUTCOME + "OUTCOME " + "]" + + "[" + PREFIX_LOCATION + "LOCATION " + "]\n" + + "Example: " + COMMAND_WORD + " i/ 1" + " o/ accepted" + " p/3000"; public static final String MESSAGE_SUCCESS = "Internship role outcome updated to: %1$s"; public static final String MESSAGE_INVALID_ROLE = "This internship role does not exist in the address book"; private final Index index; + private final Cycle newCycle; + private final Description newDescription; + private final Pay newPay; private final ApplicationOutcome newOutcome; + private final Location newLocation; /** * The constructor for an EditInternshipRoleCommand - * @param index The index of the InternshipRole to be edited + * + * @param index The index of the InternshipRole to be edited * @param newOutcome The new outcome for the target InternshipRole */ - public EditInternshipRoleCommand(Index index, ApplicationOutcome newOutcome) { + public EditInternshipRoleCommand(Index index, Cycle newCycle, Description newDescription, Pay newPay, + ApplicationOutcome newOutcome, Location newLocation) { this.index = index; + this.newCycle = newCycle; + this.newDescription = newDescription; + this.newPay = newPay; this.newOutcome = newOutcome; + this.newLocation = newLocation; } @Override @@ -60,9 +85,48 @@ public CommandResult execute(Model model) throws CommandException { throw new CommandException(MESSAGE_INVALID_ROLE); } - InternshipRole roleWithNewOutcome = roleToEdit.getNewInternshipRoleWithOutcome(newOutcome); - model.setInternshipRole(roleToEdit, roleWithNewOutcome); - return new CommandResult(String.format(MESSAGE_SUCCESS, Messages.format(roleWithNewOutcome))); + InternshipRole editedRole = roleToEdit; + if (newCycle != null) { + editedRole = editedRole.getNewInternshipRoleWithCycle(newCycle); + } + if (newDescription != null) { + editedRole = editedRole.getNewInternshipRoleWithDescription(newDescription); + } + if (newPay != null) { + editedRole = editedRole.getNewInternshipRoleWithPay(newPay); + } + if (newOutcome != null) { + editedRole = editedRole.getNewInternshipRoleWithOutcome(newOutcome); + } + if (newLocation != null) { + editedRole = editedRole.getNewInternshipRoleWithLocation(newLocation); + } + + if (roleToEdit.equals(editedRole)) { + throw new CommandException(MESSAGE_EDITED_FIELDS_ARE_THE_SAME); + } + + if (!editedRole.isDuplicate(roleToEdit) && model.hasInternshipRole(editedRole)) { + throw new CommandException(MESSAGE_EDIT_LEADS_TO_DUPLICATE_ROLES); + } + + model.setInternshipRole(roleToEdit, editedRole); + + for (InternshipTask internshipTask : model.getUnfilteredInternshipTaskList()) { + if (internshipTask.getInternshipRole().equals(roleToEdit)) { + model.setInternshipTask(internshipTask, internshipTask.editInternshipRole(editedRole)); + } + } + + // Force a Re render with updated values, by calling the set method + + model.setInternshipRole(editedRole, editedRole); + + for (InternshipTask internshipTask : model.getUnfilteredInternshipTaskList()) { + model.setInternshipTask(internshipTask, internshipTask); + } + + return new CommandResult(String.format(MESSAGE_SUCCESS, Messages.format(editedRole))); } @Override diff --git a/src/main/java/seedu/address/logic/commands/internship/task/EditInternshipTaskCommand.java b/src/main/java/seedu/address/logic/commands/internship/task/EditInternshipTaskCommand.java index b1fe3ada56f..e00f5ced266 100644 --- a/src/main/java/seedu/address/logic/commands/internship/task/EditInternshipTaskCommand.java +++ b/src/main/java/seedu/address/logic/commands/internship/task/EditInternshipTaskCommand.java @@ -25,9 +25,9 @@ public class EditInternshipTaskCommand extends InternshipCommand { public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the outcome of an InternshipTask to the app. " + "Parameters: " - + PREFIX_INDEX + "INDEX (must be a positive integer)" + "\n" + + PREFIX_INDEX + "INDEX (must be a positive integer)" + PREFIX_OUTCOME + "OUTCOME" + "\n" - + "Example: " + COMMAND_WORD + "i/ 1" + " o/ follow-up"; + + "Example: " + COMMAND_WORD + " i/ 1" + " o/ follow-up"; public static final String MESSAGE_SUCCESS = "Internship task outcome updated to: %1$s"; @@ -60,6 +60,12 @@ public CommandResult execute(Model model) throws CommandException { throw new CommandException(MESSAGE_INVALID_TASK); } + /*if (newOutcome.getTaskOutcome() == Outcome.OFFERED) { + EditInternshipRoleCommand editRoleCommand = new EditInternshipRoleCommand(index, + new ApplicationOutcome(Outcome.OFFERED)); + editRoleCommand.execute(model); + }*/ + InternshipTask taskWithNewOutcome = taskToEdit.getNewInternshipTaskWithOutcome(newOutcome); model.setInternshipTask(taskToEdit, taskWithNewOutcome); return new CommandResult(String.format(MESSAGE_SUCCESS, Messages.format(taskWithNewOutcome))); diff --git a/src/main/java/seedu/address/logic/commands/internship/task/FindInternshipTaskCommand.java b/src/main/java/seedu/address/logic/commands/internship/task/FindInternshipTaskCommand.java index 4c78ff604e9..62cefa7cac0 100644 --- a/src/main/java/seedu/address/logic/commands/internship/task/FindInternshipTaskCommand.java +++ b/src/main/java/seedu/address/logic/commands/internship/task/FindInternshipTaskCommand.java @@ -2,16 +2,12 @@ import static java.util.Objects.requireNonNull; -import java.util.ArrayList; -import java.util.List; - import seedu.address.commons.util.ToStringBuilder; import seedu.address.logic.Messages; import seedu.address.logic.commands.CommandResult; import seedu.address.logic.commands.exceptions.CommandException; import seedu.address.logic.commands.internship.InternshipCommand; import seedu.address.model.Model; -import seedu.address.model.internship.role.InternshipRole; import seedu.address.model.internship.task.InternshipTask; import seedu.address.model.internship.task.InternshipTaskNameContainsKeywordsPredicate; @@ -42,12 +38,15 @@ public CommandResult execute(Model model) throws CommandException { model.updateFilteredInternshipTaskList(predicate); - // List the roles of these tasks - List internshipRoles = new ArrayList<>(); - for (InternshipTask internshipTask : model.getFilteredInternshipTaskList()) { - internshipRoles.add(internshipTask.getInternshipRole()); - } - model.updateFilteredInternshipRoleList(internshipRoles::contains); + model.updateFilteredInternshipRoleList(role -> { + for (InternshipTask internshipTask : model.getFilteredInternshipTaskList()) { + if (internshipTask.getInternshipRole().equals(role)) { + return true; + } + } + return false; + }); + return new CommandResult( String.format(Messages.MESSAGE_INTERNSHIPS_LISTED_OVERVIEW, model.getFilteredInternshipTaskList().size())); diff --git a/src/main/java/seedu/address/logic/parser/internship/role/EditInternshipRoleParser.java b/src/main/java/seedu/address/logic/parser/internship/role/EditInternshipRoleParser.java index 537c055d6c7..027bca15f90 100644 --- a/src/main/java/seedu/address/logic/parser/internship/role/EditInternshipRoleParser.java +++ b/src/main/java/seedu/address/logic/parser/internship/role/EditInternshipRoleParser.java @@ -1,8 +1,12 @@ package seedu.address.logic.parser.internship.role; import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT; +import static seedu.address.logic.parser.internship.role.CliSyntax.PREFIX_CYCLE; +import static seedu.address.logic.parser.internship.role.CliSyntax.PREFIX_DESCRIPTION; import static seedu.address.logic.parser.internship.role.CliSyntax.PREFIX_INDEX; +import static seedu.address.logic.parser.internship.role.CliSyntax.PREFIX_LOCATION; import static seedu.address.logic.parser.internship.role.CliSyntax.PREFIX_OUTCOME; +import static seedu.address.logic.parser.internship.role.CliSyntax.PREFIX_PAY; import java.util.stream.Stream; @@ -15,6 +19,10 @@ import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.logic.parser.person.Prefix; import seedu.address.model.fields.ApplicationOutcome; +import seedu.address.model.fields.Cycle; +import seedu.address.model.fields.Description; +import seedu.address.model.fields.Location; +import seedu.address.model.fields.Pay; /** * Parser to create an EditInternshipRoleCommand from the given input @@ -22,22 +30,46 @@ public class EditInternshipRoleParser implements Parser { @Override public EditInternshipRoleCommand parse(String args) throws ParseException { - ArgumentMultimap argumentMultimap = ArgumentTokenizer.tokenize(args, PREFIX_INDEX, PREFIX_OUTCOME); + ArgumentMultimap argumentMultimap = ArgumentTokenizer.tokenize(args, PREFIX_INDEX, PREFIX_CYCLE, + PREFIX_DESCRIPTION, PREFIX_PAY, PREFIX_OUTCOME, PREFIX_LOCATION); - if (!arePrefixesPresent(argumentMultimap, PREFIX_INDEX, PREFIX_OUTCOME) - || !argumentMultimap.getPreamble().isEmpty()) { + if (!arePrefixesPresent(argumentMultimap, PREFIX_INDEX) || !argumentMultimap.getPreamble().isEmpty()) { throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, EditInternshipRoleCommand.MESSAGE_USAGE)); } - argumentMultimap.verifyNoDuplicatePrefixesFor(PREFIX_INDEX, PREFIX_OUTCOME); + argumentMultimap.verifyNoDuplicatePrefixesFor(PREFIX_INDEX, PREFIX_CYCLE, PREFIX_DESCRIPTION, PREFIX_PAY, + PREFIX_OUTCOME, PREFIX_LOCATION); Index index = ParserUtil.parseIndex(argumentMultimap.getValue(PREFIX_INDEX).get()); - ApplicationOutcome newOutcome = ParserUtil.parseApplicationOutcome( - argumentMultimap.getValue(PREFIX_OUTCOME).get()); + Cycle newCycle = argumentMultimap.getValue(PREFIX_CYCLE).isEmpty() + ? null + : ParserUtil.parseCycle(argumentMultimap.getValue(PREFIX_CYCLE).get()); - return new EditInternshipRoleCommand(index, newOutcome); + Description newDescription = argumentMultimap.getValue(PREFIX_DESCRIPTION).isEmpty() + ? null + : ParserUtil.parseDescription(argumentMultimap.getValue(PREFIX_DESCRIPTION).orElse("")); + + Pay newPay = argumentMultimap.getValue(PREFIX_PAY).isEmpty() + ? null + : ParserUtil.parsePay(argumentMultimap.getValue(PREFIX_PAY).get()); + + ApplicationOutcome newOutcome = argumentMultimap.getValue(PREFIX_OUTCOME).isEmpty() + ? null + : ParserUtil.parseApplicationOutcome(argumentMultimap.getValue(PREFIX_OUTCOME).get()); + + // To be looked through again + Location newLocation = argumentMultimap.getValue(PREFIX_LOCATION).isEmpty() + ? null + : ParserUtil.parseLocation(argumentMultimap.getValue(PREFIX_LOCATION).get()); + + if (newCycle == null && newLocation == null && newDescription == null && newOutcome == null && newPay == null) { + throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, + EditInternshipRoleCommand.MESSAGE_USAGE)); + } + + return new EditInternshipRoleCommand(index, newCycle, newDescription, newPay, newOutcome, newLocation); } private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) { diff --git a/src/main/java/seedu/address/model/internship/role/InternshipRole.java b/src/main/java/seedu/address/model/internship/role/InternshipRole.java index 1ea0ceafa3c..31d9f69c474 100644 --- a/src/main/java/seedu/address/model/internship/role/InternshipRole.java +++ b/src/main/java/seedu/address/model/internship/role/InternshipRole.java @@ -115,6 +115,22 @@ public InternshipRole getNewInternshipRoleWithOutcome(ApplicationOutcome newOutc return new InternshipRole(name, role, cycle, description, pay, newOutcome, location, tags); } + public InternshipRole getNewInternshipRoleWithCycle(Cycle newCycle) { + return new InternshipRole(name, role, newCycle, description, pay, outcome, location, tags); + } + + public InternshipRole getNewInternshipRoleWithDescription(Description newDescription) { + return new InternshipRole(name, role, cycle, newDescription, pay, outcome, location, tags); + } + + public InternshipRole getNewInternshipRoleWithPay(Pay newPay) { + return new InternshipRole(name, role, cycle, description, newPay, outcome, location, tags); + } + + public InternshipRole getNewInternshipRoleWithLocation(Location newLocation) { + return new InternshipRole(name, role, cycle, description, pay, outcome, newLocation, tags); + } + @Override public boolean equals(Object other) { if (other == this) { diff --git a/src/main/java/seedu/address/model/internship/task/InternshipTask.java b/src/main/java/seedu/address/model/internship/task/InternshipTask.java index 5524bdc16d2..243529d9d6e 100644 --- a/src/main/java/seedu/address/model/internship/task/InternshipTask.java +++ b/src/main/java/seedu/address/model/internship/task/InternshipTask.java @@ -110,6 +110,10 @@ public InternshipTask getNewInternshipTaskWithOutcome(TaskOutcome newOutcome) { return new InternshipTask(role, taskName, deadline, status, newOutcome, tags); } + public InternshipTask editInternshipRole(InternshipRole newInternshipRole) { + return new InternshipTask(newInternshipRole, taskName, deadline, status, outcome, tags); + } + /** * @param otherTask to be verifed * @return true if otherTask has the same task name diff --git a/src/main/java/seedu/address/model/util/SampleDataUtil.java b/src/main/java/seedu/address/model/util/SampleDataUtil.java index 48cdc4a6c4f..303fff1aaf7 100644 --- a/src/main/java/seedu/address/model/util/SampleDataUtil.java +++ b/src/main/java/seedu/address/model/util/SampleDataUtil.java @@ -3,16 +3,26 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Arrays; +import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; import seedu.address.model.AddressBook; import seedu.address.model.ReadOnlyAddressBook; import seedu.address.model.assignment.Assignment; +import seedu.address.model.fields.ApplicationOutcome; +import seedu.address.model.fields.Cycle; import seedu.address.model.fields.Description; import seedu.address.model.fields.IsoDate; +import seedu.address.model.fields.Location; import seedu.address.model.fields.NoDate; +import seedu.address.model.fields.Outcome; +import seedu.address.model.fields.Pay; +import seedu.address.model.fields.Role; import seedu.address.model.fields.Status; +import seedu.address.model.fields.TaskOutcome; +import seedu.address.model.internship.role.InternshipRole; +import seedu.address.model.internship.task.InternshipTask; import seedu.address.model.tag.Tag; /** @@ -36,12 +46,46 @@ private static Assignment[] getSampleAssignments() { }; } + private static InternshipRole getSampleRole1() { + return new InternshipRole(new seedu.address.model.fields.Name("Google"), + new Role("SWE"), new Cycle("Summer"), new Description(""), + new Pay(null), new ApplicationOutcome(Outcome.FOLLOW_UP), + new Location(""), new HashSet<>()); + } + + private static InternshipRole getSampleRole2() { + return new InternshipRole(new seedu.address.model.fields.Name("Tiktok"), + new Role("SWE"), new Cycle("Summer"), new Description(""), + new Pay(null), new ApplicationOutcome(Outcome.FOLLOW_UP), + new Location(""), new HashSet<>()); + } + + private static InternshipRole[] getSampleInternshipRoles() { + return new InternshipRole[] { getSampleRole1(), getSampleRole2() }; + } + + private static InternshipTask[] getSampleInternshipTasks() { + return new InternshipTask[] { new InternshipTask(getSampleRole1(), new seedu.address.model.fields.Name("OA"), + new IsoDate(LocalDateTime.parse("2023-11-11 23:59", + DateTimeFormatter.ofPattern(IsoDate.DATE_FORMAT))), + new Status(false), new TaskOutcome(Outcome.AWAITING), new HashSet<>()) }; + } + public static ReadOnlyAddressBook getSampleAddressBook() { AddressBook sampleAb = new AddressBook(); for (Assignment assignment : getSampleAssignments()) { sampleAb.addAssignment(assignment); } + + for (InternshipRole role : getSampleInternshipRoles()) { + sampleAb.addInternshipRole(role); + } + + for (InternshipTask task : getSampleInternshipTasks()) { + sampleAb.addInternshipTask(task); + } + return sampleAb; } diff --git a/src/main/java/seedu/address/ui/HelpWindow.java b/src/main/java/seedu/address/ui/HelpWindow.java index 3f16b2fcf26..b53a1976e37 100644 --- a/src/main/java/seedu/address/ui/HelpWindow.java +++ b/src/main/java/seedu/address/ui/HelpWindow.java @@ -15,7 +15,7 @@ */ public class HelpWindow extends UiPart { - public static final String USERGUIDE_URL = "https://se-education.org/addressbook-level3/UserGuide.html"; + public static final String USERGUIDE_URL = "https://ay2324s1-cs2103t-t12-3.github.io/tp/UserGuide.html"; public static final String HELP_MESSAGE = "Refer to the user guide: " + USERGUIDE_URL; private static final Logger logger = LogsCenter.getLogger(HelpWindow.class);