Skip to content

Commit

Permalink
Merge pull request #94 from siqirua/branch-UG
Browse files Browse the repository at this point in the history
Update UG and fix some bugs
  • Loading branch information
feifeiraindrops authored Nov 2, 2023
2 parents 27a72d6 + db8005c commit ce399d2
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 70 deletions.
16 changes: 16 additions & 0 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,22 @@ measures: mean, standardDeviation, upperQuartile, lowerQuartile, max, min, skewn
Examples:
* `stats st/upperQuartile st/lowerQuartile` returns the upper and lower quartile of the overall student grades.

### Calculating statistics of a graded component

Calculates the statistics of all students of a specific graded component.

Format: `compStats [c/COMP_NAME] [st/STATS] [g/TUTORIAL_GRP]`

* It is allowed to omit `[st/STATS]`. In this case, it will return a summary of all statistics that are currently
supported.
* For stats keywords, it must be currently supported. Here is an exhaustive list of currently supported statistical
measures: mean, standardDeviation, upperQuartile, lowerQuartile, max, min, skewness.
* It is allowed to have multiple stats keywords, but only allowed to have 0 or 1 tutorial group keyword and component
name keyword.

Examples:
* `compStats st/upperQuartile st/lowerQuartile c/Midterm` returns the upper and lower quartile of the
student grades in Midterm.

### Clearing all entries : `clear`

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package seedu.address.logic.commands;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ORDER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_REVERSE;

import java.util.function.Predicate;

Expand All @@ -18,11 +20,13 @@ public class SortStudentCommand extends Command {

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Sorts all students by the given order.\n"
+ "Parameters:\n"
+ "Attribute to be sorted: Must be one of \"n\", \"name\", \"s\", \"studentId\", "
+ "[" + PREFIX_ORDER + "attribute to be sorted (optional, by default sorted by overall score]: \n"
+ "Must be one of \"n\", \"name\", \"s\", \"studentId\", "
+ "\"studentID\", \"e\", \"email\", \"g\", \"tutorial\", \"tut\", \"tutGroup\""
+ "\"ts\", \"totalScore\", \"totalscore\", \"overall\", \"score\"\n"
+ "Reverse (optional): If true, the sorted list is reversed (or sorted in Descending order)\n"
+ "Example: " + COMMAND_WORD + " s true";
+ "[" + PREFIX_REVERSE + "Reverse (optional, by default increasing)]:\n"
+ "If true, the sorted list is reversed (or sorted in Descending order)\n"
+ "Example: " + COMMAND_WORD + " o/s r/true";

private final String sortingOrder;
private final boolean reverse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.parser.CliSyntax.PREFIX_COMPONENT_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_REVERSE;

import java.util.Collections;
import java.util.function.Predicate;
Expand All @@ -12,13 +13,9 @@
import seedu.address.model.gradedcomponent.GcName;
import seedu.address.model.student.Student;
import seedu.address.model.student.model.StudentBook;
import seedu.address.model.studentscore.StudentScore;
import seedu.address.model.studentscore.StudentScoreMatchPredicate;
import seedu.address.model.studentscore.ScoreMatchPredicate;
import seedu.address.model.studentscore.model.StudentScoreBook;




/**
* Sorts the student(s) whose student id by the given order.
*/
Expand All @@ -28,15 +25,16 @@ public class SortStudentScoreCommand extends Command {
public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Sorts all students scores under a given graded component.\n"
+ "Parameters:\n"
+ PREFIX_COMPONENT_NAME + "COMPONENT NAME\n"
+ "Reverse (optional): If true, the sorted list is reversed (or sorted in Descending order)\n"
+ "Example: " + COMMAND_WORD + " c/Midterm true";
+ "[" + PREFIX_COMPONENT_NAME + "COMPONENT NAME]\n"
+ "[" + PREFIX_REVERSE + "Reverse (optional, by default increasing)]: "
+ "If true, the sorted list is reversed (or sorted in Descending order)\n"
+ "Example: " + COMMAND_WORD + " c/Midterm r/true";

private final GcName gcName;
private final boolean reverse;

/**
* Creates an SortStudentCommand to sort the displayed students.
* Creates a SortStudentCommand to sort the displayed students.
*/
public SortStudentScoreCommand(GcName gcName, boolean reverse) {
this.gcName = gcName;
Expand All @@ -47,12 +45,11 @@ public SortStudentScoreCommand(GcName gcName, boolean reverse) {
public CommandResult execute(Model model) {
requireNonNull(model);
Predicate<Student> currentStuPredicate = model.getCurrentStudentsPredicate();
Predicate<StudentScore> currentStuScorePredicate = model.getCurrentScoresPredicate();
StudentBook studentBook = model.getStudentBook();
StudentScoreBook studentScoreBook = model.getStudentScoreBook();
studentScoreBook.sortStudentScore(reverse);
studentBook.sortStudentScore(gcName, reverse);
model.updateFilteredStudentScoreList(new StudentScoreMatchPredicate(Collections.singletonList(gcName)));
model.updateFilteredStudentScoreList(new ScoreMatchPredicate(Collections.singletonList(gcName.gcName)));
if (currentStuPredicate != null) {
model.updateFilteredStudentList(currentStuPredicate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.function.Predicate;

import seedu.address.model.gradedcomponent.GcMatchPredicate;
import seedu.address.model.student.Student;
import seedu.address.model.student.StudentMatchPredicate;

/**
Expand All @@ -17,7 +18,7 @@ public class ScoreMatchPredicate implements Predicate<StudentScore> {
private final List<String> tutorialGroupKeywords;
private final List<String> tagKeywords;
private final List<String> commentKeywords;
private final StudentMatchPredicate studentMatchPredicate;
private final Predicate<Student> studentMatchPredicate;
private final GcMatchPredicate gcMatchPredicate;

/**
Expand Down Expand Up @@ -49,7 +50,7 @@ public ScoreMatchPredicate(List<String> idKeywords, List<String> nameKeywords,
*
* @param studentMatchPredicate the student match predicate
*/
public ScoreMatchPredicate(StudentMatchPredicate studentMatchPredicate) {
public ScoreMatchPredicate(Predicate<Student> studentMatchPredicate) {
this.gcNames = new ArrayList<>();
this.idKeywords = new ArrayList<>();
this.nameKeywords = new ArrayList<>();
Expand All @@ -60,6 +61,22 @@ public ScoreMatchPredicate(StudentMatchPredicate studentMatchPredicate) {
this.gcMatchPredicate = new GcMatchPredicate();
}

/**
* Constructs a predicate to search for certain students scores.
*
* @param gcKeywords the gc keywords
*/
public ScoreMatchPredicate(List<String> gcKeywords) {
this.gcNames = gcKeywords;
this.idKeywords = new ArrayList<>();
this.nameKeywords = new ArrayList<>();
this.tagKeywords = new ArrayList<>();
this.tutorialGroupKeywords = new ArrayList<>();
this.commentKeywords = new ArrayList<>();
this.studentMatchPredicate = new StudentMatchPredicate();
this.gcMatchPredicate = new GcMatchPredicate();
}

/**
* Instantiates a new Score match predicate.
*
Expand Down

This file was deleted.

0 comments on commit ce399d2

Please sign in to comment.