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

Fix DG br #346

Merged
merged 5 commits into from
Nov 14, 2023
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
48 changes: 24 additions & 24 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1703,23 +1703,23 @@ testers are expected to do more *exploratory* testing.
1. Editing an assignment grade with _valid parameters_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editgrade 1 as/Functional Expressionism g/500`
2. Test case: `editgrade 1 as/Functional Expressionism g/500` <br>
Expected: Grade of the specified assignment has been edited to 500/500.

2. Editing an assignment grade with _invalid index_
1. Test case: `editgrade 0 as/Functional Expressionism g/500`
1. Test case: `editgrade 0 as/Functional Expressionism g/500` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Assignment grade is not edited. <br> Reason: The person index provided does not exist.

3. Editing an assignment grade with _invalid assignment name_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editgrade 1 as/Finding Boyd g/500`
2. Test case: `editgrade 1 as/Finding Boyd g/500` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Assignment grade is not edited. <br> Reason: The assignment name does not exist.

4. Editing an assignment grade with _invalid grade_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editgrade 1 as/Functional Expressionism g/700`
2. Test case: `editgrade 1 as/Functional Expressionism g/700` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Assignment grade is not edited. <br> Reason: The grade exceeds the maximum grade by more than 75.


Expand All @@ -1730,17 +1730,17 @@ testers are expected to do more *exploratory* testing.
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. The assignment has already been graded.
2. Test case: `deletegrade 1 as/Functional Expressionism`
2. Test case: `deletegrade 1 as/Functional Expressionism` <br>
Expected: Grade of the specified assignment has been deleted.

2. Deleting an assignment grade with _invalid index_
1. Test case: `deletegrade 0 as/Functional Expressionism`
1. Test case: `deletegrade 0 as/Functional Expressionism` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Assignment grade is not deleted. <br> Reason: The person index provided does not exist.

3. Deleting an assignment grade with _invalid assignment name_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `deletegrade 1 as/Finding Boyd`
2. Test case: `deletegrade 1 as/Finding Boyd` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Assignment grade is not deleted. <br> Reason: The assignment name does not exist.


Expand All @@ -1750,23 +1750,23 @@ testers are expected to do more *exploratory* testing.
1. Editing an assignment comment with _valid parameters_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editcomment 1 as/Functional Expressionism c/Good job!`
2. Test case: `editcomment 1 as/Functional Expressionism c/Good job!` <br>
Expected: Comment of the specified assignment has been edited to "Good job!".

2. Editing an assignment comment with _invalid index_
1. Test case: `editcomment 0 as/Functional Expressionism c/Good job!`
1. Test case: `editcomment 0 as/Functional Expressionism c/Good job!` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Assignment comment is not edited. <br> Reason: The person index provided does not exist.

3. Editing an assignment comment with _invalid assignment name_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editcomment 1 as/Finding Boyd c/Good job!`
2. Test case: `editcomment 1 as/Finding Boyd c/Good job!` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Assignment comment is not edited. <br> Reason: The assignment name does not exist.

4. Editing an assignment comment with _invalid comment_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editcomment 1 as/Functional Expressionism c/`
2. Test case: `editcomment 1 as/Functional Expressionism c/` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Assignment grade is not edited. <br> Reason: The comment cannot be empty.


Expand All @@ -1777,17 +1777,17 @@ testers are expected to do more *exploratory* testing.
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. The assignment has already been commented on.
2. Test case: `deletecomment 1 as/Functional Expressionism`
2. Test case: `deletecomment 1 as/Functional Expressionism` <br>
Expected: Comment of the specified assignment has been deleted.

2. Deleting an assignment comment with _invalid index_
1. Test case: `deletecomment 0 as/Functional Expressionism`
1. Test case: `deletecomment 0 as/Functional Expressionism` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Assignment comment is not deleted. <br> Reason: The person index provided does not exist.

3. Deleting an assignment comment with _invalid assignment name_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `deletecomment 1 as/Finding Boyd`
2. Test case: `deletecomment 1 as/Finding Boyd` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Assignment comment is not deleted. <br> Reason: The assignment name does not exist.

### Graded Test
Expand All @@ -1797,61 +1797,61 @@ testers are expected to do more *exploratory* testing.
1. Editing the score(s) of a graded test with _valid parameters_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: editgradedtest 1 ra1/90 ra2/85 mt/95 f/80 pe/75 ra1/88
2. Test case: `editgradedtest 1 ra1/90 ra2/85 mt/95 f/80 pe/75 ra1/88` <br>
Expected: F.A.K.E.J.A.R.V.I.S. successfully edits the scores for the specified person's graded test.

2. Editing the score(s) of a graded test with an _empty list_
1. Prerequisites:
1. The list of persons is empty.
2. Test case: editgradedtest 1 ra1/90 ra2/85 mt/95 f/80 pe/75 ra1/88
2. Test case: `editgradedtest 1 ra1/90 ra2/85 mt/95 f/80 pe/75 ra1/88` <br>
F.A.K.E.J.A.R.V.I.S. displays an error. Graded Test scores are not edited <br> Reason: The student list is empty.

3. Editing the score(s) of a graded test with an _invalid index_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editgradedtest 0 ra1/90 ra2/85 mt/95 f/80 pe/75 ra1/88`
2. Test case: `editgradedtest 0 ra1/90 ra2/85 mt/95 f/80 pe/75 ra1/88` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Graded Test scores are not edited. <br> Reason: The given index is invalid.

4. Editing the score(s) of a graded test with _empty parameter(s)_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editgradedtest 1`
2. Test case: `editgradedtest 1` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Graded Test scores are not edited. <br> Reason: The parameter(s) given is empty.

5. Editing the score(s) of a graded test with _invalid parameter(s)_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editgradedtest 1 ra3/90 pee/100`
2. Test case: `editgradedtest 1 ra3/90 pee/100` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Graded Test scores are not edited. <br> Reason: The parameter(s) given is/are invalid.

6. Editing the score(s) of a graded test with _extra parameter(s)_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editgradedtest 1 ra1/90 ra2/85 mt/95 f/80 pe/75 ra1/88 ra2/75`
2. Test case: `editgradedtest 1 ra1/90 ra2/85 mt/95 f/80 pe/75 ra1/88 ra2/75` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Graded Test scores are not edited. <br> Reason: Extra parameter(s) is/are given.

7. Editing the score(s) of a graded test with _fewer parameter(s)_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editgradedtest 1 ra1/90 ra2/85 mt/95`
2. Test case: `editgradedtest 1 ra1/90 ra2/85 mt/95` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays a success message. Graded Test scores are edited. Reason: Graded Test fields are optional.

8. Editing the score(s) of a graded test with _parameters in different order_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editgradedtest 1 ra1/90 pe/75 f/80 ra2/85 mt/95`
2. Test case: `editgradedtest 1 ra1/90 pe/75 f/80 ra2/85 mt/95` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays a success message. Graded Test scores are edited. Reason: The order of Graded Test fields does not matter.

9. Editing the score(s) of a graded test with _an invalid score_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editgradedtest 1 ra1/-100 ra2/85 mt/105 f/80 pe/75 ra1/88`
2. Test case: `editgradedtest 1 ra1/-100 ra2/85 mt/105 f/80 pe/75 ra1/88` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Graded Test scores are not edited. <br> Reason: The given score is invalid.

10. Editing the score(s) of a graded test with _multiple invalid scores_
1. Prerequisites:
1. There is at least 1 student being displayed in the students list.
2. Test case: `editgradedtest 1 ra1/-90 ra2/-85 mt/-100 f/invalid pe/-75 ra1/-88`
2. Test case: `editgradedtest 1 ra1/-90 ra2/-85 mt/-100 f/invalid pe/-75 ra1/-88` <br>
Expected: F.A.K.E.J.A.R.V.I.S. displays an error. Graded Test scores are not edited. <br> Reason: The given scores are invalid.

### Consultation
Expand Down
2 changes: 2 additions & 0 deletions docs/diagrams/GradedTestClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class GradedTest {
+ getGradedTests(): String
+ isValidGradeTestName(test: String): boolean
+ isSameGradedTest(otherGradedTest: GradedTest): boolean
+ parseGradedTest(gradedTest: String): String[]
+ validateField(fieldName: String, fieldValue: String): String
}

class ReadingAssessment1 {
Expand Down
Binary file modified docs/images/GradedTest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/gradedtest/Finals.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Finals {
/**
* Constructs a {@code Finals}.
*
* @param finalResults A valid phone number.
* @param finalResults A valid finals result.
*/
public Finals(String finalResults) {
requireNonNull(finalResults);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public static boolean isValidGradeTestNameDefault(String test) {
}

/**
* Returns true if both tasks have the same name and description.
* Returns true if both gradedtest have the same name and description.
*/
public boolean isSameGradedTest(GradedTest otherGradedTest) {
if (otherGradedTest == this) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/seedu/address/model/gradedtest/MidTerms.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public class MidTerms {
public final String value;

/**
* Constructs a {@code Finals}.
* Constructs a {@code MidTerms}.
*
* @param midTermResults A valid phone number.
* @param midTermResults A valid midterms result.
*/
public MidTerms(String midTermResults) {
requireNonNull(midTermResults);
Expand All @@ -27,7 +27,7 @@ public MidTerms(String midTermResults) {
}

/**
* Returns true if a given string is a valid PE result.
* Returns true if a given string is a valid Midterms result.
*/
public static boolean isValidMidTermResult(String test) {
return test.matches(VALIDATION_REGEX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public class PracticalExam {
public final String value;

/**
* Constructs a {@code Finals}.
* Constructs a {@code PracticalExam}.
*
* @param peResults A valid phone number.
* @param peResults A valid practical exam result.
*/
public PracticalExam(String peResults) {
requireNonNull(peResults);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public class ReadingAssessment1 {
public final String value;

/**
* Constructs a {@code Finals}.
* Constructs a {@code ReadingAssessment1}.
*
* @param raResult A valid raResult number.
* @param raResult A valid ra1 Result.
*/
public ReadingAssessment1(String raResult) {
requireNonNull(raResult);
Expand All @@ -27,7 +27,7 @@ public ReadingAssessment1(String raResult) {
}

/**
* Returns true if a given string is a valid RA result.
* Returns true if a given string is a valid RA1 result.
*/
public static boolean isValidRaResult(String test) {
return test.matches(VALIDATION_REGEX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public class ReadingAssessment2 {
public final String value;

/**
* Constructs a {@code Finals}.
* Constructs a {@code ReadingAssessment2}.
*
* @param raResult A valid raResult number.
* @param raResult A valid ra2 Result.
*/
public ReadingAssessment2(String raResult) {
requireNonNull(raResult);
Expand All @@ -27,7 +27,7 @@ public ReadingAssessment2(String raResult) {
}

/**
* Returns true if a given string is a valid RA result.
* Returns true if a given string is a valid RA2 result.
*/
public static boolean isValidRaResult(String test) {
return test.matches(VALIDATION_REGEX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ public boolean test(Session session) {
session.getSessionNumber().sessionNumber, keyword));
}

/**
* Checks if the specified string contains a substring, performing a case-insensitive match.
*
* @param str The main string to check.
* @param substring The substring to search for in the main string.
* @return {@code true} if the main string contains the substring (ignoring case), {@code false} otherwise.
* @throws NullPointerException if either {@code str} or {@code substring} is {@code null}.
*/
private boolean containsSubstringIgnoreCase(String str, String substring) {
// Convert both the main string and substring to lowercase for a case-insensitive match
String lowerCaseStr = str.toLowerCase();
Expand All @@ -30,6 +38,7 @@ private boolean containsSubstringIgnoreCase(String str, String substring) {
// Check if the main string contains the substring
return lowerCaseStr.contains(lowerCaseSubstring);
}

@Override
public boolean equals(Object other) {
if (other == this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public GradedTestBuilder withFinals(String finals) {
}

/**
* Sets the {@code PracticalExam} of the {@code Task} that we are building.
* Sets the {@code PracticalExam} of the {@code GradedTest} that we are building.
*/
public GradedTestBuilder withPe(String pE) {
this.pE = new PracticalExam(pE);
Expand Down
Loading