Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Bug - Fix PED issues #191

Merged
merged 4 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,19 @@ Edit at your own risk of losing data.
* For `[j/JobTitle]...`, only alphanumeric inputs are allowed. i.e. Only the characters A-Z, a-z, 0-9. Spaces are also allowed. <br>
e.g. `j/SoftwareEngineerIntern` is allowed, `t/Software Engineer Intern` is also allowed.

**:information_source: Notes about duplicate applications:**<br>

* Duplicate applications are not allowed.

* Applications are considered duplicates if they have the same name, job title and optional tags.

* Name, job title and optional tags are case-sensitive.
e.g. The name `Shopee` is considered different from `shopee`.

* Ordering of optional tags do not matter.
e.g. `tag1`, `tag2`, `tag3` is considered the same as `tag3`, `tag1`, `tag2`.

* Refer to FAQ for adding multiple applications to the same job.

</div>

Expand Down Expand Up @@ -327,6 +339,10 @@ InternApply data are saved in the hard disk automatically after any command that
**Q**: When I run SIA for the first time, I do not see any of the sample application. How can I get the sample applications to appear in SIA? <br>
**A**: Refer to the 1st QnA to locate the `data` folder. Delete any existing files in the `data` folder and run SoC InternApply again.

**Q**: I have an existing application to a company that I applied to where I got rejected and I am trying to reapply to the same company with the exact same details. Since SIA cannot have duplicate applications, what should I do? <br>
**A**: <br>
Option 1: Using edit, you can simply reuse the existing application with updated information. <br>
Option 2: If you are looking to keep the existing application and it's information untouched, then we suggest including an additional "t/NthAttempt" to differentiate your new application and the existing application. This will not violate our duplication clause while also allowing you to keep information on your existing application.

[Go To TOC](#table-of-contents)

Expand Down
Binary file modified docs/images/MainWindowUi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/ReminderWindowUi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/logic/commands/AddCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public class AddCommand extends Command {


public static final String MESSAGE_SUCCESS = "New application added: %1$s";
public static final String MESSAGE_DUPLICATE_APPLICATION = "This application already exists in InternApply";
public static final String MESSAGE_DUPLICATE_APPLICATION = "A duplicate application with the same name, job title "
+ "and optional tags already exists in InternApply";

public static final String MESSAGE_APPLICATION_STATUS_TAG = "Application status tag must be : "
+ ApplicationStatusTagType.getAllTypesInString();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/logic/commands/EditCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public class EditCommand extends Command {

public static final String MESSAGE_EDIT_APPLICATION_SUCCESS = "Edited Application: %1$s";
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided.";
public static final String MESSAGE_DUPLICATE_APPLICATION = "This application already exists in InternApply.";
public static final String MESSAGE_DUPLICATE_APPLICATION = "A duplicate application with the same name, job title "
+ "and optional tags already exists in InternApply";

private final Index index;
private final EditApplicationDescriptor editApplicationDescriptor;
Expand Down
18 changes: 17 additions & 1 deletion src/main/java/seedu/address/model/application/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,20 @@ public Optional<Tag> getApplicationStatusTag() {
return Optional.empty();
}

public Optional<Set<Tag>> getJobScopeTags() {
Set<Tag> jobScopeTagSet = new HashSet<>();
for (Tag tag: tags) {
if (tag.tagType.equals(TagType.JOB_SCOPE)) {
jobScopeTagSet.add(tag);
}
}
if (jobScopeTagSet.isEmpty()) {
return Optional.empty();
} else {
return Optional.of(jobScopeTagSet);
}
}

/**
* Returns an immutable tag set, which throws {@code UnsupportedOperationException}
* if modification is attempted.
Expand All @@ -117,7 +131,9 @@ public boolean isSameApplication(Application otherApplication) {
}

return otherApplication != null
&& otherApplication.getName().equals(getName());
&& otherApplication.getName().equals(getName())
&& otherApplication.getJobTitle().equals(getJobTitle())
&& otherApplication.getJobScopeTags().equals(getJobScopeTags());
}

/**
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/seedu/address/model/application/Email.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class Email {

private static final String SPECIAL_CHARACTERS = "+_.-";
public static final String MESSAGE_CONSTRAINTS = "Emails should be of the format local-part@domain "
public static final String MESSAGE_CONSTRAINTS = "Emails should be of the format local-part@domain-name.domain "
+ "and adhere to the following constraints:\n"
+ "1. The local-part should only contain alphanumeric characters and these special characters, excluding "
+ "the parentheses, (" + SPECIAL_CHARACTERS + "). The local-part may not start or end with any special "
Expand All @@ -20,15 +20,18 @@ public class Email {
+ "The domain name must:\n"
+ " - end with a domain label at least 2 characters long\n"
+ " - have each domain label start and end with alphanumeric characters\n"
+ " - have each domain label consist of alphanumeric characters, separated only by hyphens, if any.";
+ " - have each domain label consist of alphanumeric characters, separated only by hyphens, if any.\n"
+ " - end with at least one domain e.g. \".com\"";
// alphanumeric and special characters
private static final String ALPHANUMERIC_NO_UNDERSCORE = "[^\\W_]+"; // alphanumeric characters except underscore
private static final String LOCAL_PART_REGEX = "^" + ALPHANUMERIC_NO_UNDERSCORE + "([" + SPECIAL_CHARACTERS + "]"
+ ALPHANUMERIC_NO_UNDERSCORE + ")*";
private static final String DOMAIN_PART_REGEX = ALPHANUMERIC_NO_UNDERSCORE
+ "(-" + ALPHANUMERIC_NO_UNDERSCORE + ")*";
private static final String DOMAIN_LAST_PART_REGEX = "(" + DOMAIN_PART_REGEX + "){2,}$"; // At least two chars
private static final String DOMAIN_REGEX = "(" + DOMAIN_PART_REGEX + "\\.)*" + DOMAIN_LAST_PART_REGEX;
private static final String DOMAIN_MIDDLE_PART_REGEX = "(\\.*(" + DOMAIN_PART_REGEX + ")+)*\\."; // Multiple .co.in
private static final String DOMAIN_REGEX = "(" + DOMAIN_PART_REGEX + ")+" + DOMAIN_MIDDLE_PART_REGEX
+ DOMAIN_LAST_PART_REGEX;
Comment on lines 25 to +34
Copy link

Choose a reason for hiding this comment

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

Nice regex checking!

This might be useful too: https://stackoverflow.com/questions/624581/what-is-the-best-java-email-address-validation-method, but as mentioned in the comments of the first post there might be some edge cases as well

Other than the suggestion, LGTM!

public static final String VALIDATION_REGEX = LOCAL_PART_REGEX + "@" + DOMAIN_REGEX;

public final String value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"address": "4th street",
"interviewSlot" : "13-03-2022 13:00",
"details" : "To add details, use the edit command",
"tagged": [ "friends" ],
"jobTitle": "Intern"
} ]
}
6 changes: 3 additions & 3 deletions src/test/java/seedu/address/model/InternApplyMemoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.logic.commands.CommandTestUtil.VALID_ADDRESS_GARENA;
import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_LOCAL;
import static seedu.address.logic.commands.CommandTestUtil.VALID_PHONE_GARENA;
import static seedu.address.testutil.Assert.assertThrows;
import static seedu.address.testutil.TypicalApplications.GRAB;
import static seedu.address.testutil.TypicalApplications.getTypicalInternApplyMemory;
Expand Down Expand Up @@ -47,7 +47,7 @@ public void resetData_withValidReadOnlyInternApplyMemory_replacesData() {
public void resetData_withDuplicateApplications_throwsDuplicateApplicationException() {
// Two applications with the same identity fields
Application editedGrab = new ApplicationBuilder(GRAB)
.withAddress(VALID_ADDRESS_GARENA).withTags(VALID_TAG_LOCAL)
.withAddress(VALID_ADDRESS_GARENA).withPhone(VALID_PHONE_GARENA)
.build();
List<Application> newApplications = Arrays.asList(GRAB, editedGrab);
InternApplyMemoryStub newData = new InternApplyMemoryStub(newApplications);
Expand Down Expand Up @@ -75,7 +75,7 @@ public void hasApplication_applicationInInternApplyMemory_returnsTrue() {
public void hasApplication_applicationWithSameIdentityFieldsInInternApplyMemory_returnsTrue() {
internApplyMemory.addApplication(GRAB);
Application editedGrab = new ApplicationBuilder(GRAB)
.withAddress(VALID_ADDRESS_GARENA).withTags(VALID_TAG_LOCAL)
.withAddress(VALID_ADDRESS_GARENA).withPhone(VALID_PHONE_GARENA)
.build();
assertTrue(internApplyMemory.hasApplication(editedGrab));
}
Expand Down
15 changes: 12 additions & 3 deletions src/test/java/seedu/address/model/application/ApplicationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static seedu.address.logic.commands.CommandTestUtil.VALID_ADDRESS_GARENA;
import static seedu.address.logic.commands.CommandTestUtil.VALID_EMAIL_GARENA;
import static seedu.address.logic.commands.CommandTestUtil.VALID_INTERVIEW_SLOT_GARENA;
import static seedu.address.logic.commands.CommandTestUtil.VALID_JOBTITLE_GARENA;
import static seedu.address.logic.commands.CommandTestUtil.VALID_NAME_GARENA;
import static seedu.address.logic.commands.CommandTestUtil.VALID_PHONE_GARENA;
import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_LOCAL;
Expand Down Expand Up @@ -32,16 +33,24 @@ public void isSameApplication() {
// null -> returns false
assertFalse(GRAB.isSameApplication(null));

// same name, all other attributes different -> returns true
Application editedGrab = new ApplicationBuilder(GRAB)
// same name, job title and no tags, all other attributes different -> returns true
Application editedGrab = new ApplicationBuilder(GRAB).withJobTitle(GRAB.getJobTitle().toString())
.withPhone(VALID_PHONE_GARENA).withEmail(VALID_EMAIL_GARENA)
.withAddress(VALID_ADDRESS_GARENA).withTags(VALID_TAG_LOCAL).build();
.withAddress(VALID_ADDRESS_GARENA).build();
assertTrue(GRAB.isSameApplication(editedGrab));

// different name, all other attributes same -> returns false
editedGrab = new ApplicationBuilder(GRAB).withName(VALID_NAME_GARENA).build();
assertFalse(GRAB.isSameApplication(editedGrab));

// different job title, all other attributes same -> returns false
editedGrab = new ApplicationBuilder(GRAB).withJobTitle(VALID_JOBTITLE_GARENA).build();
assertFalse(GRAB.isSameApplication(editedGrab));

// different tags, all other attributes same -> returns false
editedGrab = new ApplicationBuilder(GRAB).withTags(VALID_TAG_LOCAL).build();
assertFalse(GRAB.isSameApplication(editedGrab));

// name differs in case, all other attributes same -> returns false
Application editedGarena = new ApplicationBuilder(GARENA).withName(VALID_NAME_GARENA.toLowerCase()).build();
assertFalse(GARENA.isSameApplication(editedGarena));
Expand Down
7 changes: 4 additions & 3 deletions src/test/java/seedu/address/model/application/EmailTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,19 @@ public void isValidEmail() {
assertFalse(Email.isValidEmail("[email protected]")); // domain name starts with a hyphen
assertFalse(Email.isValidEmail("[email protected]")); // domain name ends with a hyphen
assertFalse(Email.isValidEmail("[email protected]")); // top level domain has less than two chars
assertFalse(Email.isValidEmail("a@bc")); // minimal, no top level domain

// valid email
assertTrue(Email.isValidEmail("[email protected]")); // underscore in local part
assertTrue(Email.isValidEmail("[email protected]")); // period in local part
assertTrue(Email.isValidEmail("[email protected]")); // '+' symbol in local part
assertTrue(Email.isValidEmail("[email protected]")); // hyphen in local part
assertTrue(Email.isValidEmail("a@bc")); // minimal
assertTrue(Email.isValidEmail("test@localhost")); // alphabets only
assertTrue(Email.isValidEmail("123@145")); // numeric local part and domain name
assertTrue(Email.isValidEmail("[email protected]")); // alphabets only
assertTrue(Email.isValidEmail("[email protected]")); // numeric local part and domain name
assertTrue(Email.isValidEmail("[email protected]")); // mixture of alphanumeric and special characters
assertTrue(Email.isValidEmail("[email protected]")); // long domain name
assertTrue(Email.isValidEmail("[email protected]")); // long local part
assertTrue(Email.isValidEmail("[email protected]")); // more than one period in domain
assertTrue(Email.isValidEmail("[email protected]")); // more than one domain
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static seedu.address.logic.commands.CommandTestUtil.VALID_ADDRESS_GARENA;
import static seedu.address.logic.commands.CommandTestUtil.VALID_PHONE_GARENA;
import static seedu.address.logic.commands.CommandTestUtil.VALID_TAG_LOCAL;
import static seedu.address.testutil.Assert.assertThrows;
import static seedu.address.testutil.TypicalApplications.GARENA;
Expand Down Expand Up @@ -43,7 +44,7 @@ public void contains_applicationInList_returnsTrue() {
public void contains_applicationWithSameIdentityFieldsInList_returnsTrue() {
uniqueApplicationList.add(GRAB);
Application editedGrab = new ApplicationBuilder(GRAB)
.withAddress(VALID_ADDRESS_GARENA).withTags(VALID_TAG_LOCAL)
.withAddress(VALID_ADDRESS_GARENA).withPhone(VALID_PHONE_GARENA)
.build();
assertTrue(uniqueApplicationList.contains(editedGrab));
}
Expand Down