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

[CS2103T-W13-4] TutorPro #79

Open
wants to merge 579 commits into
base: master
Choose a base branch
from
Open
Changes from 3 commits
Commits
Show all changes
579 commits
Select commit Hold shift + click to select a range
588eb17
Merge branch 'master' into refactor-homework
Yufannnn Mar 30, 2023
f866c55
Refactor Homework Related Class
Yufannnn Mar 30, 2023
ebf6b82
Merge pull request #123 from Yufannnn/refactor-homework
NBQian Mar 30, 2023
e5f1c71
Merge branch 'master' into 30/03-UG,-done-value-update
NBQian Mar 30, 2023
12064df
Merge pull request #122 from NBQian/30/03-UG,-done-value-update
fahim-tazz Mar 30, 2023
b58876a
Merge pull request #26 from AY2223S2-CS2103T-W13-4/master
Yufannnn Mar 30, 2023
40781af
Update GUI section
Yufannnn Mar 30, 2023
891f03e
Merge branch 'master' into update-user-guide
Yufannnn Mar 30, 2023
ef57d61
Update UG
Yufannnn Mar 30, 2023
44eca33
Update UG GUI
Yufannnn Mar 30, 2023
c330392
Refactoring
Yufannnn Mar 30, 2023
7f20c71
Merge pull request #124 from Yufannnn/update-user-guide
szejiancheng Mar 30, 2023
d11e819
Merge pull request #27 from AY2223S2-CS2103T-W13-4/master
Yufannnn Mar 30, 2023
7b892b2
Merge branch 'master' of https://github.com/Yufannnn/tp
Yufannnn Mar 30, 2023
286811b
Add optional weightage and grade parameters to CreateExamCommand
szejiancheng Mar 30, 2023
f7c8598
Amended names of variables
szejiancheng Mar 30, 2023
a81d7a2
Added prefixes for weightage and grade
szejiancheng Mar 30, 2023
f57e073
Added functions for parsing grade and weightage
szejiancheng Mar 30, 2023
335c258
Amended CreateExamParser to accept optional weightage and grade params
szejiancheng Mar 30, 2023
83b0050
More amendments to class behaviour to support grade and weightage
szejiancheng Mar 30, 2023
1d4bd9a
Added dummy code to be amended
szejiancheng Mar 30, 2023
2881158
Merge branch 'branch-exam-enhancements'
szejiancheng Mar 30, 2023
4971ac5
Fixed Minor View Homework Issue
Yufannnn Mar 30, 2023
1706d6a
Fixed Minor UpdateHomeworkCommand
Yufannnn Mar 30, 2023
e31de3f
Update sample students' tags to reflect TutorPro tags.
Mar 30, 2023
4226a7e
Merge pull request #126 from fahim-tazz/update-sampleData
fahim-tazz Mar 30, 2023
e1447af
Fix bugs and unexpected behaviour in exam classes
szejiancheng Mar 31, 2023
d4ebc8c
Checkstyle fixes
szejiancheng Mar 31, 2023
fc39103
Merge pull request #125 from Yufannnn/fix-view-homework
szejiancheng Mar 31, 2023
a94efcb
fix exam testcase
szejiancheng Mar 31, 2023
3590687
Add view-profile command functionality
szejiancheng Mar 31, 2023
46f2561
amend testcase formatting
szejiancheng Mar 31, 2023
8aadb97
Merge pull request #127 from szejiancheng/master
Yufannnn Mar 31, 2023
f99d969
Merge pull request #128 from szejiancheng/branch-view-profile
Yufannnn Mar 31, 2023
1fb2fcb
Merge pull request #28 from AY2223S2-CS2103T-W13-4/master
Yufannnn Mar 31, 2023
408171a
Update UserGuide.md
Yufannnn Mar 31, 2023
e8aa7f3
Remove unimplemented command
szejiancheng Mar 31, 2023
47918eb
Merge pull request #129 from AY2223S2-CS2103T-W13-4/Yufannnn-update-u…
szejiancheng Mar 31, 2023
2a8c3dc
Merge branch 'master' into master
fahim-tazz Mar 31, 2023
f02777b
Merge pull request #130 from szejiancheng/master
fahim-tazz Mar 31, 2023
6f63201
Fix Bugs from PE
Yufannnn Apr 1, 2023
842a43a
Merge pull request #29 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 1, 2023
1eb4bfb
Merge branch 'master' of https://github.com/Yufannnn/tp
Yufannnn Apr 1, 2023
0a93a22
Fix Styling Issue
Yufannnn Apr 1, 2023
de09aec
fix wrong format for time for lessons in UG
Apr 1, 2023
491f182
Merge pull request #170 from Yufannnn/Yufan-PE-bug
szejiancheng Apr 1, 2023
fe4162f
Now the user cannot add a student whose name contains any existing st…
Apr 2, 2023
36c23d1
fixed bugs not fixed in the previous commit
Apr 2, 2023
8210ead
Merge branch 'master' into BOQIAN-PED-BUGS
NBQian Apr 2, 2023
7b5ce2f
Merge pull request #173 from NBQian/BOQIAN-PED-BUGS
Yufannnn Apr 3, 2023
44dddcc
Merge pull request #30 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 4, 2023
332a8cf
Fixes Confusing Listing index issue and Updates UserGuide
Yufannnn Apr 4, 2023
c3571c1
a lesson now cannot be added to a student if the tutor has another at…
Apr 5, 2023
8f48973
now cannot update the time of lesson to one that would result in time…
Apr 5, 2023
7ad1890
Merge pull request #174 from Yufannnn/lesson-exam-list-index
NBQian Apr 5, 2023
bf406ec
Change UG pdf file header from "AB-3" to "TutorPro"
Apr 5, 2023
9dda54f
Remove reference to "calculate-grade" command in UG.
Apr 5, 2023
982c2e9
Rename edit command to update-info
Apr 5, 2023
3290449
Fix tables formatting in UG.
Apr 5, 2023
08f90eb
Merge branch 'master' into PED-Fix-update-command
Apr 5, 2023
e5a5e67
Merge branch 'master' into PED-Fix-UG-bugs
Apr 5, 2023
7fb867c
Merge pull request #176 from fahim-tazz/PED-Fix-UG-bugs
fahim-tazz Apr 5, 2023
e0ea669
Attempt to fix UG table #2
Apr 5, 2023
021f091
Merge pull request #178 from fahim-tazz/PED-Fix-UG-bugs
fahim-tazz Apr 5, 2023
b209148
Fix outdated commands in UG, under `Commands` section.
Apr 5, 2023
b8ecbbd
Fixed hyperlink in Quick Start guide.
Apr 5, 2023
3942443
Merge pull request #179 from fahim-tazz/PED-Fix-UG-bugs
fahim-tazz Apr 5, 2023
5808897
Fix a logical error: when adding a lesson, we should only check if th…
Apr 5, 2023
b51057b
fix ped bug where commands consider names in a case-sensitive manner.
Apr 5, 2023
62f7037
Merge pull request #181 from NBQian/PED-Case-Sensitive-bugfix
Yufannnn Apr 6, 2023
230c0ca
Merge pull request #180 from NBQian/LWE-conflict-bug
Yufannnn Apr 6, 2023
1b5afba
Update Yufan PPP
Yufannnn Apr 6, 2023
b903485
now done/ can only be followed by either "done" or "not done". UG for…
Apr 6, 2023
2eb7455
Merge pull request #184 from NBQian/BQ-UGG
Yufannnn Apr 6, 2023
7da52ff
Merge pull request #31 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 6, 2023
7d5312f
Merge branch 'master' into Yufan-ppp
Yufannnn Apr 6, 2023
0ca700e
update PPP
Yufannnn Apr 6, 2023
1e741ab
Fix CheckStyle Issues
Yufannnn Apr 6, 2023
2fbae71
Update Search By Name Mechanism
Yufannnn Apr 6, 2023
de8e07f
Fixes TOC
Yufannnn Apr 6, 2023
839d899
Fixes Errors
Yufannnn Apr 7, 2023
6d84aa5
EDIT FIND DELETE now must be used with prefixes
Apr 7, 2023
9190c65
Merge pull request #185 from Yufannnn/Yufan-ppp
NBQian Apr 7, 2023
46ca5e6
Merge pull request #186 from Yufannnn/name-mechanism
NBQian Apr 7, 2023
5a425d5
Merge pull request #187 from NBQian/EDIT-DELETE-FIND-has-prefix
Yufannnn Apr 8, 2023
454bce6
fix the bug for lesson and exam where update does not throw error whe…
Apr 8, 2023
9dbdd91
Merge pull request #189 from NBQian/BUG-UPDATE-NON-EXIST
fahim-tazz Apr 8, 2023
fbbfe4a
Merge branch 'master' into PED-Fix-update-command
Apr 8, 2023
dc06bba
Change ```edit``` command to ```update-info```.
Apr 8, 2023
1d97577
Add delete command to UG.
Apr 8, 2023
dfccd3d
Update update-info command format in UG.
Apr 8, 2023
20ea45c
Fix examples for update-info command in UG.
Apr 8, 2023
2ab2ab1
Added View Profile command to UG.
Apr 8, 2023
d353392
Merge pull request #190 from fahim-tazz/PED-Fix-update-command
Yufannnn Apr 8, 2023
64b17ea
Merge pull request #32 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 8, 2023
8606507
Add screenshots to Profile Commands.
Apr 8, 2023
a758c72
Merge pull request #191 from fahim-tazz/PED-Fix-UG-bugs
Yufannnn Apr 8, 2023
738f34b
Update Structure
Yufannnn Apr 8, 2023
2fdcf5f
Merge pull request #33 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 8, 2023
45889ce
Merge branch 'master' into final-update-of-UG
Yufannnn Apr 8, 2023
ce49492
now if the user tries to add an exam to a student that clashes with t…
Apr 8, 2023
88e47da
huge update for UG
Yufannnn Apr 8, 2023
d878bff
Merge pull request #192 from NBQian/ADD-EXAM-LESSON-CLASH-MSG
Yufannnn Apr 8, 2023
1b24922
Fixed a bit date formating issue
Yufannnn Apr 8, 2023
cda0d64
Merge pull request #34 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 8, 2023
20e0000
Merge branch 'master' into final-update-of-UG
Yufannnn Apr 8, 2023
fd11d7d
fix emoji error
Yufannnn Apr 8, 2023
acfc621
Add changes to UG
szejiancheng Apr 8, 2023
90ad5c5
Merge pull request #193 from Yufannnn/final-update-of-UG
fahim-tazz Apr 8, 2023
8779b3d
Merge branch 'master' into UG-exam-changes
Yufannnn Apr 8, 2023
323f2d6
Merge pull request #194 from szejiancheng/UG-exam-changes
Yufannnn Apr 8, 2023
0d087ea
Merge pull request #35 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 8, 2023
5033c0f
fixes homework documentation issues
Yufannnn Apr 8, 2023
1b3dc12
Merge branch 'master' into final-update-of-UG
Yufannnn Apr 8, 2023
bf11399
Update respective part of the UG as well
Yufannnn Apr 8, 2023
0e5b1d5
Merge pull request #195 from Yufannnn/final-update-of-UG
NBQian Apr 8, 2023
58689e2
Create all necessary test classes
szejiancheng Apr 8, 2023
9696f24
no message
Apr 8, 2023
eb4f96e
Merge pull request #196 from NBQian/PPP-BQ
Yufannnn Apr 9, 2023
cea50b3
Update PPP
Yufannnn Apr 9, 2023
0a45531
Merge pull request #36 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 9, 2023
906e718
Merge branch 'master' into final-update-of-UG
Yufannnn Apr 9, 2023
6399d30
Change screenshot on landing page.
Apr 9, 2023
a0ba488
Update UML as well
Yufannnn Apr 9, 2023
75fb439
create Glossary section of DG. Update TOC for DG
Apr 9, 2023
f19494f
Merge pull request #198 from NBQian/DG-Glossary
Yufannnn Apr 9, 2023
e043814
Merge pull request #197 from Yufannnn/final-update-of-UG
NBQian Apr 9, 2023
f1924ba
Merge pull request #37 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 9, 2023
959a13a
Merge branch 'master' of https://github.com/Yufannnn/tp
Yufannnn Apr 9, 2023
b0f857e
Fixes major Storage Bug
Yufannnn Apr 9, 2023
0e1b723
Merge pull request #199 from Yufannnn/fix-storage-bug
NBQian Apr 9, 2023
3ad54bc
fix the bug where editing a student's info results in all his homewor…
Apr 9, 2023
c5fea3f
Merge pull request #200 from NBQian/EDIT-BUG-PPP
Yufannnn Apr 9, 2023
5794e88
Add testcases for JsonAdaptedExam
szejiancheng Apr 9, 2023
a73a3b3
Add JsonAdaptedLesson testcases
szejiancheng Apr 9, 2023
b3d9cd3
Add testcases for ExamDonePredicate
szejiancheng Apr 9, 2023
5350e5e
Add testcases for ExamDatePredicate
szejiancheng Apr 9, 2023
7d038ad
Add testcases for ExamPredicate
szejiancheng Apr 9, 2023
b81cf81
checkstyle changes
szejiancheng Apr 9, 2023
fd3bb98
more checkstyle fixes
szejiancheng Apr 9, 2023
f97fd7e
Merge pull request #202 from szejiancheng/branch-adding-testcases
Yufannnn Apr 10, 2023
b9c2af1
Merge pull request #38 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 10, 2023
4bdc830
Fixes DG bugs
Yufannnn Apr 10, 2023
39f989d
Update UG cosmetics as well
Yufannnn Apr 10, 2023
89873fa
Update UserGuide.md
Yufannnn Apr 10, 2023
fdb4e5f
Merge pull request #203 from Yufannnn/fix-DG-bug
szejiancheng Apr 10, 2023
b7dc3cb
now lessons can only be added to one student each time
Apr 10, 2023
061fd51
Merge branch 'master' into PED-Fix-UG-bugs
Apr 10, 2023
d7aeb8a
Fix Ui Bug
Yufannnn Apr 10, 2023
18f950e
Merge branch 'fix-DG-bug' of https://github.com/Yufannnn/tp into fix-…
Yufannnn Apr 10, 2023
64dcf7c
Finalize UG for submission.
Apr 10, 2023
11b3355
Fix Styling
Yufannnn Apr 10, 2023
1686fad
Update UML
Yufannnn Apr 10, 2023
8f544f8
Merge pull request #206 from Yufannnn/fix-DG-bug
NBQian Apr 10, 2023
39c8f39
Merge pull request #205 from NBQian/one-student-lesson
Yufannnn Apr 10, 2023
b682153
Merge pull request #207 from fahim-tazz/PED-Fix-UG-bugs
Yufannnn Apr 10, 2023
05814ac
fixed wrong representation for the sequence diagram of CreateLessonCo…
Apr 10, 2023
bc3146e
Add help list exit commands to Command Summary.
Apr 10, 2023
1b94dbd
Remove non-essential screenshots from UG.
Apr 10, 2023
6ec092a
Merge branch 'master' into PED-Fix-UG-bugs
Apr 10, 2023
5ceb757
Merge pull request #208 from NBQian/bq-dg-sq-diagram
Yufannnn Apr 10, 2023
76a5557
Merge pull request #39 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 10, 2023
c4253ae
Minor Change
Yufannnn Apr 10, 2023
f4a4671
Merge branch 'master' into fix-DG-bug
Yufannnn Apr 10, 2023
d7f16fd
Merge branch 'master' into PED-Fix-UG-bugs
Apr 10, 2023
1a79341
Add UG page breaks, attempt #1.
Apr 10, 2023
127c2a7
Merge pull request #209 from fahim-tazz/PED-Fix-UG-bugs
fahim-tazz Apr 10, 2023
8ea7238
Attempt 2 of adding page breaks.
Apr 10, 2023
97d65e6
Merge pull request #211 from fahim-tazz/PED-Fix-UG-bugs
fahim-tazz Apr 10, 2023
1120178
Merge pull request #40 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 10, 2023
121b269
Minor Update
Yufannnn Apr 10, 2023
837fe3e
Merge branch 'master' of https://github.com/Yufannnn/tp
Yufannnn Apr 10, 2023
84d7805
Merge branch 'master' into fix-DG-bug
Yufannnn Apr 10, 2023
b555bbe
Add Future Features
Yufannnn Apr 10, 2023
7ebb3e0
Merge pull request #212 from Yufannnn/fix-DG-bug
NBQian Apr 10, 2023
2c35d4c
Fix Minor Display Issues
Yufannnn Apr 10, 2023
8b663bc
Merge pull request #213 from AY2223S2-CS2103T-W13-4/Developer-Guide-D…
NBQian Apr 10, 2023
8096d8e
Merge pull request #41 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 10, 2023
54c74f8
Page break attempt 3
Apr 10, 2023
d09c8be
Merge pull request #214 from fahim-tazz/PED-Fix-UG-bugs
fahim-tazz Apr 10, 2023
335d81a
Merge pull request #42 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 10, 2023
1f1e095
Attempt 4 at fixing UG page breaks.
Apr 10, 2023
81d33b8
Merge pull request #215 from fahim-tazz/PED-Fix-UG-bugs
fahim-tazz Apr 10, 2023
873b158
Merge pull request #43 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 10, 2023
1f74aa1
Attempt 5 at UG page breaks.
Apr 10, 2023
ad7ecf7
Merge pull request #216 from fahim-tazz/PED-Fix-UG-bugs
fahim-tazz Apr 10, 2023
e62349e
Attempt 6 at UG page breaks.
Apr 10, 2023
a4aa1cb
Merge pull request #217 from fahim-tazz/PED-Fix-UG-bugs
fahim-tazz Apr 10, 2023
6e1a2b8
more test cases for Lesson
Apr 10, 2023
166c356
Attempt 8 at UG page breaks.
Apr 10, 2023
822476c
Merge pull request #219 from fahim-tazz/PED-Fix-UG-bugs
fahim-tazz Apr 10, 2023
901d69b
idk whats going on
Apr 10, 2023
134c65f
Merge pull request #218 from NBQian/bq-dg-sq-diagram
Yufannnn Apr 10, 2023
5f3742c
Merge pull request #44 from AY2223S2-CS2103T-W13-4/master
Yufannnn Apr 10, 2023
4d83892
Update Parser
Yufannnn Apr 10, 2023
586c5af
Merge branch 'master' of https://github.com/Yufannnn/tp
Yufannnn Apr 10, 2023
1ea698f
remove main
Yufannnn Apr 10, 2023
7861b52
Fix WhiteSpace
Yufannnn Apr 10, 2023
e658570
Fix wrong deletion message for Homework, Student and Lesson.
Apr 10, 2023
b93f03e
Merge pull request #220 from Yufannnn/fix-DG-bug
NBQian Apr 10, 2023
17b07f2
Merge pull request #221 from fahim-tazz/bug-fixes-before-PE
Yufannnn Apr 10, 2023
7d2479e
fix bug about date/date, and the bug where the student disappears aft…
Apr 10, 2023
fec71b5
123321
Apr 10, 2023
e131ec3
Merge branch 'bq-dg-sq-diagram' into DATE-bug-im-crying
Apr 10, 2023
62d1612
Update `AboutUs.md` to reflect Fahim's email.
Apr 10, 2023
207fb1c
add testcases for viewProfileCommand
szejiancheng Apr 10, 2023
37ec90e
checkstyle fixes
szejiancheng Apr 10, 2023
eba4ca1
Merge pull request #223 from szejiancheng/master
fahim-tazz Apr 10, 2023
7b03df4
Merge branch 'master' into DATE-bug-im-crying
NBQian Apr 10, 2023
c027d72
Update ViewLessonCommandParserTest.java
NBQian Apr 10, 2023
dfb70f8
Update User stories to reflect v1.4.
Apr 10, 2023
6cc3dd3
Merge pull request #224 from NBQian/DATE-bug-im-crying
szejiancheng Apr 10, 2023
4656e5f
123
Apr 10, 2023
c9e3c0d
bugfix
szejiancheng Apr 10, 2023
4f16aea
Merge pull request #226 from szejiancheng/branch-bug-fix-invocation-e…
szejiancheng Apr 10, 2023
5209f7d
Merge pull request #225 from fahim-tazz/fahim-PPP-aboutUs
Yufannnn Apr 10, 2023
29bd044
12345676898079
Apr 10, 2023
5a052b5
Finalize UG.
Apr 10, 2023
d2ccd5f
Merge pull request #227 from NBQian/dup-prefix-bug
fahim-tazz Apr 10, 2023
8ccef45
Merge pull request #228 from fahim-tazz/finalize-UG
NBQian Apr 10, 2023
9b65e9c
123456789
Apr 10, 2023
51d263c
Merge pull request #229 from NBQian/dup-prefix-bug
Yufannnn Apr 10, 2023
b788b44
Add reposense link to ppp.
Apr 10, 2023
c5c9853
tweaks to the dg
szejiancheng Apr 10, 2023
49c8430
Merge pull request #230 from szejiancheng/branch-DG-edits
fahim-tazz Apr 10, 2023
0160b7a
update PPP
szejiancheng Apr 10, 2023
de0e6c3
Finalized Fahim's PPP
Apr 10, 2023
934206f
hehehe
Apr 10, 2023
bdcccb9
Merge branch 'master' into finalize-PPP-fahim
fahim-tazz Apr 10, 2023
bce93cb
Merge pull request #232 from fahim-tazz/finalize-PPP-fahim
NBQian Apr 10, 2023
121804a
Merge pull request #231 from NBQian/CREDIT
szejiancheng Apr 10, 2023
c771102
changes to DG
szejiancheng Apr 10, 2023
34899f5
Merge pull request #233 from szejiancheng/master
Yufannnn Apr 10, 2023
560d555
tweaks to dg
szejiancheng Apr 10, 2023
e292a7f
Merge pull request #234 from szejiancheng/master
Yufannnn Apr 10, 2023
9285d71
Add ToC formatting.
fahim-tazz Apr 10, 2023
f25ef3b
12343546756898
Apr 10, 2023
3a73872
1234
Apr 10, 2023
bc2f6bf
Add page breaks.
fahim-tazz Apr 10, 2023
7844b16
03498170459874
Apr 10, 2023
dd454fa
Merge pull request #235 from NBQian/BQCOMMENTS
Yufannnn Apr 10, 2023
24e659f
final ppp
szejiancheng Apr 10, 2023
62655c2
tweak link to PPP
szejiancheng Apr 10, 2023
dd1a4fa
Merge pull request #236 from szejiancheng/branch-jc's-PPP
Yufannnn Apr 10, 2023
5d8e891
Update index.md
szejiancheng Apr 10, 2023
c756cf2
v1.4b
Apr 10, 2023
99fffef
Final tweaks
szejiancheng Apr 10, 2023
56fd6c8
Merge pull request #237 from NBQian/TAGGGGGGGG
Yufannnn Apr 10, 2023
824b3e4
Merge pull request #238 from szejiancheng/master
Yufannnn Apr 10, 2023
5ca3fb6
Add `Supoorted Date Formats` to ToC
fahim-tazz Apr 14, 2023
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
Original file line number Diff line number Diff line change
@@ -129,11 +129,6 @@ public CommandResult execute(Model model) throws CommandException {
}
Double newWeightage = this.weightage.orElse(examToUpdate.getWeightage());
Grade newGrade = this.grade.orElse(examToUpdate.getGrade());

//if (Duration.between(newStartTime, newEndTime).toMinutes() < 30 || Duration.between(newStartTime,
// newEndTime).toHours() > 3) {
// throw new CommandException(Messages.MESSAGE_INVALID_EXAM_DURATION);
//}
Exam newExam = new Exam(newExamName, newStartTime, newEndTime, newWeightage, newGrade);

try {
Original file line number Diff line number Diff line change
@@ -147,9 +147,11 @@ public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof UpdateLessonCommand // instanceof handles nulls
&& predicate.equals(((UpdateLessonCommand) other).predicate)
&& index == ((UpdateLessonCommand) other).index
&& index.equals(((UpdateLessonCommand) other).index)
&& lessonName.equals(((UpdateLessonCommand) other).lessonName)
&& startTime.equals(((UpdateLessonCommand) other).startTime)
&& endTime.equals((((UpdateLessonCommand) other).endTime)));
&& startTime.orElse(LocalDateTime.parse("2090-04-10T08:30:00")).isEqual((((UpdateLessonCommand) other))
.startTime.orElse(LocalDateTime.parse("2090-04-10T08:30:00")))
&& endTime.orElse(LocalDateTime.parse("2090-04-10T08:30:00")).isEqual((((UpdateLessonCommand) other))
.endTime.orElse(LocalDateTime.parse("2090-04-10T08:30:00"))));
}
}
Original file line number Diff line number Diff line change
@@ -33,13 +33,6 @@ public DeleteCommand parse(String args) throws ParseException {

Index index = ParserUtil.parseIndex(argMultimap.getValue(PREFIX_INDEX).get());
return new DeleteCommand(index);
// try {
// Index index = ParserUtil.parseIndex(args);
// return new DeleteCommand(index);
// } catch (ParseException pe) {
// throw new ParseException(
// String.format(MESSAGE_INVALID_COMMAND_FORMAT, DeleteCommand.MESSAGE_USAGE), pe);
// }
}

/**
11 changes: 0 additions & 11 deletions src/main/java/seedu/address/logic/parser/FindCommandParser.java
Original file line number Diff line number Diff line change
@@ -43,19 +43,8 @@ public FindCommand parse(String args) throws ParseException {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
ViewExamCommand.MESSAGE_USAGE));
}
int spaceIndex = name.indexOf(" ");
// if (spaceIndex != -1) {
// name = name.substring(0, spaceIndex);
// }
nameKeywords.set(i, name);
}
// String trimmedArgs = args.trim();
// if (trimmedArgs.isEmpty()) {
// throw new ParseException(
// String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindCommand.MESSAGE_USAGE));
// }
//
// String[] nameKeywords = trimmedArgs.split("\\s+");
return new FindCommand(new NamePredicate(nameKeywords));
}

Original file line number Diff line number Diff line change
@@ -76,10 +76,6 @@ public CreateExamCommand parse(String args) throws ParseException {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
CreateExamCommand.MESSAGE_USAGE));
}
// int spaceIndex = name.indexOf(" ");
// if (spaceIndex != -1) {
// name = name.substring(0, spaceIndex);
// }
nameKeywords.set(i, name);
}
names = nameKeywords;
Original file line number Diff line number Diff line change
@@ -50,10 +50,6 @@ public DeleteExamCommand parse(String args) throws ParseException {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
DeleteExamCommand.MESSAGE_USAGE));
}
// int spaceIndex = name.indexOf(" ");
// if (spaceIndex != -1) {
// name = name.substring(0, spaceIndex);
// }
nameKeywords.set(i, name);
}
inputNames = nameKeywords;
Original file line number Diff line number Diff line change
@@ -65,10 +65,6 @@ public UpdateExamCommand parse(String args) throws ParseException {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
UpdateExamCommand.MESSAGE_USAGE));
}
// int spaceIndex = name.indexOf(" ");
// if (spaceIndex != -1) {
// name = name.substring(0, spaceIndex);
// }
nameKeywords.set(i, name);
}
names = nameKeywords;
Original file line number Diff line number Diff line change
@@ -55,7 +55,6 @@ public ViewExamCommand parse(String args) throws ParseException {

// If name is present, create a predicate to filter by name
if (argMultimap.getValue(PREFIX_NAME).isPresent()) {

List<String> nameKeywords = argMultimap.getAllValues(PREFIX_NAME);
// for all the names, trim the name and only take the first word
for (int i = 0; i < nameKeywords.size(); i++) {
@@ -65,10 +64,6 @@ public ViewExamCommand parse(String args) throws ParseException {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
ViewExamCommand.MESSAGE_USAGE));
}
int spaceIndex = name.indexOf(" ");
// if (spaceIndex != -1) {
// name = name.substring(0, spaceIndex);
// }
nameKeywords.set(i, name);
}
nameList = nameKeywords;
Original file line number Diff line number Diff line change
@@ -67,10 +67,6 @@ public CreateLessonCommand parse(String args) throws ParseException {
CreateLessonCommand.MESSAGE_USAGE));
}
name = name.trim();
// int spaceIndex = name.indexOf(" ");
// if (spaceIndex != -1) {
// name = name.substring(0, spaceIndex);
// }
nameKeywords.set(i, name);
}
names = nameKeywords;
Original file line number Diff line number Diff line change
@@ -50,10 +50,6 @@ public DeleteLessonCommand parse(String args) throws ParseException {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
DeleteLessonCommand.MESSAGE_USAGE));
}
// int spaceIndex = name.indexOf(" ");
// if (spaceIndex != -1) {
// name = name.substring(0, spaceIndex);
// }
nameKeywords.set(i, name);
}
inputNames = nameKeywords;
Original file line number Diff line number Diff line change
@@ -60,17 +60,13 @@ public UpdateLessonCommand parse(String args) throws ParseException {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
UpdateLessonCommand.MESSAGE_USAGE));
}
// int spaceIndex = name.indexOf(" ");
// if (spaceIndex != -1) {
// name = name.substring(0, spaceIndex);
// }
nameKeywords.set(i, name);
}
names = nameKeywords;

if (nameKeywords.size() > 1) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
"Only one name is allowed for update homework command."));
"Only one name is allowed for update lesson command."));
}

// if homework name is not present, set it to null, else parse it
Original file line number Diff line number Diff line change
@@ -65,10 +65,6 @@ public ViewLessonCommand parse(String args) throws ParseException {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
ViewLessonCommand.MESSAGE_USAGE));
}
int spaceIndex = name.indexOf(" ");
// if (spaceIndex != -1) {
// name = name.substring(0, spaceIndex);
// }
nameKeywords.set(i, name);
}
nameList = nameKeywords;
@@ -110,6 +106,6 @@ public ViewLessonCommand parse(String args) throws ParseException {
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof ViewLessonCommandParser // instanceof handles nulls
&& this.equals((ViewLessonCommandParser) other)); // state check
&& this.equals(other)); // state check
}
}
18 changes: 0 additions & 18 deletions src/main/java/seedu/address/model/student/Lesson.java
Original file line number Diff line number Diff line change
@@ -43,24 +43,6 @@ public LocalDateTime getEndTime() {
return endTime;
}

/**
* Returns the start time of the lesson in a String format.
*
* @return The start time of the lesson in a String format.
*/
public String getStartTimeString() {
return startTime.format(formatter);
}

/**
* Returns the end time of the lesson in a String format.
*
* @return
*/
public String getEndTimeString() {
return endTime.format(formatter);
}

/**
* Returns true if the 2 lessons' timeslot conflict with each other.
* @param otherLesson The other lesson to compare with.
Original file line number Diff line number Diff line change
@@ -32,6 +32,6 @@ public boolean test(Lesson lesson) {
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof LessonBelongsToDatePredicate // instanceof handles nulls
&& targetDate == ((LessonBelongsToDatePredicate) other).targetDate); // date check
&& targetDate.isEqual(((LessonBelongsToDatePredicate) other).targetDate)); // date check
}
}
3 changes: 1 addition & 2 deletions src/main/java/seedu/address/model/student/NamePredicate.java
Original file line number Diff line number Diff line change
@@ -36,7 +36,6 @@ public boolean test(Student student) {
@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof NamePredicate // instanceof handles nulls
&& names.equals(((NamePredicate) other).names)); // date check
|| (other instanceof NamePredicate && names.equals(((NamePredicate) other).names));
}
}
29 changes: 0 additions & 29 deletions src/main/java/seedu/address/model/student/Student.java
Original file line number Diff line number Diff line change
@@ -139,25 +139,6 @@ public ObservableList<Exam> getExamsList() {
}

//HOMEWORK########################################################################################
/**
* Returns an immutable assignment list, which throws {@code UnsupportedOperationException}
* if modification is attempted.
*
* @return list of completed homework
*/
public ObservableList<Homework> getCompletedHomeworkList() {
return homeworkList.asUnmodifiableObservableList().filtered(Homework::isCompleted);
}

/**
* Returns an immutable assignment list, which throws {@code UnsupportedOperationException}
*
* @return list of pending homework
*/
public ObservableList<Homework> getPendingHomeworkList() {
return homeworkList.asUnmodifiableObservableList().filtered(homework -> !homework.isCompleted());
}

/**
* Adds a homework to the homework list.
*
@@ -314,21 +295,11 @@ public final List<Lesson> getFilteredLessonsList(Predicate<Lesson>... predicates

public void setLesson(Integer target, Lesson editedLesson) {
requireAllNonNull(target, editedLesson);
// UniqueLessonsList tempLessonList = lessonsList.clone();
// tempLessonList.setLesson(target, editedLesson);
// if (!(tempLessonList.validLessons())) {
// throw new ConflictingLessonsException();
// }
lessonsList.setLesson(target, editedLesson);
}

public void setExam(Integer target, Exam editedExam) {
requireAllNonNull(target, editedExam);
// UniqueExamList tempExamList = examList;
// tempExamList.setExam(target, editedExam);
// if (!(tempExamList.validExams())) {
// throw new ConflictingExamsException();
// }
examList.setExam(target, editedExam);
}

12 changes: 0 additions & 12 deletions src/main/java/seedu/address/model/student/UniqueExamList.java
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@

import java.util.Iterator;
import java.util.List;
import java.util.function.Predicate;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@@ -91,7 +90,6 @@ public void remove(Exam toRemove) {
}
}


/**
* Replaces the contents of this list with {@code replacement}.
* {@code replacement} must not contain duplicate Exams.
@@ -192,16 +190,6 @@ public int hashCode() {
return internalList.hashCode();
}

/**
* Updates the list of exams to only contain exams that fufil a predicate.
*
* @param examStatusPredicate predicate object encapsulating qualifier
*/
public void updateFilteredExamList(Predicate<Exam> examStatusPredicate) {
requireNonNull(examStatusPredicate);
internalList.removeIf(examStatusPredicate.negate());
}

/**
* Returns a list of past exams.
* The list is sorted by start time and capped at 3 exams.
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.CollectionUtil.requireAllNonNull;

import java.util.Comparator;
import java.util.Iterator;
import java.util.List;

@@ -59,7 +60,7 @@ public void add(Lesson toAdd) throws DuplicateLessonException, ConflictingLesson
}
}
internalList.add(toAdd);
internalList.sort((l1, l2) -> l1.getStartTime().compareTo(l2.getStartTime()));
internalList.sort(Comparator.comparing(Lesson::getStartTime));
}

/**
@@ -73,7 +74,7 @@ public void remove(Lesson toRemove) {
if (!internalList.remove(toRemove)) {
throw new LessonNotFoundException();
}
internalList.sort((l1, l2) -> l1.getStartTime().compareTo(l2.getStartTime()));
internalList.sort(Comparator.comparing(Lesson::getStartTime));
}

/**
@@ -98,7 +99,7 @@ public void setLessons(List<Lesson> lessons) {
throw new ConflictingLessonsException();
}
internalList.setAll(lessons);
internalList.sort((l1, l2) -> l1.getStartTime().compareTo(l2.getStartTime()));
internalList.sort(Comparator.comparing(Lesson::getStartTime));
}

public boolean validLessons() {
@@ -167,7 +168,7 @@ public int size() {

public List<Lesson> getSortedLessonsList() {
List<Lesson> tempList = internalList;
tempList.sort((l1, l2) -> l1.getStartTime().compareTo(l2.getStartTime()));
tempList.sort(Comparator.comparing(Lesson::getStartTime));
return tempList;
}

12 changes: 0 additions & 12 deletions src/test/java/seedu/address/logic/LogicManagerTest.java
Original file line number Diff line number Diff line change
@@ -49,18 +49,6 @@ public void setUp() {
logic = new LogicManager(model, storage);
}

// @Test
// public void execute_invalidCommandFormat_throwsParseException() {
// String invalidCommand = "uicfhmowqewca";
// assertParseException(invalidCommand, MESSAGE_UNKNOWN_COMMAND);
// }
//
// @Test
// public void execute_commandExecutionError_throwsCommandException() {
// String deleteCommand = "delete index/10";
// assertCommandException(deleteCommand, MESSAGE_INVALID_STUDENT_DISPLAYED_INDEX);
// }

@Test
public void execute_validCommand_success() throws Exception {
String listCommand = ListCommand.COMMAND_WORD;
11 changes: 0 additions & 11 deletions src/test/java/seedu/address/logic/commands/AddCommandTest.java
Original file line number Diff line number Diff line change
@@ -29,17 +29,6 @@ public void constructor_nullPerson_throwsNullPointerException() {
assertThrows(NullPointerException.class, () -> new AddCommand(null));
}

// @Test
// public void execute_personAcceptedByModel_addSuccessful() throws Exception {
// ModelStubAcceptingPersonAdded modelStub = new ModelStubAcceptingPersonAdded();
// Student validPerson = new StudentBuilder().build();
//
// CommandResult commandResult = new AddCommand(validPerson).execute(modelStub);
//
// assertEquals(String.format(AddCommand.MESSAGE_SUCCESS, validPerson), commandResult.getFeedbackToUser());
// assertEquals(Arrays.asList(validPerson), modelStub.personsAdded);
// }

@Test
public void execute_duplicatePerson_throwsCommandException() {
Student validPerson = new StudentBuilder().build();
17 changes: 9 additions & 8 deletions src/test/java/seedu/address/logic/commands/EditCommandTest.java
Original file line number Diff line number Diff line change
@@ -98,14 +98,15 @@ public void execute_filteredList_success() {
assertCommandSuccess(editCommand, model, expectedMessage, expectedModel);
}

// @Test
// public void execute_duplicatePersonUnfilteredList_failure() {
// Student firstPerson = model.getFilteredStudentList().get(INDEX_FIRST_PERSON.getZeroBased());
// EditCommand.EditStudentDescriptor descriptor = new EditStudentDescriptorBuilder(firstPerson).build();
// EditCommand editCommand = new EditCommand(INDEX_SECOND_PERSON, descriptor);
//
// assertCommandFailure(editCommand, model, EditCommand.MESSAGE_DUPLICATE_PERSON);
// }
@Test
public void execute_duplicatePersonUnfilteredList_failure() {
Student firstPerson = model.getFilteredStudentList().get(INDEX_FIRST_PERSON.getZeroBased());
EditCommand.EditStudentDescriptor descriptor = new EditStudentDescriptorBuilder(firstPerson).build();
EditCommand editCommand = new EditCommand(INDEX_SECOND_PERSON, descriptor);

assertCommandFailure(editCommand, model, String.format(Messages.MESSAGE_CONTAIN_STUDENT_NAME,
firstPerson.getName().toString()));
}

@Test
public void execute_duplicatePersonFilteredList_failure() {
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package seedu.address.logic.parser.lesson;

import static org.junit.jupiter.api.Assertions.assertThrows;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ENDTIME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_LESSON;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_STARTTIME;

import org.junit.jupiter.api.Test;

import seedu.address.logic.parser.exceptions.ParseException;

public class CreateLessonCommandParserTest {

private CreateLessonCommandParser parser = new CreateLessonCommandParser();

// @Test
// public void parse_validArgs_returnsCreateLessonCommand() throws ParseException {
// List<String> names = Arrays.asList("Alice", "Bob");
// String lessonName = "Math";
// LocalDateTime startTime = LocalDateTime.parse("2023-04-10T09:00");
// LocalDateTime endTime = LocalDateTime.parse("2023-04-10T11:00");
// String userInput = " " + PREFIX_NAME + "Alice " + PREFIX_NAME + "Bob " + PREFIX_LESSON + "Math "
// + PREFIX_STARTTIME + "2023-04-10T09:00 " + PREFIX_ENDTIME + "2023-04-10T11:00";
// CreateLessonCommand expectedCommand = new CreateLessonCommand(names, new NamePredicate(names),
// lessonName, startTime, endTime);
// assertEquals(expectedCommand, parser.parse(userInput));
// }

@Test
public void parse_invalidArgs_throwsParseException() {
String userInput = " " + PREFIX_NAME + "Alice " + PREFIX_NAME + "Bob " + PREFIX_LESSON + "Math "
+ PREFIX_STARTTIME + "2023-04-10T09:00 " + PREFIX_ENDTIME + "2023-04-10T08:00";
assertThrows(ParseException.class, () -> parser.parse(userInput));
}

@Test
public void parse_missingArgs_throwsParseException() {
String userInput = " " + PREFIX_NAME + "Alice " + PREFIX_NAME + "Bob " + PREFIX_LESSON + "Math "
+ PREFIX_STARTTIME + "2023-04-10T09:00";
assertThrows(ParseException.class, () -> parser.parse(userInput));
}

@Test
public void parse_emptyName_throwsParseException() {
String userInput = " " + PREFIX_NAME + " " + PREFIX_NAME + "Bob " + PREFIX_LESSON + "Math "
+ PREFIX_STARTTIME + "2023-04-10T09:00 " + PREFIX_ENDTIME + "2023-04-10T11:00";
assertThrows(ParseException.class, () -> parser.parse(userInput));
}

@Test
public void parse_invalidLessonName_throwsParseException() {
String userInput = " " + PREFIX_NAME + "Alice " + PREFIX_NAME + "Bob " + PREFIX_LESSON + " "
+ PREFIX_STARTTIME + "2023-04-10T09:00 " + PREFIX_ENDTIME + "2023-04-10T11:00";
assertThrows(ParseException.class, () -> parser.parse(userInput));
}

@Test
public void parse_invalidStartTimeFormat_throwsParseException() {
String userInput = " " + PREFIX_NAME + "Alice " + PREFIX_NAME + "Bob " + PREFIX_LESSON + "Math "
+ PREFIX_STARTTIME + "2023-04-10-09:00 " + PREFIX_ENDTIME + "2023-04-10T11:00";
assertThrows(ParseException.class, () -> parser.parse(userInput));
}

@Test
public void parse_invalidEndTimeFormat_throwsParseException() {
String userInput = " " + PREFIX_NAME + "Alice " + PREFIX_NAME + "Bob " + PREFIX_LESSON + "Math "
+ PREFIX_STARTTIME + "2023-04-10T09:00 " + PREFIX_ENDTIME + "2023-04-10-11:00";
assertThrows(ParseException.class, () -> parser.parse(userInput));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package seedu.address.logic.parser.lesson;

import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_INDEX;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CommandParserTestUtil.assertParseFailure;
import static seedu.address.logic.parser.CommandParserTestUtil.assertParseSuccess;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.junit.jupiter.api.Test;

import seedu.address.commons.core.index.Index;
import seedu.address.logic.commands.lesson.DeleteLessonCommand;
import seedu.address.model.student.NamePredicate;

public class DeleteLessonCommandParserTest {

private DeleteLessonCommandParser parser = new DeleteLessonCommandParser();

@Test
public void parse_allFieldsPresent_success() {
List<String> inputNames = new ArrayList<>(Arrays.asList("Alice", "Bob"));
NamePredicate namePredicate = new NamePredicate(inputNames);
Index targetIndex = Index.fromOneBased(1);
String userInput = " " + PREFIX_NAME + "Alice " + PREFIX_NAME + "Bob " + PREFIX_INDEX + "1";
DeleteLessonCommand expectedCommand = new DeleteLessonCommand(inputNames, namePredicate, targetIndex);

assertParseSuccess(parser, userInput, expectedCommand);
}

@Test
public void parse_missingName_throwsParseException() {
String userInput = " " + PREFIX_INDEX + "1";
assertParseFailure(parser, userInput, String.format(MESSAGE_INVALID_COMMAND_FORMAT,
DeleteLessonCommand.MESSAGE_USAGE));
}

@Test
public void parse_missingIndex_throwsParseException() {
String userInput = " " + PREFIX_NAME + "Alice " + PREFIX_NAME + "Bob";
assertParseFailure(parser, userInput, String.format(MESSAGE_INVALID_COMMAND_FORMAT,
DeleteLessonCommand.MESSAGE_USAGE));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package seedu.address.logic.parser.lesson;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

import org.junit.jupiter.api.Test;

import seedu.address.commons.core.index.Index;
import seedu.address.logic.commands.lesson.UpdateLessonCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.student.NamePredicate;

class UpdateLessonCommandParserTest {
private final UpdateLessonCommandParser parser = new UpdateLessonCommandParser();

@Test
void parse_allFieldsPresent_success() throws ParseException {
// All fields provided
assertEquals(parser.parse(" name/John index/1 lesson/Math start/2023-05-21T10:00 "
+ "end/2023-05-21 1100"),
new UpdateLessonCommand(List.of("John"), Index.fromOneBased(1),
new NamePredicate(List.of("John")),
Optional.of("Math"),
Optional.of(LocalDateTime.of(2023, 5, 21, 10, 0)),
Optional.of(LocalDateTime.of(2023, 5, 21, 11, 0))));
}

@Test
void parse_optionalFieldsMissing_success() throws ParseException {
// Lesson name and end time missing
assertEquals(parser.parse(" name/John index/1 start/2023-05-21T10:00"),
new UpdateLessonCommand(List.of("John"), Index.fromOneBased(1),
new NamePredicate(List.of("John")),
Optional.empty(),
Optional.of(LocalDateTime.of(2023, 5, 21, 10, 0)),
Optional.empty()));

// Start time and end time missing
Optional<LocalDateTime> start = Optional.empty();
Optional<LocalDateTime> end = Optional.empty();
assertEquals(parser.parse(" name/John index/1 lesson/Math"),
new UpdateLessonCommand(List.of("John"), Index.fromOneBased(1),
new NamePredicate(List.of("John")),
Optional.of("Math"),
start,
end));
}

@Test
void parse_missingCompulsoryField_failure() {
// Missing index
assertThrows(ParseException.class, () -> parser.parse(" name/John name/Doe lesson/Math"
+ "startTime/2023-05-21T10:00 endTime/2023-05-21T11:00"));

// Missing name
assertThrows(ParseException.class, () -> parser.parse(" index/1 lesson/Math startTime/2023-05-21T10:00"
+ "endTime/2023-05-21T11:00"));
}

@Test
void parse_invalidValue_failure() {
// Invalid index
assertThrows(ParseException.class, () -> parser.parse(" name/John name/Doe index/0"
+ "lesson/Math startTime/2023-05-21T10:00 endTime/2023-05-21T11:00"));

// Invalid date
assertThrows(ParseException.class, () -> parser.parse(" name/John name/Doe index/1 lesson/Math"
+ "startTime/2023-13-21T10:00 endTime/2023-05-21T11:00"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package seedu.address.logic.parser.lesson;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_STUDENTS;

import java.time.LocalDate;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.junit.jupiter.api.Test;

import seedu.address.logic.commands.lesson.ViewLessonCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.student.LessonBelongsToDatePredicate;
import seedu.address.model.student.LessonDonePredicate;
import seedu.address.model.student.LessonSubjectPredicate;
import seedu.address.model.student.NamePredicate;

class ViewLessonCommandParserTest {
private final ViewLessonCommandParser parser = new ViewLessonCommandParser();

@Test
public void parse_validArgs_returnsViewLessonCommand() throws ParseException {
// No filters provided
assertEquals(parser.parse(""), new ViewLessonCommand(Collections.emptyList(), PREDICATE_SHOW_ALL_STUDENTS,
lesson -> true, lesson -> true, true));

// Only name provided
List<String> nameKeywords = Arrays.asList("John", "Doe");
assertEquals(parser.parse(" name/John name/Doe"), new ViewLessonCommand(nameKeywords,
new NamePredicate(nameKeywords), lesson -> true, lesson -> true, false));

// All filters provided
List<String> names = Arrays.asList("John", "Doe");
assertEquals(parser.parse(" name/John name/Doe date/2023-05-21 subject/Math done/done"),
new ViewLessonCommand(names, new NamePredicate(names), new LessonBelongsToDatePredicate(LocalDate.of(2023,
5, 21)), new LessonSubjectPredicate("Math"), new LessonDonePredicate("done"), false));
}

@Test
public void parse_invalidArgs_throwsParseException() {
// Invalid done keyword
assertThrows(ParseException.class, () -> parser.parse(" done/invalid"));

// Invalid date format
assertThrows(ParseException.class, () -> parser.parse(" d/2023-13-32"));

// Invalid prefix
assertThrows(ParseException.class, () -> parser.parse(" x/John"));
}
}