Skip to content

Commit fddd47e

Browse files
authored
Merge pull request #144 from Timenikhil/fix-mark
Fix Mark Command
2 parents 763f7c3 + 43ea40e commit fddd47e

File tree

5 files changed

+18
-25
lines changed

5 files changed

+18
-25
lines changed

docs/images/Ui.png

446 KB
Loading

src/main/java/seedu/edulog/model/EduLog.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,17 @@ public void removeStudent(Student key) {
115115
public void markStudent(Student student) {
116116
requireNonNull(student);
117117
student.mark();
118+
setStudent(student, student);
118119
}
119120

120121
/**
121122
* Marks all students as paid.
122123
*/
123124
public void markAllStudents() {
124125
students.forEach(Student::mark);
126+
for (Student student : students) {
127+
setStudent(student, student);
128+
}
125129
}
126130

127131
/**
@@ -132,13 +136,17 @@ public void markAllStudents() {
132136
public void unmarkStudent(Student student) {
133137
requireNonNull(student);
134138
student.unmark();
139+
setStudent(student, student);
135140
}
136141

137142
/**
138143
* Marks all students as unpaid.
139144
*/
140145
public void unmarkAllStudents() {
141146
students.forEach(Student::unmark);
147+
for (Student student : students) {
148+
setStudent(student, student);
149+
}
142150
}
143151

144152
// ------------------ lesson-level operations -----------------------

src/main/java/seedu/edulog/model/student/Student.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,7 @@ public class Student {
2828
private final Fee fee;
2929

3030
/**
31-
* Every field must be present and not null except isPresent. I suggest
32-
* we keep this constructor so that we do not break all the test cases
33-
*/
34-
public Student(Name name, Phone phone, Email email, Address address, Set<Tag> tags) {
35-
requireAllNonNull(name, phone, email, address, tags);
36-
this.name = name;
37-
this.phone = phone;
38-
this.email = email;
39-
this.address = address;
40-
this.tags.addAll(tags);
41-
this.hasPaid = false;
42-
this.fee = new Fee(100);
43-
44-
}
45-
46-
/**
47-
* New constructor with Fee
31+
* Every field must be present and not null except hasPaid.
4832
*/
4933
public Student(Name name, Phone phone, Email email, Address address, Set<Tag> tags, Fee fee) {
5034
requireAllNonNull(name, phone, email, address, tags);

src/main/java/seedu/edulog/model/util/SampleDataUtil.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import seedu.edulog.model.calendar.Lesson;
1212
import seedu.edulog.model.student.Address;
1313
import seedu.edulog.model.student.Email;
14+
import seedu.edulog.model.student.Fee;
1415
import seedu.edulog.model.student.Name;
1516
import seedu.edulog.model.student.Phone;
1617
import seedu.edulog.model.student.Student;
@@ -24,22 +25,22 @@ public static Student[] getSampleStudents() {
2425
return new Student[] {
2526
new Student(new Name("Alex Yeoh"), new Phone("87438807"), new Email("[email protected]"),
2627
new Address("Blk 30 Geylang Street 29, #06-40"),
27-
getTagSet("friends")),
28+
getTagSet("friends"), new Fee("100")),
2829
new Student(new Name("Bernice Yu"), new Phone("99272758"), new Email("[email protected]"),
2930
new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"),
30-
getTagSet("colleagues", "friends")),
31+
getTagSet("colleagues", "friends"), new Fee("200")),
3132
new Student(new Name("Charlotte Oliveiro"), new Phone("93210283"), new Email("[email protected]"),
3233
new Address("Blk 11 Ang Mo Kio Street 74, #11-04"),
33-
getTagSet("neighbours")),
34+
getTagSet("neighbours"), new Fee("100")),
3435
new Student(new Name("David Li"), new Phone("91031282"), new Email("[email protected]"),
3536
new Address("Blk 436 Serangoon Gardens Street 26, #16-43"),
36-
getTagSet("family")),
37+
getTagSet("family"), new Fee("100")),
3738
new Student(new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("[email protected]"),
3839
new Address("Blk 47 Tampines Street 20, #17-35"),
39-
getTagSet("classmates")),
40+
getTagSet("classmates"), new Fee("100")),
4041
new Student(new Name("Roy Balakrishnan"), new Phone("92624417"), new Email("[email protected]"),
4142
new Address("Blk 45 Aljunied Street 85, #11-31"),
42-
getTagSet("colleagues"))
43+
getTagSet("colleagues"), new Fee("100"))
4344
};
4445
}
4546

src/main/java/seedu/edulog/ui/StudentCard.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ public class StudentCard extends UiPart<Region> {
4444
private FlowPane tags;
4545
@FXML
4646
private ImageView paidStatusIcon;
47+
@FXML
48+
private Label fee;
4749

4850
private final Image paidIcon = new Image(getClass().getResource("/images/paid.png").toExternalForm());
4951
private final Image unpaidIcon = new Image(getClass().getResource("/images/unpaid.png").toExternalForm());
5052

51-
private Label fee;
52-
5353
/**
5454
* Creates a {@code StudentCode} with the given {@code Student} and index to display.
5555
*/

0 commit comments

Comments
 (0)