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-W16-3] StudyBuddy #55

Open
wants to merge 1,053 commits into
base: master
Choose a base branch
from
Open
Changes from 15 commits
Commits
Show all changes
1053 commits
Select commit Hold shift + click to select a range
44a4afc
Checkstyle
gx-huang Apr 8, 2020
9c1e5f0
Edit test
gx-huang Apr 8, 2020
7a9a277
Merge branch 'calendar_command' of https://github.com/gx-huang/main i…
gx-huang Apr 8, 2020
69095a2
Incomplete merge
gx-huang Apr 8, 2020
46f2828
newline at EoF
gx-huang Apr 8, 2020
7ac3e09
Edited README.adoc
gx-huang Apr 8, 2020
2c2818b
Add duplicate + edit
souwmyaa Apr 8, 2020
8e20ecf
Bug fix
souwmyaa Apr 8, 2020
3e5e6de
Bug fix
souwmyaa Apr 8, 2020
fccac91
UG update
souwmyaa Apr 9, 2020
c73564c
DG update
souwmyaa Apr 9, 2020
1f8ab86
DG resize pics
souwmyaa Apr 9, 2020
9703e78
Updated Documentation
souwmyaa Apr 9, 2020
939715a
Merge conflict fix
souwmyaa Apr 9, 2020
1482abf
Bugs
souwmyaa Apr 9, 2020
c97064b
Merge pull request #261 from souwmyaa/master
souwmyaa Apr 9, 2020
920f06c
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/ma…
gx-huang Apr 9, 2020
7f24c21
Edited UG and some bug fix
gx-huang Apr 9, 2020
d8b0d4b
Merge pull request #260 from gx-huang/calendar_command
gx-huang Apr 9, 2020
9ae80e7
Bug fixes in DG
souwmyaa Apr 9, 2020
f138147
updates
souwmyaa Apr 9, 2020
05a4ae9
Merge pull request #44 from AY1920S2-CS2103T-W16-3/master
wyt-sonia Apr 9, 2020
8f7c3a6
Refactored to rename
souwmyaa Apr 9, 2020
5e98b48
- bug fix for edit and add module
wyt-sonia Apr 10, 2020
de66df9
update UG for module part
wyt-sonia Apr 10, 2020
6bbef82
UG update
wyt-sonia Apr 10, 2020
62d6307
code style and test case update for module creation function
wyt-sonia Apr 10, 2020
86269d8
code style
wyt-sonia Apr 10, 2020
bcda652
code quality
wyt-sonia Apr 10, 2020
d9f1f91
code quality
wyt-sonia Apr 10, 2020
e5badc4
code style
wyt-sonia Apr 10, 2020
61c7eeb
code quality
wyt-sonia Apr 10, 2020
1cb56d5
codestyle
wyt-sonia Apr 10, 2020
3a1e534
Merge pull request #262 from wyt-sonia/master
wyt-sonia Apr 10, 2020
c5cf958
UG update
souwmyaa Apr 10, 2020
d650997
Fix merge conflicts
souwmyaa Apr 10, 2020
84c2fa1
PPP draft
souwmyaa Apr 10, 2020
42a8b9d
Merge pull request #263 from souwmyaa/master
souwmyaa Apr 10, 2020
4498978
Edited DG
gx-huang Apr 10, 2020
a9a000b
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
gx-huang Apr 10, 2020
35fbbb1
Added comments + javadoc
souwmyaa Apr 10, 2020
7fbb569
Code quality improvement
souwmyaa Apr 10, 2020
7c820d4
UG update:
wyt-sonia Apr 10, 2020
7d634f4
Merge pull request #264 from gx-huang/master
wyt-sonia Apr 10, 2020
571f165
Merge pull request #45 from AY1920S2-CS2103T-W16-3/master
wyt-sonia Apr 10, 2020
9291e24
UG update
wyt-sonia Apr 10, 2020
5fb1082
UG update:
wyt-sonia Apr 10, 2020
3c9e3f6
Merge pull request #265 from wyt-sonia/master
wyt-sonia Apr 10, 2020
161d208
fix bugs
teikjun Apr 10, 2020
6496401
make responsive
teikjun Apr 10, 2020
4c73ad0
more edits
teikjun Apr 10, 2020
a4dd125
Merge pull request #266 from teikjun/ug
wyt-sonia Apr 11, 2020
18161a2
Fix checkstyle bug
souwmyaa Apr 11, 2020
09eef62
UG update
wyt-sonia Apr 11, 2020
d8a2439
Merge pull request #46 from AY1920S2-CS2103T-W16-3/master
wyt-sonia Apr 11, 2020
889dce6
UG update
wyt-sonia Apr 11, 2020
5237b4a
code style
wyt-sonia Apr 11, 2020
199bedc
UG bug fix
wyt-sonia Apr 11, 2020
68062a0
code style
wyt-sonia Apr 11, 2020
f04bde3
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
souwmyaa Apr 11, 2020
96cbe92
Merge pull request #267 from wyt-sonia/master
souwmyaa Apr 11, 2020
00cfe78
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
souwmyaa Apr 11, 2020
fda7e79
remove unused class
teikjun Apr 11, 2020
a846bb5
UG update
souwmyaa Apr 11, 2020
06d13fd
DG update
souwmyaa Apr 11, 2020
6a35404
Code quality improvement:
wyt-sonia Apr 11, 2020
e3c7c0b
Merge pull request #270 from souwmyaa/master
wyt-sonia Apr 11, 2020
ae3508b
Merge pull request #47 from AY1920S2-CS2103T-W16-3/master
wyt-sonia Apr 11, 2020
0466b40
code style
wyt-sonia Apr 11, 2020
061772d
update ug
teikjun Apr 11, 2020
563fba7
update ug
teikjun Apr 11, 2020
ce40a9e
bug fix
wyt-sonia Apr 11, 2020
bc62586
update ug
teikjun Apr 11, 2020
48a2c3c
Merge pull request #271 from wyt-sonia/master
wyt-sonia Apr 11, 2020
6330da0
more updates to ug
teikjun Apr 11, 2020
f0e9f9d
Merge pull request #272 from teikjun/ug
teikjun Apr 11, 2020
7f3a068
add newline
teikjun Apr 11, 2020
a95c346
Merge pull request #273 from teikjun/newline
teikjun Apr 11, 2020
2256853
Code quality improve:
wyt-sonia Apr 11, 2020
4dff026
fix bug
teikjun Apr 11, 2020
d1ba7bc
add javadocs
teikjun Apr 11, 2020
1772b3a
Merge pull request #274 from teikjun/fix
teikjun Apr 11, 2020
0d609cc
fix some bugs
teikjun Apr 11, 2020
873fd8c
fix more bugs
teikjun Apr 11, 2020
8ce759b
make responsive
teikjun Apr 11, 2020
2c6a43a
fix bug
teikjun Apr 11, 2020
0264871
Merge pull request #275 from teikjun/fix
teikjun Apr 11, 2020
256048a
Code quality:
wyt-sonia Apr 11, 2020
66edb9f
codestyle
wyt-sonia Apr 11, 2020
a97d3ce
Merge pull request #48 from AY1920S2-CS2103T-W16-3/master
wyt-sonia Apr 11, 2020
d833415
Merge pull request #276 from wyt-sonia/master
wyt-sonia Apr 11, 2020
e9422b1
update logic diagram
teikjun Apr 11, 2020
43aacbe
update logic diagram
teikjun Apr 11, 2020
7d9e1bb
update logic diagram
teikjun Apr 11, 2020
d308427
Merge pull request #277 from teikjun/dg
teikjun Apr 11, 2020
e58c6d4
add feature to dg
teikjun Apr 11, 2020
5b079d5
add use case and activity diagram to dg
teikjun Apr 11, 2020
933521f
add diagram png
teikjun Apr 11, 2020
f72a5b3
more log
wyt-sonia Apr 11, 2020
e046157
edition -> editing update
wyt-sonia Apr 11, 2020
2b0d509
Merge pull request #278 from teikjun/dg
wyt-sonia Apr 11, 2020
0fa83a7
Merge pull request #49 from AY1920S2-CS2103T-W16-3/master
wyt-sonia Apr 11, 2020
9156c0b
test case update
wyt-sonia Apr 12, 2020
ccff9a5
Merge pull request #280 from souwmyaa/master
wyt-sonia Apr 12, 2020
ec3d87c
Merge pull request #50 from AY1920S2-CS2103T-W16-3/master
wyt-sonia Apr 12, 2020
983b44f
codestyle
wyt-sonia Apr 12, 2020
346fec3
Added comments
souwmyaa Apr 12, 2020
d6b598f
Merge pull request #279 from wyt-sonia/master
souwmyaa Apr 12, 2020
03674e2
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
souwmyaa Apr 12, 2020
486ec84
Improved add duplicate
souwmyaa Apr 12, 2020
ae3173a
Bug fix
souwmyaa Apr 12, 2020
2b98f1d
Bug fix
souwmyaa Apr 12, 2020
5069671
Fix bug
souwmyaa Apr 12, 2020
65fd87f
Due soon bug fix
souwmyaa Apr 12, 2020
59f98bb
EOF
souwmyaa Apr 12, 2020
ec32a66
Merge pull request #281 from souwmyaa/master
teikjun Apr 12, 2020
6372c2f
refactor productivity page to productivity panel
teikjun Apr 12, 2020
6a618d4
Merge pull request #282 from teikjun/refactor
gx-huang Apr 12, 2020
3aeaa8b
Documentation update
souwmyaa Apr 12, 2020
1e18e48
modified architectrue UML
aegis-bot Apr 12, 2020
c429900
Documentation changes
souwmyaa Apr 12, 2020
ecf87f3
updated Architecture Diagram
aegis-bot Apr 12, 2020
db2fae1
Changed implementation of Calendar view
gx-huang Apr 12, 2020
78096ae
code refactor
wyt-sonia Apr 12, 2020
0fef243
Merge branch 'master' into pr/51
wyt-sonia Apr 12, 2020
b79fc7d
codestyle
wyt-sonia Apr 12, 2020
f1270e6
Changes
souwmyaa Apr 12, 2020
b0e900b
Merge pull request #284 from wyt-sonia/master
wyt-sonia Apr 12, 2020
b022ecd
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
souwmyaa Apr 12, 2020
7e8e34b
modified ModuleDiagram
aegis-bot Apr 12, 2020
acb2636
Merge pull request #285 from souwmyaa/master
gx-huang Apr 12, 2020
9442e2a
Merge https://github.com/AY1920S2-CS2103T-W16-3/main
aegis-bot Apr 12, 2020
8d9b41f
Added more tests
gx-huang Apr 12, 2020
f0d0ee4
Update model diagram
souwmyaa Apr 12, 2020
495d302
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
gx-huang Apr 12, 2020
456ad4c
Appease checkstyle
gx-huang Apr 12, 2020
f8df9b1
Merge pull request #286 from aegis-bot/master
gx-huang Apr 12, 2020
29040fc
Merge pull request #287 from gx-huang/master
aegis-bot Apr 12, 2020
a332f53
update comment
wyt-sonia Apr 12, 2020
02e6cf4
UG check
souwmyaa Apr 13, 2020
e06ae0b
DG check
souwmyaa Apr 13, 2020
cae9d6d
Added comments
souwmyaa Apr 13, 2020
cd80890
Test classes comments
souwmyaa Apr 13, 2020
be790ce
Merge pull request #288 from souwmyaa/master
teikjun Apr 13, 2020
016ec63
UG/DG changes
gx-huang Apr 13, 2020
c3401d8
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
gx-huang Apr 13, 2020
46fd1f4
Added filter interactive test
souwmyaa Apr 13, 2020
3a0c37c
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
souwmyaa Apr 13, 2020
0ec2d15
Refactoring
souwmyaa Apr 13, 2020
3e396e6
Merge pull request #289 from souwmyaa/master
aegis-bot Apr 13, 2020
96b7548
DG update
wyt-sonia Apr 13, 2020
9617e5a
Merge pull request #52 from AY1920S2-CS2103T-W16-3/master
wyt-sonia Apr 13, 2020
ee85f16
fixing codacy
aegis-bot Apr 13, 2020
96cf544
Merge https://github.com/AY1920S2-CS2103T-W16-3/main
aegis-bot Apr 13, 2020
806bf2e
codacy
aegis-bot Apr 13, 2020
56598d3
codestyle
wyt-sonia Apr 13, 2020
1ac2a61
Merge pull request #290 from wyt-sonia/master
aegis-bot Apr 13, 2020
688b183
Merge https://github.com/AY1920S2-CS2103T-W16-3/main
aegis-bot Apr 13, 2020
565630a
test modify ModelManagerTest for codacy only
aegis-bot Apr 13, 2020
b171106
codacy
aegis-bot Apr 13, 2020
d676d6c
test codacy
aegis-bot Apr 13, 2020
e048835
update ug and add shortcuts
teikjun Apr 13, 2020
6adf0b7
test codacy
aegis-bot Apr 13, 2020
7377e9f
test codacy
aegis-bot Apr 13, 2020
7578d27
newline at eof again
teikjun Apr 13, 2020
f011b0d
test codacy
aegis-bot Apr 13, 2020
afd2cc8
Merge pull request #292 from teikjun/shortcuts
aegis-bot Apr 13, 2020
0c9b7a2
test codacy
aegis-bot Apr 13, 2020
09963a7
test codacy
aegis-bot Apr 13, 2020
d9d752e
Merge https://github.com/AY1920S2-CS2103T-W16-3/main
aegis-bot Apr 13, 2020
b49d150
test codacy
aegis-bot Apr 13, 2020
5e9fc03
Merge pull request #291 from aegis-bot/master
teikjun Apr 13, 2020
85b2796
test codacy
aegis-bot Apr 13, 2020
0f905b5
fix dg mistakes
teikjun Apr 13, 2020
0af11b9
UG/DG changes
gx-huang Apr 13, 2020
0c18041
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
gx-huang Apr 13, 2020
f461b4f
codacy moduleList & AppUtilTest
aegis-bot Apr 13, 2020
2ed56ff
codacy AppUtilTest
aegis-bot Apr 13, 2020
36b38b2
codacy studyBuddy
aegis-bot Apr 13, 2020
4cb265f
codacy
aegis-bot Apr 13, 2020
7fc01f4
codacy modelmanager
aegis-bot Apr 13, 2020
86e925a
codacy
aegis-bot Apr 13, 2020
c01e278
codacy configUtilTest
aegis-bot Apr 13, 2020
bd7de6d
UG/DG changes
gx-huang Apr 13, 2020
c6c967b
codacy
aegis-bot Apr 13, 2020
1408500
codacy
aegis-bot Apr 13, 2020
d76eb13
Merge pull request #293 from aegis-bot/master
aegis-bot Apr 13, 2020
4c37685
Removed underscore in test classes
souwmyaa Apr 13, 2020
ce30e24
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
gx-huang Apr 13, 2020
9d2442e
Merge conflict fix
souwmyaa Apr 13, 2020
f8d7054
Merge pull request #294 from gx-huang/master
souwmyaa Apr 13, 2020
8815034
improve dg
teikjun Apr 13, 2020
c3ba388
Add porfolio to aboutus page
souwmyaa Apr 13, 2020
fd53772
Storage test
gx-huang Apr 13, 2020
e332d85
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
souwmyaa Apr 13, 2020
dc27f33
Bug fix
gx-huang Apr 13, 2020
9d4bdb4
Merge pull request #295 from souwmyaa/master
gx-huang Apr 13, 2020
8c71b01
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
gx-huang Apr 13, 2020
2d3eea7
DG and codacy
aegis-bot Apr 13, 2020
64c91c3
Added portfolio link
gx-huang Apr 13, 2020
9f9c604
Merge pull request #296 from gx-huang/master
gx-huang Apr 13, 2020
789b4ca
Merge pull request #297 from teikjun/dg
teikjun Apr 13, 2020
8385666
resize images
teikjun Apr 13, 2020
a0b71aa
codacy. removed underscore
aegis-bot Apr 13, 2020
f937d39
merged
aegis-bot Apr 13, 2020
3807a18
codacy
aegis-bot Apr 13, 2020
72fea11
Merge pull request #298 from aegis-bot/master
aegis-bot Apr 13, 2020
ab41630
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
souwmyaa Apr 13, 2020
f24de1f
Updated Use Cases
souwmyaa Apr 13, 2020
43ef62a
complete dg
teikjun Apr 13, 2020
d3cd6f5
complete dg
teikjun Apr 13, 2020
442491b
Merge pull request #299 from teikjun/dg
teikjun Apr 13, 2020
7492d22
UG
aegis-bot Apr 13, 2020
2385c73
ss
aegis-bot Apr 13, 2020
cc00003
Change release version and resized default GUI
gx-huang Apr 13, 2020
1a84450
Merge pull request #301 from gx-huang/master
gx-huang Apr 13, 2020
6611e4e
ppp
aegis-bot Apr 13, 2020
cd26c74
Merge pull request #302 from souwmyaa/master
souwmyaa Apr 13, 2020
110a0a9
ppp edits
aegis-bot Apr 13, 2020
cff6341
Merge pull request #300 from aegis-bot/master
aegis-bot Apr 13, 2020
c21dcfe
complete uml writeup
teikjun Apr 13, 2020
b6a422d
Small change
souwmyaa Apr 13, 2020
0120dac
update dg
teikjun Apr 13, 2020
cbd46d6
Merge pull request #304 from souwmyaa/master
souwmyaa Apr 13, 2020
eecf83f
Merge pull request #303 from teikjun/uml
teikjun Apr 13, 2020
c6700d7
rename ppp
aegis-bot Apr 13, 2020
d0b11bb
PPP update
wyt-sonia Apr 13, 2020
616a71b
Merge pull request #305 from aegis-bot/master
aegis-bot Apr 13, 2020
459e961
Merge branch 'master' into pr/53
wyt-sonia Apr 13, 2020
6611e5c
PPP update
wyt-sonia Apr 13, 2020
1e009be
PPP
wyt-sonia Apr 13, 2020
15e82e8
Merge pull request #306 from wyt-sonia/master
wyt-sonia Apr 13, 2020
6c9ca36
ppp
teikjun Apr 13, 2020
557c047
about us add portfolio for all
aegis-bot Apr 13, 2020
afd016e
Merge pull request #307 from teikjun/last
teikjun Apr 13, 2020
3441af0
Merge pull request #308 from aegis-bot/master
aegis-bot Apr 13, 2020
f20f731
up
wyt-sonia Apr 13, 2020
a031001
Merge pull request #53 from AY1920S2-CS2103T-W16-3/master
wyt-sonia Apr 13, 2020
18b62bd
Merge pull request #309 from wyt-sonia/master
wyt-sonia Apr 13, 2020
0790da1
DG merge conflict fix
souwmyaa Apr 15, 2020
77aa9b9
Improved Exit command message
souwmyaa Apr 15, 2020
fd9305f
Improve clear command message
souwmyaa Apr 10, 2020
bf462cc
bug fix
wyt-sonia Apr 28, 2020
9f03f6e
- javaDoc update
wyt-sonia Apr 10, 2020
a2b2866
Pic update
souwmyaa Apr 30, 2020
e4b4700
Adjusted pictures
souwmyaa Apr 30, 2020
6195e36
Pic improve
souwmyaa Apr 12, 2020
ddddb6f
Merge branch 'master' of https://github.com/AY1920S2-CS2103T-W16-3/main
souwmyaa May 12, 2020
e89284d
Bug fix
souwmyaa May 12, 2020
60421f0
Fix refresh tags
souwmyaa Apr 11, 2020
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
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
@@ -52,5 +52,5 @@ To browse more information, please check our site map:
http://code.makery.ch/library/javafx-8-tutorial/[Java FX tutorial] by _Marco Jakob_.
* Libraries used: https://openjfx.io/[JavaFX],
https://github.com/FasterXML/jackson[Jackson], https://github.com/junit-team/junit5[JUnit5]
* AddressBook-Level3 project created by SE-EDU initiative at https://se-education.org
* StudyBuddy-Level3 project created by SE-EDU initiative at https://se-education.org

208 changes: 116 additions & 92 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
@@ -85,15 +85,14 @@ This symbol indicates something to which we want to draw your attention.
==== Useful tips

* You may need to adjust the size of the Study Buddy window when you launch it.
* Make sure not to use any extra white spaces before or after commands. Study Buddy might consider it as an invalid command.
* The scroll bar on the right of the response box can be used to view the entire reply.
* At any point during the execution of a command, you can use `quit` to quit the command and start over/try a different command.
* Study Buddy will analyze your input and reply accordingly.
It utilizes an "interactive command prompt". (explained in each command's description under <<Features>>)
* In this document, *[enter]* indicates *hitting the enter key on your keyboard*.
* In this document, kbd:[enter] indicates *the enter key on your keyboard*.
* In this document, *|* indicates an *alternative option* (i.e. A | B implies A or B).
* A task's *index number*, refers to the number displayed on the left of a task in *All Tasks panel*. Note that the
index of the same task could be different after `filter`, `find` and `sort` commands.
index of the same task could be different after some commands, such as `filter`, `find` and `sort`.
//end::usefulTips[]

[[UI]]
@@ -157,7 +156,7 @@ Task Type Badges::
The *Interactive Prompt Box* can be found at the bottom of the user interface.

To interact with Study Buddy, you can enter the desired command in the box with the words `Please enter your command here...`
and press kbd:[Enter] to execute.
and press kbd:[enter] to execute.

The reply from Study Buddy will be displayed in the box above.

@@ -276,45 +275,45 @@ To `add`:
image::basic/add/add_module.png[width="600", title="Reponse to 'add', asks for module"]
+
. You can link this task with a module by entering its `MODULE CODE` | `INDEX NUMBER OF MODULE` here
, or you can press kbd:[enter] to skip. Here we use `1` (CS2101) as an example.
, or you can press kbd:[enter] to skip. Here we use "1" (CS2101) as an example.
. Study Buddy should respond with the module selected and the request of task name as:
+
image::basic/add/add_task_name.png[width="600", title="Asks for task's name"]
+
. Here we use `new task` as an example.
. Here we use "new task" as an example.
. Study Buddy should respond with the task name defined and the request of task type as:
+
image::basic/add/add_task_type.png[width="600", title="Asks for task's type"]
+
. Here we use `1` (Assignment) as an example.
. Here we use "1" (Assignment) as an example.
. Study Buddy should respond with the task type defined and the request of task's date time information as:
+
image::basic/add/add_date_time.png[width="600", title="Asks for task's date time"]
+
. Here we use `14:00 04/05/2020` as an example.
. Here we use "14:00 04/05/2020" as an example.
. Study Buddy should respond with the date time defined and the request of task's description as:
+
image::basic/add/add_desc.png[width="600", title="Asks for task's description"]
+
. Here we use `new task description` as an example.
. Here we use "new task description" as an example.
. Study Buddy should respond with the description defined and the request of task's weight as:
+
image::basic/add/add_weight.png[width="600", title="Asks for task's weight"]
+
. Here we use `10` as an example.
. Here we use "10" as an example.
. Study Buddy should respond with the weight defined and the request of the estimated number of hours needed as:
+
image::basic/add/add_time_cost.png[width="600", title="Asks for estimated number of hours needed"]
+
. Here we use `10` as an example.
. Here we use "10" as an example.
. Study Buddy should respond with the task details collected and the request of your confirmation to perform the command as:
+
image::basic/add/add_task_info_1.png[width="600", title="Asks for user conformation to add a new task"]
+
image::basic/add/add_task_info_2.png[width="600", title="Task details collected"]
+
. Now, by pressing kbd:[enter] the new task will be added into your Study Buddy.
. Study Buddy should respond as:
. Now, by pressing kbd:[enter] the new task will be added into your Study Buddy. Meanwhile, the *All Tasks panel* will
update accordingly.
+
image::basic/add/add_result.png[width="600", title="New task added"]

@@ -390,17 +389,17 @@ To `edit`:
+
image::basic/edit/edit_index.png[width="600", title="Reponse to 'edit'"]
+
. Type the index of the task you want to edit. here use `1` (Homework 1) as an example.
. Type the index of the task you want to edit. here use "1" (Homework 1) as an example.
. The Study Buddy should respond with:
+
image::basic/edit/edit_response_index.png[width="600", title="List of editable fields"]
+
. Type the index of the field you want to edit, here use `2` (task name) as an example.
. Type the index of the field you want to edit, here use "2" (task name) as an example.
. The Study Buddy should respond with:
+
image::basic/edit/edit_response_task_name.png[width="600", title="Asks for new task name"]
+
. Enter new task name, here use `Updated Task` as an example.
. Enter new task name, here use "Updated Task" as an example.
. The Study Buddy should respond as below with updated field.
+
image::basic/edit/edit_result.png[width="600", title="Task edited"]
@@ -540,7 +539,7 @@ To `archive`:
. Study Buddy should respond with:
+
image::basic/archive/archive_index.png[width="600", title="Response to 'archive'"]
. Type the index of the task you want to archive, here use `1` (Leadership Presentation) as an example.
. Type the index of the task you want to archive, here use "1" (Leadership Presentation) as an example.
. Study Buddy will ask for your confirmation before archive the target task.
+
image::basic/archive/archive_confirm.png[width="600", title="Asks for confirmation"]
@@ -794,27 +793,24 @@ Due soon list will never display finished tasks. eg: if you unarchive a complete
//end::dueSoon[]

=== Modules
The Modules tab is an easy way for students to organise their task, homework and deadlines into various modules.
The modules page organises your tasks into various modules.
By default (i.e, when there is no module created), the modules page shows the following:

image::module/module_1.png[width = "600", title = "`Modules` in the menu bar"]
. *Overview*. This tab shows all the modules you created.

By default, the Modules tab shows the following:

.. *Overview*. This tab shows all the modules you will be taking for this semester.

.. *No Module Allocated*. This tab shows the list of tasks that has not yet been allocated to any module. By default,
. *No Module Allocated*. This tab shows the list of tasks that has not yet been allocated to any module. By default,
all tasks will show up here if you have not allocated any tasks to the modules.
+
image::module/module_show.png[width = "600" title = "modules page"]

==== Navigation

. To navigate to the modules page, click on `Modules` in the menu bar.
Navigate to modules page::
. To navigate to the modules page, click on `Modules` -> `Show Modules` in the menu bar or press kbd:[F1] in your keyboard.
+
image::module/module_nav.png[width = "600" title="Modules dropdown menu"]

. Then click on `Show Modules`. The module page should show up.
+
image::module/module_show.png[width = "600" title = "Module page"]
image::module/modules_show_module.png[width = "600" title="Modules dropdown menu"]

Navigation in modules page::
. The clicking on the leftmost tab shows the `*Overview*` of all your modules. it displays the module's name and their code.
+
image::module/module_tab_1.png[width = "600" title = "Module tab `Overview`"]
@@ -828,106 +824,134 @@ image::module/module_tab_3.png[width = "600" title = "Module tab `No Module Allo
image::module/module_tab_2.png[width = "600" title = "Module tab available modules"]

==== Functions
==== Create Modules
===== Create Modules
[TIP]
Study Buddy provides tow approaches for user to execute `create module` and `edit module` actions.

To create a module, click on `Modules` in the menu bar.
To start the interaction of creating a module, click on `Modules`-> `Create` in the menu bar. +
Alternatively, you can key in `create mods` into the input line.

image::module/module_nav_create.png[width = "600", title = "Click on `Create`"]
image::module/module_nav_create.png[width = "600", title = "Entry of module creation"]

Click on `Create`. A prompt will show up at the bottom of the screen.

image::module/module_create_name.png[width = "600", title = "Asks for module name"]
====
*Constraints*
Key in the name of your module.The name of this module cannot be the same as your existing modules.
Here we use "New Module" as an example. +
Then Study Buddy will ask for the module code.
. *Module Name* +
The name of this module cannot be the same as any existing modules.
image::module/module_create_code.png[width = "600", title = "Asks for module code"]

Now key in your Module code. Your Module code should have a 2-3 letter prefix, a 4-digit number, followed
. *Module Code Format* +
.. The module code also need to be unique. +
.. The module code should have a 2-3 letter prefix, a 4-digit number, followed
by a single postfix.
====
Correct Module Codes::
* LSM1303
* CS2040C
* IS1103
* MA1521
Incorrect Module Codes::
* CSSS1234 - Prefix is too long
* C0001 - Prefix is too short
* ZZ12345 - number is more than 4 digits
* A1111XX - Postfix is too long
* *Correct Module Code Examples* +
LSM1303 +
CS2040C +
IS1103 +
MA1521
* *Incorrect Module Code Examples* +
CSSS1234 - Prefix is too long +
C0001 - Prefix is too short +
ZZ12345 - number is more than 4 digits +
A1111XX - Postfix is too long
====

Here we use "CSS1234" as an example.

image::module/module_create_confirm.png[width = "600" title = "Asks for confirmation"]
To `Create Module`:

. Click on `Module` -> `Create` or key in `create mods`. A prompt will show up at the bottom of the screen.
+
image::module/module_create_name.png[width = "600", title = "Asks for module name"]

Press kbd:[enter] one more time to confirm.
. Key in the name of your module.Here we use "New Module" as an example.
Then Study Buddy will ask for the module code.
+
image::module/module_create_code.png[width = "600", title = "Asks for module code"]
+
. Here we use "CSS1234" as an example.
+
image::module/module_create_confirm.png[width = "600" title = "Asks for confirmation"]

. Press kbd:[enter] to confirm, and the module page will update accordingly.
+
image::module/module_create_result.png[width = "600", title= "New Module with code CSS1234 created."]

Congratulations, you have added a module to your modules page!


==== Edit Modules

. To create a module, click on `Modules` in the menu bar.
To start the interaction of editing a module, click on `Modules`-> `Edit` in the menu bar. +
Alternatively, you can key in `edit mods` into the input line.
+
image::module/module_12.png[width = "500"]

. Click on `Edit`. A prompt will show up at the bottom of the screen.

. Key in the code of the module that you want to edit.
+
image::module/module_13.png[width = "790", title = "Changing module with code BA1001""]
+
image::module/module_14.png[width = "790", title = "Keyed in BA1001"]
+
image::module/module_15.png[width = "790", title = "Key in 1, 2 or 3 depending on which option you prefer"]
image::module/module_nav_edit.png[width = "600" title = "Entry of module edition"]

. Now you have 3 options. You can choose to:
Study Buddy provides three module edition options.

.. Change Module name.
.. Change Module code.
.. Delete Module.
Edit options::
* Change Module name.
* Change Module code.
* Delete Module.

. Key in the index of your option.
====
*Constraints:*
===== a) Change Module Name
. When choosing the module to edit, you need to provide a valid and existed module code.
. When entering the value of new module name or new module code, you need to provide a different valid value.
. The above "valid" judgment follows the same constraints as <<Create Modules>>.
====

image::module/module_16.png[width = "790"]
To `Edit Module`:

. Now key in your new module name.
. Click on `Module` -> `Edit` key in edit mods.
A prompt will show up to ask the module code of target module.
+
image::module/module_17.png[width = "790", title = "Module BA1001's name has changed from 'CS' to 'New Module Name'"]

. Module name changed!
image::module/module_edit_code.png[width = "600", title = "Asks for module mode"]

===== b) Change Module Code
. Key in the code of the module that you want to edit. Here we use "CSS1234" as an example.
Then Study Buddy will ask for the edit option.
+
image::module/module_edit_option.png[width = "600", title = "Asks for edit option"]

image::module/module_18.png[width = "790"]
. Key in the index of your option.

. Now key in your new module code. Make sure it follows the correct format
as written in 3.7.3.
.. "1" -> Change Module Name
+
image::module/module_19.png[width = "790", title = "Module code BA1001 has changed to CS3230"]

. Module code changed!
Key in your new module name and press kbd:[enter] to confirm the edition. Here we use "Edited Module Name" as an example. +
The module page will update accordingly.
+
image::module/module_edit_name_result.png[width = "600", title = "Module name edition result"]

===== c) Delete Module
.. "2" -> Change Module Code
+
Key in your new module code and press kbd:[enter] to confirm the edition. Here we use "LY3000" as an example. +
The module page will update accordingly.
+
image::module/module_edit_code_result.png[width = "600", title = "Module code edition result"]
+
Module code changed!

image::module/module_20.png[width = "790"]
.. "3" -> Delete Module
+
[CAUTION]
After successfully deleting a module, the related tasks will also be affected.
+
To delete the chosen module, you only need to press kbd:[enter] to confirmed the deletion.
To better showcase the behaviour of deletion, here we use "CS2103T" as an example.

. Press kbd:[enter] again to confirmed.
... Before delete:
+
image::module/module_21.png[width = "790", title = 'deleted BA1001']
image::module/module_delete_before.png[width = "600", title = 'Before delete']

. Module deleted! All existing task in this module will be moved to `No Module Allocated` tab.
... After delete: +
After successfully deleted target module, the module page will update accordingly and switch to
`Overview` page.
+
If you switch to `No Module Allocated` tab, you'll find the tasks affected by this deletion (i.e.
The tasks which belong to the deleted module).
+
image::module/module_delete_after.png[width = "600", title = 'Checking the affected tasks']

=== Statistics

Binary file modified docs/images/module/module_create_code.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/module/module_create_confirm.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/module/module_create_name.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/module/module_create_result.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 added docs/images/module/module_delete_after.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 added docs/images/module/module_delete_before.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 added docs/images/module/module_edit_code.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 added docs/images/module/module_edit_code_result.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 added docs/images/module/module_edit_name_result.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 added docs/images/module/module_edit_option.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 added docs/images/module/module_main_nav.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/module/module_nav_create.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 added docs/images/module/module_nav_edit.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 added docs/images/module/modules_show_module.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 docs/team/souwmyaa.adoc
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ The codebase is in Java and contains about 13kLoc.
** Highlights:
. This feature was quite difficult to implement because there are several corner cases to take care of.
. It required working on other commands, such as edit command (to stop user from editing a task to be a duplicate) and unarchive command (because user can unarchive a duplicate task).
. Since address book already had a lot of tests and checks to prevent duplicate tasks, it required a very large amount of refactoring code.
. Since study buddy already had a lot of tests and checks to prevent duplicate tasks, it required a very large amount of refactoring code.

* *Major enhancement*: added *the Delete Task command*
** What it does:
Original file line number Diff line number Diff line change
@@ -7,14 +7,14 @@
import draganddrop.studybuddy.logic.commands.exceptions.CommandException;
import draganddrop.studybuddy.model.Model;
import draganddrop.studybuddy.model.module.Module;
import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.ui.interactiveprompt.InteractivePromptTerms;

/**
* Command for editing mod.
*/
public class EditModCommand extends Command {
static final String MOD_DOES_NOT_EXIST = "Module does not exist in Study Buddy!";
public static final String MOD_DOES_NOT_EXIST = "Module does not exist in Study Buddy!";
private Module oldModule;
private Module newModule;
private InteractivePromptTerms term;
@@ -47,7 +47,7 @@ public CommandResult execute(Model model) throws CommandException {
default:
return new CommandResult("Did nothing! from EditModCommand.");
}
} catch (ModuleCodeException ex) {
} catch (ModuleException ex) {
throw new CommandException(ex.getMessage());
}
}
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
import draganddrop.studybuddy.logic.commands.exceptions.CommandException;
import draganddrop.studybuddy.model.Model;
import draganddrop.studybuddy.model.module.Module;
import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.model.task.Task;
import draganddrop.studybuddy.model.task.TaskField;
import draganddrop.studybuddy.model.task.TaskType;
@@ -109,7 +109,7 @@ public CommandResult execute(Model model) throws DuplicateTaskException, Command
requireNonNull(newModule);
try {
model.setTaskMod(taskToEdit, newModule);
} catch (ModuleCodeException ex) {
} catch (ModuleException ex) {
throw new CommandException("module code invalid/does not exist!!!");
}
break;
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ public CommandResult execute(Model model) {
for (int i = 0; i < lastShownList.size(); i++) {
Task task = lastShownList.get(i);
if (task.isDueSoon()) {
task.isDueSoon();
model.forceAddDueSoonTask(task);
}
refreshStatus(task, model);
Original file line number Diff line number Diff line change
@@ -5,9 +5,11 @@
*/
public class CompleteTaskCommandException extends InteractiveCommandException {

/*
*Pending
* */
/**
* Creates a CompleteTaskCommandException.
*
* @param errorType
*/
public CompleteTaskCommandException(String errorType) {
super(errorType);
}
Original file line number Diff line number Diff line change
@@ -5,9 +5,11 @@
*/
public class DeleteDuplicateTaskCommandException extends InteractiveCommandException {

/*
*Pending
* */
/**
* Creates a DeleteDuplicateTaskCommandException.
*
* @param errorType
*/
public DeleteDuplicateTaskCommandException(String errorType) {
super(errorType);
}
Original file line number Diff line number Diff line change
@@ -5,9 +5,11 @@
*/
public class DeleteTaskCommandException extends InteractiveCommandException {

/*
*Pending
* */
/**
* Creates a DeleteTaskCommandException.
*
* @param errorType
*/
public DeleteTaskCommandException(String errorType) {
super(errorType);
}
Original file line number Diff line number Diff line change
@@ -5,9 +5,11 @@
*/
public class DueSoonRefreshCommandException extends InteractiveCommandException {

/*
*Pending
* */
/**
* Creates a DueSoonRefreshCommandException.
*
* @param errorType
*/
public DueSoonRefreshCommandException(String errorType) {
super(errorType);
}
Original file line number Diff line number Diff line change
@@ -5,9 +5,11 @@
*/
public class EditTaskCommandException extends InteractiveCommandException {

/*
*Pending
* */
/**
* Creates an EditTaskCommandException.
*
* @param errorType
*/
public EditTaskCommandException(String errorType) {
super(errorType);
}
Original file line number Diff line number Diff line change
@@ -5,9 +5,11 @@
*/
public class ExitTaskCommandException extends InteractiveCommandException {

/*
*Pending
* */
/**
* Creates an ExitTaskCommandException.
*
* @param errorType
*/
public ExitTaskCommandException(String errorType) {
super(errorType);
}
Original file line number Diff line number Diff line change
@@ -5,9 +5,11 @@
*/
public class FilterTaskCommandException extends InteractiveCommandException {

/*
*Pending
* */
/**
* Creates a FilterTaskCommandException.
*
* @param errorType
*/
public FilterTaskCommandException(String errorType) {
super(errorType);
}
Original file line number Diff line number Diff line change
@@ -59,6 +59,31 @@ public InteractiveCommandException(String errorType) {
errorMessage = "Could not find the module based on the module code entered, please check and re-enter.";
break;

case "duplicateModuleNameError":
errorMessage = "Detected duplicate module name. Please key in another module name.";
break;

case "duplicateModuleCodeError":
errorMessage = "Detected duplicate module code. Please key in another module code.";
break;

case "wrongModuleCodeFormatError":
errorMessage = "Invalid module code. Please key in module in the correct format. \n\n"
+ " Module code format:\n"
+ " include a 2-3 letter prefix,"
+ " a 4-digit number,"
+ " then a postfix (Optional).\n"
+ " E.g. BA1001, CS2030J, LSM2040C";
break;

case "noChangeFromOriginalModuleNameError":
errorMessage = "Please enter a different module name.";
break;

case "noChangeFromOriginalModuleCodeError":
errorMessage = "Please enter a different module code.";
break;

case "invalidIndexRangeError":
errorMessage = "The index entered is out of range, please check again.";
break;
10 changes: 5 additions & 5 deletions src/main/java/draganddrop/studybuddy/model/Model.java
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@

import draganddrop.studybuddy.commons.core.GuiSettings;
import draganddrop.studybuddy.model.module.Module;
import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.model.task.Task;
import draganddrop.studybuddy.model.task.TaskType;

@@ -128,7 +128,7 @@ public interface Model {
*/
void setTaskDateTime(Task target, LocalDateTime[] newDateTimes);

void setTaskMod(Task target, Module mod) throws ModuleCodeException;
void setTaskMod(Task target, Module mod) throws ModuleException;

/**
* Deletes the given task.
@@ -170,11 +170,11 @@ public interface Model {

void addMod(Module mod);

void changeModName(Module oldMod, Module newMod) throws ModuleCodeException;
void changeModName(Module oldMod, Module newMod) throws ModuleException;

void changeModCode(Module oldMod, Module newMod) throws ModuleCodeException;
void changeModCode(Module oldMod, Module newMod) throws ModuleException;

void deleteMod(Module mod) throws ModuleCodeException;
void deleteMod(Module mod) throws ModuleException;

/**
* Returns an unmodifiable view of the filtered task list
10 changes: 5 additions & 5 deletions src/main/java/draganddrop/studybuddy/model/ModelManager.java
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
import draganddrop.studybuddy.commons.core.LogsCenter;
import draganddrop.studybuddy.commons.util.CollectionUtil;
import draganddrop.studybuddy.model.module.Module;
import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.model.task.Task;
import draganddrop.studybuddy.model.task.TaskType;

@@ -148,7 +148,7 @@ public void setTaskDateTime(Task target, LocalDateTime[] newTaskDateTime) {
}

@Override
public void setTaskMod(Task target, Module mod) throws ModuleCodeException {
public void setTaskMod(Task target, Module mod) throws ModuleException {
studyBuddy.setModuleInTask(target, mod);
}

@@ -244,17 +244,17 @@ public void addMod(Module mod) {
}

@Override
public void changeModName(Module oldMod, Module newMod) throws ModuleCodeException {
public void changeModName(Module oldMod, Module newMod) throws ModuleException {
studyBuddy.changeModuleName(oldMod, newMod);
}

@Override
public void changeModCode(Module oldMod, Module newMod) throws ModuleCodeException {
public void changeModCode(Module oldMod, Module newMod) throws ModuleException {
studyBuddy.changeModuleCode(oldMod, newMod);
}

@Override
public void deleteMod(Module mod) throws ModuleCodeException {
public void deleteMod(Module mod) throws ModuleException {
studyBuddy.deleteMod(mod);
}

20 changes: 10 additions & 10 deletions src/main/java/draganddrop/studybuddy/model/StudyBuddy.java
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
import draganddrop.studybuddy.model.module.EmptyModule;
import draganddrop.studybuddy.model.module.Module;
import draganddrop.studybuddy.model.module.ModuleList;
import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.model.statistics.CompletionStats;
import draganddrop.studybuddy.model.statistics.GeneralStats;
import draganddrop.studybuddy.model.statistics.OverdueStats;
@@ -252,7 +252,7 @@ public void unarchiveDuplicateTask(Task p) {
public void addModule(Module module) {
try {
moduleList.add(module);
} catch (ModuleCodeException ex) {
} catch (ModuleException ex) {
System.out.println("AddModule Failed, from studyBuddy.addModule()");
}
}
@@ -261,9 +261,9 @@ public void addModule(Module module) {
* Change Module Name.
* @param oldModule
* @param newModule
* @throws ModuleCodeException
* @throws ModuleException
*/
public void changeModuleName(Module oldModule, Module newModule) throws ModuleCodeException {
public void changeModuleName(Module oldModule, Module newModule) throws ModuleException {
refreshAllModuleTaskList(oldModule, newModule);
moduleList.changeModuleName(oldModule, newModule);
}
@@ -272,19 +272,19 @@ public void changeModuleName(Module oldModule, Module newModule) throws ModuleCo
* Change Module Code.
* @param oldModule
* @param newModule
* @throws ModuleCodeException
* @throws ModuleException
*/
public void changeModuleCode(Module oldModule, Module newModule) throws ModuleCodeException {
public void changeModuleCode(Module oldModule, Module newModule) throws ModuleException {
refreshAllModuleTaskList(oldModule, newModule);
moduleList.changeModuleCode(oldModule, newModule);
}

/**
* Delete a existing mod. Transfers all task with the existing mod to emptyMod.
* @param module
* @throws ModuleCodeException
* @throws ModuleException
*/
public void deleteMod(Module module) throws ModuleCodeException {
public void deleteMod(Module module) throws ModuleException {
refreshAllModuleTaskList(module, new EmptyModule());
moduleList.remove(module);
}
@@ -365,11 +365,11 @@ public void updateAddDueSoon(Task target) {
}
}

public void setModuleInTask(Task target, Module module) throws ModuleCodeException {
public void setModuleInTask(Task target, Module module) throws ModuleException {
if (moduleList.contains(module) || module.equals(new EmptyModule())) {
tasks.setTaskMod(target, module);
} else {
throw new ModuleCodeException("Module does not exist in studyBuddy!");
throw new ModuleException("Module does not exist in studyBuddy!");
}
}

14 changes: 7 additions & 7 deletions src/main/java/draganddrop/studybuddy/model/module/Module.java
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

import static java.util.Objects.requireNonNull;

import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.model.task.Task;
import draganddrop.studybuddy.model.task.exceptions.DuplicateTaskException;
import draganddrop.studybuddy.model.task.exceptions.TaskNotFoundException;
@@ -23,13 +23,13 @@ public class Module {
*
* @param moduleName
* @param fullModuleCode
* @throws ModuleCodeException
* @throws ModuleException
*/
public Module(String moduleName, String fullModuleCode) {
this.moduleName = moduleName;
try {
this.moduleCode = new ModuleCode(fullModuleCode);
} catch (ModuleCodeException e) {
} catch (ModuleException e) {
System.out.println("ModuleCode is invalid!");
}
}
@@ -38,9 +38,9 @@ public Module(String moduleName, String fullModuleCode) {
* Same as previous constructor, but a module without a name.
*
* @param fullModuleCode
* @throws ModuleCodeException
* @throws ModuleException
*/
public Module(String fullModuleCode) throws ModuleCodeException {
public Module(String fullModuleCode) throws ModuleException {
this.moduleName = "";
this.moduleCode = new ModuleCode(fullModuleCode);
}
@@ -49,7 +49,7 @@ public Module() {
this.moduleName = "";
try {
this.moduleCode = new ModuleCode("OO0000O");
} catch (ModuleCodeException e) {
} catch (ModuleException e) {
System.out.println("from Module(). ModuleCode is invalid!");
}
}
@@ -136,7 +136,7 @@ public ModuleCode getModuleCode() {
return moduleCode;
}

public void setModuleCode(String moduleCode) throws ModuleCodeException {
public void setModuleCode(String moduleCode) throws ModuleException {
this.moduleCode = new ModuleCode(moduleCode);
}

24 changes: 12 additions & 12 deletions src/main/java/draganddrop/studybuddy/model/module/ModuleCode.java
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

import java.util.stream.IntStream;

import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
/**
* ModuleCode. Ensures that the module code keyed in matches the proper format. XX0000.
*/
@@ -11,9 +11,9 @@ public class ModuleCode {
private int number;
private String postfix;

public ModuleCode(String fullModuleCode) throws ModuleCodeException {
public ModuleCode(String fullModuleCode) throws ModuleException {
if (fullModuleCode.length() > 8) {
throw new ModuleCodeException("The module code should be at most 8 digits, please check.");
throw new ModuleException("wrongModuleCodeFormatError");
}
this.prefix = parsePrefix(fullModuleCode);
this.number = parseNumber(fullModuleCode);
@@ -32,7 +32,7 @@ public static boolean isModuleCode(String userInput) {
parsePrefix(userInput);
parseNumber(userInput);
parsePostfix(userInput);
} catch (ModuleCodeException e) {
} catch (ModuleException e) {
result = false;
}
return result;
@@ -43,15 +43,15 @@ public static boolean isModuleCode(String userInput) {
*
* @param input
* @return
* @throws ModuleCodeException
* @throws ModuleException
*/
private static String parsePrefix(String input) throws ModuleCodeException {
private static String parsePrefix(String input) throws ModuleException {
StringBuilder builder = new StringBuilder();
IntStream.range(0, input.toCharArray().length)
.mapToObj(i -> input.toCharArray()[i]).takeWhile(x -> Character.isAlphabetic(x))
.forEach(x -> builder.append(x));
if (builder.toString().length() < 2 || builder.toString().length() > 3) {
throw new ModuleCodeException("Please enter a valid module code.");
throw new ModuleException("wrongModuleCodeFormatError");
} else {
return builder.toString().toUpperCase();
}
@@ -62,17 +62,17 @@ private static String parsePrefix(String input) throws ModuleCodeException {
*
* @param input
* @return
* @throws ModuleCodeException
* @throws ModuleException
*/
private static int parseNumber(String input) throws ModuleCodeException {
private static int parseNumber(String input) throws ModuleException {
StringBuilder builder = new StringBuilder();
IntStream.range(0, input.toCharArray().length)
.mapToObj(i -> input.toCharArray()[i]).filter(x -> Character.isDigit(x))
.forEach(x -> builder.append(x));
if (builder.toString().length() == 4) {
return Integer.parseInt(builder.toString());
} else {
throw new ModuleCodeException("Please enter a valid module code.");
throw new ModuleException("wrongModuleCodeFormatError.");
}
}

@@ -82,15 +82,15 @@ private static int parseNumber(String input) throws ModuleCodeException {
* @param input
* @return
*/
private static String parsePostfix(String input) throws ModuleCodeException {
private static String parsePostfix(String input) throws ModuleException {
StringBuilder builder = new StringBuilder();
IntStream.range(0, input.toCharArray().length)
.mapToObj(i -> input.toCharArray()[i]).dropWhile(x -> Character.isAlphabetic(x))
.dropWhile(x -> Character.isDigit(x)).forEach(x -> builder.append(x));
if (builder.toString().length() < 2) {
return builder.toString();
} else {
throw new ModuleCodeException("Please enter a valid module code.");
throw new ModuleException("wrongModuleCodeFormatError");
}


36 changes: 18 additions & 18 deletions src/main/java/draganddrop/studybuddy/model/module/ModuleList.java
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

import java.util.List;

import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@@ -53,11 +53,11 @@ public ObservableList<Module> getInternalList() {
* Moves Empty module to the back of the internalList.
* @param module to be added to the ModuleList
*/
public void add(Module module) throws ModuleCodeException {
public void add(Module module) throws ModuleException {
if (this.contains(module)) {
throw new ModuleCodeException("Duplicate modules");
throw new ModuleException("Duplicate modules");
} else if (this.containsDuplicateName(module.getModuleName())) {
throw new ModuleCodeException("Duplicate module name");
throw new ModuleException("Duplicate module name");
} else {
internalList.add(module);
shiftEmptyModBack();
@@ -95,32 +95,32 @@ private void swap(int i, int j) {
* Removes module from the list.
*
* @param module
* @throws ModuleCodeException
* @throws ModuleException
*/
public void remove(Module module) throws ModuleCodeException {
public void remove(Module module) throws ModuleException {
if (this.contains(module)) {
internalList.remove(module);
} else {
throw new ModuleCodeException("Module does not exist");
throw new ModuleException("Module does not exist");
}
}

/**
* Changes moduleName of a certain mod. Checks for existence of origin mod & duplicity of new name.
* @param oldModule
* @param newModule
* @throws ModuleCodeException
* @throws ModuleException
*/
public void changeModuleName(Module oldModule, Module newModule) throws ModuleCodeException {
public void changeModuleName(Module oldModule, Module newModule) throws ModuleException {
if (this.contains(oldModule) && !this.containsDuplicateName(newModule.getModuleName())) {
int oldIndex = internalList.indexOf(oldModule);
internalList.set(oldIndex, newModule);
} else {
if (!this.contains(oldModule)) {
throw new ModuleCodeException("Module does not exist");
throw new ModuleException("Module does not exist");
}
if (this.containsDuplicateName(newModule.getModuleName())) {
throw new ModuleCodeException("A duplicate module name already exist.");
throw new ModuleException("A duplicate module name already exist.");
}
}
}
@@ -129,11 +129,11 @@ public void changeModuleName(Module oldModule, Module newModule) throws ModuleCo
* Changes moduleCode of a certain mod. Checks for existence of origin mod & duplicity of new code.
* @param oldModule
* @param newModule
* @throws ModuleCodeException
* @throws ModuleException
*/
public void changeModuleCode(Module oldModule, Module newModule) throws ModuleCodeException {
public void changeModuleCode(Module oldModule, Module newModule) throws ModuleException {
if (this.contains(newModule)) {
throw new ModuleCodeException("new module code is a duplicate!");
throw new ModuleException("new module code is a duplicate!");
} else if (this.contains(oldModule)) {
if (!newModule.equals(new EmptyModule())) {
newModule.setInternalTaskList(oldModule.getInternalTaskList());
@@ -145,7 +145,7 @@ public void changeModuleCode(Module oldModule, Module newModule) throws ModuleCo
int index = this.indexOf(oldModule);
internalList.set(index, newModule);
} else {
throw new ModuleCodeException("module does not exist");
throw new ModuleException("module does not exist");
}
}

@@ -154,16 +154,16 @@ public void changeModuleCode(Module oldModule, Module newModule) throws ModuleCo
*
* @param moduleCode
* @return
* @throws ModuleCodeException
* @throws ModuleException
*/

public Module get(String moduleCode) throws ModuleCodeException {
public Module get(String moduleCode) throws ModuleException {
Module moduleToFind = new Module(moduleCode);
if (this.contains(moduleToFind)) {
int index = this.internalList.indexOf(moduleToFind);
return this.internalList.get(index);
} else {
throw new ModuleCodeException("Module Not Found");
throw new ModuleException("Module Not Found");
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package draganddrop.studybuddy.model.module.exceptions;

import draganddrop.studybuddy.logic.parser.interactivecommandparser.exceptions.InteractiveCommandException;

/**
* Exception for module code
*/
public class ModuleException extends InteractiveCommandException {
public ModuleException(String message) {
super(message);
}
}

2 changes: 0 additions & 2 deletions src/main/java/draganddrop/studybuddy/model/task/Task.java
Original file line number Diff line number Diff line change
@@ -345,7 +345,6 @@ public int hashCode() {
}

/**
* Pending change
* Returns true if both persons have the same identity and data fields.
* This defines a stronger notion of equality between two tasks.
*/
@@ -383,7 +382,6 @@ public String toString() {
}

/**
* Pending change
* Returns true if both task of the same name have at least one other identity field that is the same.
* This defines a weaker notion of equality between two tasks.
*/
8 changes: 4 additions & 4 deletions src/main/java/draganddrop/studybuddy/ui/MainWindow.java
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
import draganddrop.studybuddy.ui.box.CommandBox;
import draganddrop.studybuddy.ui.interactiveprompt.InteractivePrompt;
import draganddrop.studybuddy.ui.interactiveprompt.add.CreateModuleInteractivePrompt;
import draganddrop.studybuddy.ui.interactiveprompt.edit.EditModInteractivePrompt;
import draganddrop.studybuddy.ui.interactiveprompt.edit.EditModuleInteractivePrompt;
import draganddrop.studybuddy.ui.panel.DueSoonListPanel;
import draganddrop.studybuddy.ui.panel.ModuleListPanel;
import draganddrop.studybuddy.ui.panel.TaskListPanel;
@@ -401,13 +401,13 @@ private void handleCreateMod() {
}

/**
* on clicked: leads to EditModInteractivePrompt.
* on clicked: leads to EditModuleInteractivePrompt.
*/
@FXML
private void handleEditMod() {
logger.fine(FXML + " : Start to handling edit Mod InteractivePrompt.");
handleShowModules();
commandBox.run(new EditModInteractivePrompt());
commandBox.run(new EditModuleInteractivePrompt());
commandBox.handleCommandEntered();
logger.fine(FXML + " : End of handling edit Mod InteractivePrompt.");
}
@@ -452,7 +452,7 @@ public CalendarBox getCalendarBox() {
private CommandResult executeCommand(InteractivePrompt currentInteractivePrompt, String commandText) {
logger.fine(FXML + " : Start to handle command execution.");
currentInteractivePrompt.setLogic(logic);
String reply = currentInteractivePrompt.interact(commandText);
String reply = currentInteractivePrompt.interact(commandText.trim());
resultDisplay.setFeedbackToUser(reply);
if (currentInteractivePrompt.isQuit()) {
handleExit();
6 changes: 3 additions & 3 deletions src/main/java/draganddrop/studybuddy/ui/box/CommandBox.java
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
import draganddrop.studybuddy.ui.interactiveprompt.delete.DeleteTaskInteractivePrompt;
import draganddrop.studybuddy.ui.interactiveprompt.edit.ArchiveTaskInteractivePrompt;
import draganddrop.studybuddy.ui.interactiveprompt.edit.CompleteTaskInteractivePrompt;
import draganddrop.studybuddy.ui.interactiveprompt.edit.EditModInteractivePrompt;
import draganddrop.studybuddy.ui.interactiveprompt.edit.EditModuleInteractivePrompt;
import draganddrop.studybuddy.ui.interactiveprompt.edit.EditTaskInteractivePrompt;
import draganddrop.studybuddy.ui.interactiveprompt.edit.SetGoalInteractivePrompt;
import draganddrop.studybuddy.ui.interactiveprompt.edit.UnarchiveTaskInteractivePrompt;
@@ -42,7 +42,7 @@ public class CommandBox extends UiPart<Region> {
private static final String[] interactiveCommandTypes =
{"add", "edit", "delete", "archive", "done", "view renamed",
"clear", "bye", "sort", "refresh", "help",
"filter", "create mods", "find", "list", "unarchive", "goal", "calendar"};
"filter", "create mods", "edit mods", "find", "list", "unarchive", "goal", "calendar"};
private final CommandExecutor commandExecutor;
private InteractivePrompt currentInteractivePrompt;
@FXML
@@ -119,7 +119,7 @@ public void handleCommandEntered() {
currentInteractivePrompt = new CreateModuleInteractivePrompt();
break;
case "edit mods":
currentInteractivePrompt = new EditModInteractivePrompt();
currentInteractivePrompt = new EditModuleInteractivePrompt();
break;
//mod related functions will not be shown on UI but available as shortcut
case "goal":
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ public boolean isQuit() {
* @return true if the userInput is quit or back, false otherwise
*/
public boolean isQuit(String userInput) {
return "quit".equals(userInput);
return "quit".equalsIgnoreCase(userInput);
}

public void setQuit(boolean quit) {
@@ -76,7 +76,7 @@ public InteractivePromptType getInteractivePromptType() {
* @return the reply to user
*/
public String handleQuit(String userInput, String quitMessage) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(quitMessage);
}
return reply;
Original file line number Diff line number Diff line change
@@ -8,8 +8,9 @@
*/
public class InvalidInputInteractivePrompt extends InteractivePrompt {
static final String HELP_MSG = "Please enter a valid command option.\n"
+ "1. add\n2. delete\n3. edit\n4. bye\n5. sort\n6. find\n7. done\n8. view renamed\n"
+ "9. sort\n10. archive\n11. help\n12. list\n13. clear";
+ "1. add\n2. archive\n3. bye\n4. clear\n5. create mods\n6. delete\n"
+ "7. view renamed\n8. done\n9. edit\n10. filter\n11. find\n"
+ "12. help\n13. list\n14. sort\n15. refresh\n\n";

private InteractivePromptTerms currentTerm;
private String reply;
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ public AddTaskInteractivePrompt() {

@Override
public String interact(String userInput) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
import draganddrop.studybuddy.logic.commands.add.CreateModCommand;
import draganddrop.studybuddy.logic.commands.exceptions.CommandException;
import draganddrop.studybuddy.model.module.Module;
import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.ui.interactiveprompt.InteractivePrompt;
import draganddrop.studybuddy.ui.interactiveprompt.InteractivePromptTerms;
import draganddrop.studybuddy.ui.interactiveprompt.InteractivePromptType;
@@ -16,10 +16,15 @@
*/
public class CreateModuleInteractivePrompt extends InteractivePrompt {
public static final String MODULE_CODE_FORMAT = "Please key in your module code to include a 2-3 letter prefix,"
+ " a 4-digit number,"
+ "then a postfix (Optional).\n"
+ "E.g. BA1001\n CS2030J \n LSM2040C";
static final String QUIT_COMMAND_MSG = "Successfully quited from create mod command.";
+ " a 4-digit number,"
+ "then a postfix (Optional).\n"
+ "E.g. BA1001\n CS2030J \n LSM2040C";
public static final String QUIT_COMMAND_MSG = "Successfully quited from create mod command.";
public static final String SUCCESS_COMMAND_MSG = "Module created!\n\nKey in your next command :)";
public static final String REQUIRED_MODULE_NAME_MSG = "Please key in the name of "
+ "the module that you want to create";
public static final String REQUIRED_MODULE_CODE_MSG = "Please key in the module code of the module "
+ "that you want to create";

private Module module;

@@ -31,53 +36,60 @@ public CreateModuleInteractivePrompt() {

@Override
public String interact(String userInput) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}

switch (currentTerm) {

case INIT:
this.reply = "Please key in the name of the module that you want to create";
this.reply = REQUIRED_MODULE_NAME_MSG;
currentTerm = InteractivePromptTerms.MODULE_NAME;
break;
case MODULE_NAME:
/*if (!logic.getFilteredModuleList().filtered(x -> x.getModuleName().equals(userInput)).isEmpty()) {
reply = "Detected Duplicate Module name. Please key in another module name.";
} else*/

if (userInput.equals("")) {
reply = "Please key in something as your module name";
} else {
this.reply = "The name of module is set to: " + userInput + ".\n"
+ "Now key in your module code";
module.setModuleName(userInput);


currentTerm = InteractivePromptTerms.MODULE_CODE;
try {
if (userInput.isBlank()) {
throw new ModuleException("emptyInputError");
} else {
if (!logic.getFilteredModuleList()
.filtered(x -> x.getModuleName().equalsIgnoreCase(userInput)).isEmpty()) {
throw new ModuleException("duplicateModuleNameError");
} else {
this.reply = "The name of new module is set to: " + userInput + ".\n\n"
+ REQUIRED_MODULE_CODE_MSG;
module.setModuleName(userInput);
currentTerm = InteractivePromptTerms.MODULE_CODE;
}
}
} catch (ModuleException ex) {
reply = ex.getErrorMessage() + "\n\n" + REQUIRED_MODULE_NAME_MSG;
}
break;
case MODULE_CODE:
//if (!logic.getFilteredModuleList().filtered(x -> x.toString()
// .equals(userInput.toUpperCase())).isEmpty()) {
// reply = "Detected Duplicate Module code. Please key in another module code.";
// } else {
try {
module.setModuleCode(userInput);
this.reply = "Module Code: " + module.toString() + "\n"
+ "Click 'Enter' again to confirm your changes";
currentTerm = InteractivePromptTerms.READY_TO_EXECUTE;
} catch (ModuleCodeException ex) {
reply = MODULE_CODE_FORMAT;
if (userInput.isBlank()) {
throw new ModuleException("emptyInputError");
} else {
if (!logic.getFilteredModuleList().filtered(x -> x.toString()
.equalsIgnoreCase(userInput)).isEmpty()) {
throw new ModuleException("duplicateModuleCodeError");
} else {
module.setModuleCode(userInput);
this.reply = "The module code of new module is set to: " + module.toString() + "\n\n"
+ "Please press enter to confirm your changes";
currentTerm = InteractivePromptTerms.READY_TO_EXECUTE;
}
}
} catch (ModuleException ex) {
reply = ex.getErrorMessage() + "\n\n" + REQUIRED_MODULE_CODE_MSG;
}
//}
break;
case READY_TO_EXECUTE:
try {
CreateModCommand createModCommand = new CreateModCommand(module);
logic.executeCommand(createModCommand);
reply = "Module created! Key in your next command :)";
reply = SUCCESS_COMMAND_MSG;
endInteract(reply);
} catch (ParseException ex) {
reply = ex.getMessage();
@@ -87,9 +99,7 @@ public String interact(String userInput) {
break;
default:
}

return reply;

}

@Override
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ public ClearTasksInteractivePrompt() {

@Override
public String interact(String userInput) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
public class DeleteTaskInteractivePrompt extends InteractivePrompt {
public static final String QUIT_COMMAND_MSG = "Successfully quited from delete task command.";
private static final String END_OF_COMMAND_MSG = "Task deleted successfully!";
private static final String REQUEST_INDEX_MSG = "Please enter the index number of task you wish to delete.";
private static final String REQUIRED_INDEX_MSG = "Please enter the index number of task you wish to delete.";

private int index;

@@ -39,14 +39,14 @@ public DeleteTaskInteractivePrompt() {

@Override
public String interact(String userInput) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}

switch (currentTerm) {
case INIT:
this.reply = REQUEST_INDEX_MSG;
this.reply = REQUIRED_INDEX_MSG;
currentTerm = InteractivePromptTerms.TASK_INDEX;
break;

@@ -58,7 +58,7 @@ public String interact(String userInput) {
currentTerm = InteractivePromptTerms.READY_TO_EXECUTE;
} catch (DeleteTaskCommandException ex) {
reply = ex.getErrorMessage()
+ "\n" + REQUEST_INDEX_MSG;
+ "\n" + REQUIRED_INDEX_MSG;
}
break;

Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
public class ArchiveTaskInteractivePrompt extends InteractivePrompt {
public static final String QUIT_COMMAND_MSG = "Successfully quited from archive command.";
private static final String END_OF_COMMAND_MSG = "Task archived successfully!";
private static final String REQUEST_INDEX_MSG = "Please enter the index number of task you wish to archive.";
private static final String REQUIRED_INDEX_MSG = "Please enter the index number of task you wish to archive.";
private int index;

public ArchiveTaskInteractivePrompt() {
@@ -37,15 +37,15 @@ public ArchiveTaskInteractivePrompt() {

@Override
public String interact(String userInput) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}

switch (currentTerm) {

case INIT:
this.reply = REQUEST_INDEX_MSG;
this.reply = REQUIRED_INDEX_MSG;
currentTerm = InteractivePromptTerms.TASK_INDEX;
break;

@@ -64,10 +64,10 @@ public String interact(String userInput) {
currentTerm = InteractivePromptTerms.READY_TO_EXECUTE;
} catch (NumberFormatException ex) {
reply = (new ArchiveTaskCommandException("wrongIndexFormatError")).getErrorMessage()
+ "\n\n" + REQUEST_INDEX_MSG;
+ "\n\n" + REQUIRED_INDEX_MSG;
} catch (ArchiveTaskCommandException ex) {
reply = ex.getErrorMessage()
+ "\n\n" + REQUEST_INDEX_MSG;
+ "\n\n" + REQUIRED_INDEX_MSG;
}
break;

Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ public class CompleteTaskInteractivePrompt extends InteractivePrompt {
public static final String QUIT_COMMAND_MSG = "Successfully quited from complete task command.";
private static final String END_OF_COMMAND_MSG = "Task marked as completed successfully!\n"
+ "If you want to archive this completed task, key in 'archive'.";
private static final String REQUEST_INDEX_MSG = "Please enter the index number "
private static final String REQUIRED_INDEX_MSG = "Please enter the index number "
+ "of task you wish to mark as Finished.";

private int index;
@@ -33,15 +33,15 @@ public CompleteTaskInteractivePrompt() {

@Override
public String interact(String userInput) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}

switch (currentTerm) {

case INIT:
this.reply = REQUEST_INDEX_MSG;
this.reply = REQUIRED_INDEX_MSG;
currentTerm = InteractivePromptTerms.TASK_INDEX;
break;

@@ -62,10 +62,10 @@ public String interact(String userInput) {
currentTerm = InteractivePromptTerms.READY_TO_EXECUTE;
} catch (NumberFormatException ex) {
reply = (new CompleteTaskCommandException("wrongIndexFormatError")).getErrorMessage()
+ "\n\n" + REQUEST_INDEX_MSG;
+ "\n\n" + REQUIRED_INDEX_MSG;
} catch (CompleteTaskCommandException ex) {
reply = ex.getErrorMessage()
+ "\n\n" + REQUEST_INDEX_MSG;
+ "\n\n" + REQUIRED_INDEX_MSG;
}
break;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
package draganddrop.studybuddy.ui.interactiveprompt.edit;

import static draganddrop.studybuddy.ui.interactiveprompt.InteractivePromptType.EDIT_MODULE;

import java.text.ParseException;

import draganddrop.studybuddy.logic.commands.edit.EditModCommand;
import draganddrop.studybuddy.logic.commands.exceptions.CommandException;
import draganddrop.studybuddy.model.module.EmptyModule;
import draganddrop.studybuddy.model.module.Module;
import draganddrop.studybuddy.model.module.ModuleCode;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.ui.interactiveprompt.InteractivePrompt;
import draganddrop.studybuddy.ui.interactiveprompt.InteractivePromptTerms;

/**
* Edit module.
*/
public class EditModuleInteractivePrompt extends InteractivePrompt {
public static final int CHANGE_NAME = 1;
public static final int CHANGE_CODE = 2;
public static final int DELETE_MODULE = 3;
public static final String END_OF_COMMAND_MSG = "Module edited successfully!";
public static final String QUIT_COMMAND_MSG = "Successfully quited from editing module.";
public static final String REQUIRED_MODULE_MSG = "Please key in a module code from the list.";
public static final String REQUIRED_MODULE_NAME_MSG = "Please key in the new name of your module";
public static final String REQUIRED_MODULE_CODE_MSG = "Please key in the new code of your module";
public static final String REQUIRED_CONFIRMATION = "Are you sure you want to delete this module?\n"
+ "All tasks in this module will be "
+ "relocated to 'No Module Allocated' tab. \n\nPress enter to proceed";

public static final String CHOICES = "What would you like to do? Key in the index of the action"
+ "that you wish to perform.\n"
+ "1. Change Name\n"
+ "2. Change Module code\n"
+ "3. Delete Module\n";

private Module oldModule;
private Module newModule;

public EditModuleInteractivePrompt() {
super();
this.interactivePromptType = EDIT_MODULE;
}

@Override
public String interact(String userInput) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}
switch (currentTerm) {
case INIT:
this.reply = REQUIRED_MODULE_MSG;
currentTerm = InteractivePromptTerms.CHOICE;
break;
case CHOICE:
try {
if (userInput.isBlank()) {
throw new ModuleException("emptyInputError");
} else if (ModuleCode.isModuleCode(userInput)) {
oldModule = new Module(userInput);
newModule = new Module(userInput);
boolean hasModule = logic.getFilteredModuleList().contains(oldModule);
if (!hasModule || oldModule.equals(new EmptyModule())) { //Ensure emptyMod is never touched
throw new ModuleException("noSuchModuleError");
} else {
oldModule = logic.getFilteredModuleList().get(logic.getFilteredModuleList().indexOf(oldModule));
newModule.setModuleName(oldModule.getModuleName());
reply = "Module retrieved: " + newModule.getModuleName()
+ " " + newModule.getModuleCode() + "\n\n"
+ CHOICES;
currentTerm = InteractivePromptTerms.PICK;
}
} else {
throw new ModuleException("wrongModuleCodeFormatError");
}
} catch (ModuleException ex) {
reply = ex.getErrorMessage() + "\n\n" + REQUIRED_MODULE_MSG;
}
break;
case PICK:
try {
int index = Integer.parseInt(userInput);
switch (index) {
case CHANGE_NAME:
currentTerm = InteractivePromptTerms.CHANGE_MOD_NAME;
reply = REQUIRED_MODULE_NAME_MSG;
break;
case CHANGE_CODE:
currentTerm = InteractivePromptTerms.CHANGE_MOD_CODE;
reply = REQUIRED_MODULE_CODE_MSG;
break;
case DELETE_MODULE:
currentTerm = InteractivePromptTerms.DELETE_MOD;
reply = REQUIRED_CONFIRMATION;
break;
default:
reply = CHOICES;
}
} catch (NumberFormatException ex) {
reply = CHOICES;
}
break;
case CHANGE_MOD_NAME:
try {
if (userInput.isBlank()) {
throw new ModuleException("emptyInputError");
} else if (userInput.equalsIgnoreCase(oldModule.getModuleName())) {
throw new ModuleException("noChangeFromOriginalModuleNameError");
} else if (!logic.getFilteredModuleList()
.filtered(x -> x.getModuleName().equalsIgnoreCase(userInput)).isEmpty()) {
throw new ModuleException("duplicateModuleNameError");
} else {
newModule.setModuleName(userInput);
logic.executeCommand(new EditModCommand(oldModule, newModule,
InteractivePromptTerms.CHANGE_MOD_NAME));
reply = "Your module " + oldModule.getModuleCode().toString() + " is now renamed "
+ newModule.getModuleName();
endInteract(END_OF_COMMAND_MSG + "\n\n" + reply);
}
} catch (ModuleException ex) {
reply = ex.getErrorMessage() + "\n\n" + REQUIRED_MODULE_NAME_MSG;
} catch (CommandException | ParseException ex) {
reply = ex.getMessage() + "\n\n" + REQUIRED_MODULE_NAME_MSG;
}
break;
case CHANGE_MOD_CODE:
try {
if (userInput.isBlank()) {
throw new ModuleException("emptyInputError");
} else if (userInput.equalsIgnoreCase(oldModule.getModuleCode().toString())) {
throw new ModuleException("noChangeFromOriginalModuleCodeError");
} else if (!logic.getFilteredModuleList().filtered(x -> x.toString()
.equalsIgnoreCase(userInput)).isEmpty()) {
throw new ModuleException("duplicateModuleCodeError");
} else {
newModule.setModuleCode(userInput);
logic.executeCommand(new EditModCommand(oldModule, newModule,
InteractivePromptTerms.CHANGE_MOD_CODE));
reply = "Your module " + oldModule.getModuleCode().toString() + " is now coded "
+ newModule.getModuleCode().toString();
endInteract(END_OF_COMMAND_MSG + "\n\n" + reply);
}
} catch (ModuleException ex) {
reply = ex.getErrorMessage() + "\n\n" + REQUIRED_MODULE_NAME_MSG;
} catch (CommandException | ParseException ex) {
reply = ex.getMessage() + "\n\n" + REQUIRED_MODULE_NAME_MSG;
}
break;
case DELETE_MOD:
try {
logic.executeCommand(new EditModCommand(oldModule, newModule, InteractivePromptTerms.DELETE_MOD));
reply = "Module deleted successfully!";
endInteract(reply);
} catch (ModuleException ex) {
reply = ex.getErrorMessage() + "\n\n" + REQUIRED_MODULE_NAME_MSG;
} catch (CommandException | ParseException ex) {
reply = ex.getMessage() + "\n\n" + REQUIRED_MODULE_NAME_MSG;
}
break;
default:
}
return reply;
}
}
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
public class UnarchiveTaskInteractivePrompt extends InteractivePrompt {
public static final String QUIT_COMMAND_MSG = "Successfully quited from unarchive command.";
private static final String END_OF_COMMAND_MSG = "Task retrieved successfully!";
private static final String REQUEST_INDEX_MSG = "Please enter the index number of task you wish to retrieve.";
private static final String REQUIRED_INDEX_MSG = "Please enter the index number of task you wish to retrieve.";
private int index;

public UnarchiveTaskInteractivePrompt() {
@@ -37,7 +37,7 @@ public UnarchiveTaskInteractivePrompt() {

@Override
public String interact(String userInput) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}
@@ -64,10 +64,10 @@ public String interact(String userInput) {
currentTerm = InteractivePromptTerms.READY_TO_EXECUTE;
} catch (NumberFormatException ex) {
reply = (new UnarchiveTaskCommandException("wrongIndexFormatError")).getErrorMessage()
+ "\n\n" + REQUEST_INDEX_MSG;
+ "\n\n" + REQUIRED_INDEX_MSG;
} catch (UnarchiveTaskCommandException ex) {
reply = ex.getErrorMessage()
+ "\n\n" + REQUEST_INDEX_MSG;
+ "\n\n" + REQUIRED_INDEX_MSG;
}
break;

Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ public SortTaskInteractivePrompt() {

@Override
public String interact(String userInput) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
public class CalendarViewInteractivePrompt extends InteractivePrompt {

public static final String QUIT_COMMAND_MSG = "Successfully quited from calendar view command.";
public static final String REQUEST_DATE_MSG = "Please input the date which you want to view in this format:"
public static final String REQUIRED_DATE_MSG = "Please input the date which you want to view in this format:"
+ "\n\n dd/MM/yyyy";
private static final String END_OF_COMMAND_MSG = "Now viewing: ";

@@ -38,14 +38,14 @@ public CalendarViewInteractivePrompt(MainWindow mainWindow) {
@Override
public String interact(String userInput) {

if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}

switch (currentTerm) {
case INIT:
this.reply = REQUEST_DATE_MSG;
this.reply = REQUIRED_DATE_MSG;
currentTerm = InteractivePromptTerms.DATE;
break;

Original file line number Diff line number Diff line change
@@ -32,17 +32,17 @@
public class FilterTaskInteractivePrompt extends InteractivePrompt {
public static final String QUIT_COMMAND_MSG = "Successfully quited from filter task command.";
private static final String END_OF_COMMAND_MSG = "Tasks filtered successfully!";
private static final String REQUEST_OPTION_MSG = "Please enter your choice of filter:\n"
private static final String REQUIRED_OPTION_MSG = "Please enter your choice of filter:\n"
+ "1. Status\n"
+ "2. Type\n";
private static final String REQUEST_TYPE_MSG = "Please enter the task type you would like to filter by:\n"
private static final String REQUIRED_TYPE_MSG = "Please enter the task type you would like to filter by:\n"
+ "1. Assignment\n"
+ "2. Quiz\n"
+ "3. Presentation\n"
+ "4. Meeting\n"
+ "5. Exam\n"
+ "6. Others";
private static final String REQUEST_STATUS_MSG = "Please enter the status you would like to filter by:\n"
private static final String REQUIRED_STATUS_MSG = "Please enter the status you would like to filter by:\n"
+ "1. Pending\n"
+ "2. Finished\n"
+ "3. Due soon\n"
@@ -59,30 +59,30 @@ public FilterTaskInteractivePrompt() {

@Override
public String interact(String userInput) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}

switch (currentTerm) {
case INIT:
this.reply = REQUEST_OPTION_MSG;
this.reply = REQUIRED_OPTION_MSG;
currentTerm = InteractivePromptTerms.OPTION_TYPE;
break;

case OPTION_TYPE:
try {
index = FilterTaskCommandParser.parseOptionIndex(userInput);
if (index == 1) {
this.reply = REQUEST_STATUS_MSG;
this.reply = REQUIRED_STATUS_MSG;
currentTerm = InteractivePromptTerms.STATUS_TYPE;
} else {
this.reply = REQUEST_TYPE_MSG;
this.reply = REQUIRED_TYPE_MSG;
currentTerm = InteractivePromptTerms.TASKS_TYPE;
}
} catch (FilterTaskCommandException ex) {
reply = ex.getErrorMessage()
+ "\n" + REQUEST_OPTION_MSG;
+ "\n" + REQUIRED_OPTION_MSG;
}
break;

@@ -94,7 +94,7 @@ public String interact(String userInput) {
currentTerm = InteractivePromptTerms.READY_TO_EXECUTE;
} catch (FilterTaskCommandException ex) {
reply = ex.getErrorMessage()
+ "\n" + REQUEST_TYPE_MSG;
+ "\n" + REQUIRED_TYPE_MSG;
}
break;

@@ -106,7 +106,7 @@ public String interact(String userInput) {
currentTerm = InteractivePromptTerms.READY_TO_EXECUTE;
} catch (FilterTaskCommandException ex) {
reply = ex.getErrorMessage()
+ "\n" + REQUEST_STATUS_MSG;
+ "\n" + REQUIRED_STATUS_MSG;
}
break;

Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ public FindTaskInteractivePrompt() {

@Override
public String interact(String userInput) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
reply = handleQuit(userInput, QUIT_COMMAND_MSG);
} else {
reply = handleFind(userInput);
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ public RefreshTaskInteractivePrompt() {

@Override
public String interact(String userInput) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ public ViewRenamedTaskInteractivePrompt() {

@Override
public String interact(String userInput) {
if ("quit".equals(userInput)) {
if ("quit".equalsIgnoreCase(userInput)) {
endInteract(QUIT_COMMAND_MSG);
return reply;
}
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
import draganddrop.studybuddy.model.ReadOnlyUserPrefs;
import draganddrop.studybuddy.model.StudyBuddy;
import draganddrop.studybuddy.model.module.Module;
import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.model.task.Task;
import draganddrop.studybuddy.model.task.TaskType;
import draganddrop.studybuddy.testutil.TaskBuilder;
@@ -198,17 +198,17 @@ public void addMod(Module mod) {
}

@Override
public void changeModName(Module oldMod, Module newMod) throws ModuleCodeException {
public void changeModName(Module oldMod, Module newMod) throws ModuleException {

}

@Override
public void changeModCode(Module oldMod, Module newMod) throws ModuleCodeException {
public void changeModCode(Module oldMod, Module newMod) throws ModuleException {

}

@Override
public void deleteMod(Module mod) throws ModuleCodeException {
public void deleteMod(Module mod) throws ModuleException {

}

Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

import org.junit.jupiter.api.Test;

import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.testutil.Assert;

public class ModuleCodeTest {
@@ -21,53 +21,53 @@ public class ModuleCodeTest {
private String longPostfix = "CS0000XX";

@Test
public void testSampleWith3LetterPrefix() throws ModuleCodeException {
public void testSampleWith3LetterPrefix() throws ModuleException {
new ModuleCode(sample2);
}

@Test
public void postFixOptional() throws ModuleCodeException {
public void postFixOptional() throws ModuleException {
new ModuleCode(postfix);
new ModuleCode(noPostfix);
}

@Test
public void testEqualsFunctionOnString() throws ModuleCodeException {
public void testEqualsFunctionOnString() throws ModuleException {
assertEquals(sample1, new ModuleCode(sample1).toString());
}

@Test
public void moduleCodePostfixTooLong_throwModuleCodeException() {
Assert.assertThrows(ModuleCodeException.class, () -> new ModuleCode(longPostfix));
Assert.assertThrows(ModuleException.class, () -> new ModuleCode(longPostfix));
}

@Test
public void isSameModuleCode() throws ModuleCodeException {
public void isSameModuleCode() throws ModuleException {
assertEquals(new ModuleCode(sample1), new ModuleCode(sample1Clone));
}

@Test
public void isSameModuleCode_smallCase() throws ModuleCodeException {
public void isSameModuleCode_smallCase() throws ModuleException {
assertEquals(new ModuleCode(sample1), new ModuleCode(sample1SmallCase));
}

@Test
public void moduleCodeNoPrefix_throwModuleCodeException() {
Assert.assertThrows(ModuleCodeException.class, ()-> new ModuleCode(noPrefix));
Assert.assertThrows(ModuleException.class, ()-> new ModuleCode(noPrefix));
}

@Test
public void moduleCodeLongPrefix_throwModuleCodeException() {
Assert.assertThrows(ModuleCodeException.class, ()-> new ModuleCode(longPrefix));
Assert.assertThrows(ModuleException.class, ()-> new ModuleCode(longPrefix));
}

@Test
public void moduleCodeLongCode_throwModuleCodeException() {
Assert.assertThrows(ModuleCodeException.class, ()-> new ModuleCode(longNumbers));
Assert.assertThrows(ModuleException.class, ()-> new ModuleCode(longNumbers));
}

@Test
public void moduleCodeNoNum_throwModuleCodeException() {
Assert.assertThrows(ModuleCodeException.class, ()-> new ModuleCode(noNumbers));
Assert.assertThrows(ModuleException.class, ()-> new ModuleCode(noNumbers));
}
}
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@

import org.junit.jupiter.api.Test;

import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.model.task.Task;
import draganddrop.studybuddy.testutil.Assert;
import draganddrop.studybuddy.testutil.TestModules;
@@ -22,15 +22,15 @@ public class ModuleListTest {
@Test
public void modListDuplicateMods_throwModuleCodeException() {
ModuleList moduleList = new ModuleList();
Assert.assertThrows(ModuleCodeException.class, ()-> {
Assert.assertThrows(ModuleException.class, ()-> {
for (Module sampleMod: TestModules.getSampleModule()) {
moduleList.add(sampleMod);
}
});
}

@Test
public void lastModOnListIsEmptyModule() throws ModuleCodeException {
public void lastModOnListIsEmptyModule() throws ModuleException {
ModuleList moduleList = new ModuleList();
moduleList.add(new EmptyModule());
moduleList.add(new Module("A", "CS2000"));
@@ -44,7 +44,7 @@ public void lastModOnListIsEmptyModule() throws ModuleCodeException {
}

@Test
public void containsModInList_returnTrue() throws ModuleCodeException {
public void containsModInList_returnTrue() throws ModuleException {
ModuleList moduleList = new ModuleList();
Module sample1 = TestModules.getSampleModule()[0];
moduleList.add(sample1);
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@

import org.junit.jupiter.api.Test;

import draganddrop.studybuddy.model.module.exceptions.ModuleCodeException;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.testutil.Assert;
import draganddrop.studybuddy.testutil.TestModules;

@@ -29,29 +29,29 @@ public void changeModuleNameSucceed() {
}

@Test
public void changeModuleCodeSucceed() throws ModuleCodeException {
public void changeModuleCodeSucceed() throws ModuleException {
sample1.setModuleCode("CC1111");
assertEquals(sample1.getModuleCode(), new ModuleCode("CC1111"));
}

@Test
public void createModuleWithNoPrefix_throwsModuleCodeException() {
Assert.assertThrows(ModuleCodeException.class, ()-> new Module("2312312"));
Assert.assertThrows(ModuleException.class, ()-> new Module("2312312"));
}

@Test
public void createModuleWithNoNumber_throwsModuleCodeException() {
Assert.assertThrows(ModuleCodeException.class, ()-> new Module("CS"));
Assert.assertThrows(ModuleException.class, ()-> new Module("CS"));
}

@Test
public void createModuleExceedPrefixLength_throwsModuleCodeException() {
Assert.assertThrows(ModuleCodeException.class, ()-> new Module("CSSS1000"));
Assert.assertThrows(ModuleException.class, ()-> new Module("CSSS1000"));
}

@Test
public void createModuleExceedLength_throwsModuleCodeException() {
Assert.assertThrows(ModuleCodeException.class, ()-> new Module("CS100000000Z"));
Assert.assertThrows(ModuleException.class, ()-> new Module("CS100000000Z"));
}

@Test
Original file line number Diff line number Diff line change
@@ -19,14 +19,13 @@ public class JsonSerializableStudyBuddyTest {
private static final Path TYPICAL_TASKS_FILE = TEST_DATA_FOLDER.resolve("typicalTasksStudyBuddy.json");
private static final Path INVALID_TASK_FILE = TEST_DATA_FOLDER.resolve("invalidTaskStudyBuddy.json");

//pending test
@Test
public void toModelType_typicalPersonsFile_success() throws Exception {
JsonSerializableStudyBuddy dataFromFile = JsonUtil.readJsonFile(TYPICAL_TASKS_FILE,
JsonSerializableStudyBuddy.class).get();
StudyBuddy addressBookFromFile = dataFromFile.toModelType();
StudyBuddy typicalPersonsAddressBook = TypicalTasks.getOnlyTaskList();
assertEquals(addressBookFromFile, typicalPersonsAddressBook);
StudyBuddy studyBuddyFromFile = dataFromFile.toModelType();
StudyBuddy typicalPersonsStudyBuddy = TypicalTasks.getOnlyTaskList();
assertEquals(studyBuddyFromFile, typicalPersonsStudyBuddy);
}

@Test
Original file line number Diff line number Diff line change
@@ -1,83 +1,102 @@
package draganddrop.studybuddy.ui.interactiveprompt.add;

import static draganddrop.studybuddy.testutil.TestModules.getSampleModule;
import static draganddrop.studybuddy.testutil.TypicalTasks.getTypicalTaskList;

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

import java.nio.file.Path;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import draganddrop.studybuddy.logic.LogicManager;
import draganddrop.studybuddy.model.Model;
import draganddrop.studybuddy.model.ModelManager;
import draganddrop.studybuddy.model.UserPrefs;
import draganddrop.studybuddy.model.module.Module;
import draganddrop.studybuddy.model.module.exceptions.ModuleException;
import draganddrop.studybuddy.storage.JsonStudyBuddyStorage;
import draganddrop.studybuddy.storage.JsonUserPrefsStorage;
import draganddrop.studybuddy.storage.StorageManager;

class CreateModuleInteractivePromptTest {

private Model model = new ModelManager(getTypicalTaskList(), new UserPrefs());
@TempDir
public Path testFolder;
private CreateModuleInteractivePrompt prompt = new CreateModuleInteractivePrompt();
private Model modelStub = new ModelManager(getTypicalTaskList(), new UserPrefs());

@BeforeEach
public void setUp() {
JsonStudyBuddyStorage studyBuddyStorage = new JsonStudyBuddyStorage(getTempFilePath("ab"));
JsonUserPrefsStorage userPrefsStorage = new JsonUserPrefsStorage(getTempFilePath("prefs"));
StorageManager storageStub = new StorageManager(studyBuddyStorage, userPrefsStorage);
LogicManager logicStub = new LogicManager(modelStub, storageStub);
for (Module m : getSampleModule()) {
logicStub.getStudyBuddy().getModuleList().add(m);
}
prompt.setLogic(logicStub);
}

private Path getTempFilePath(String fileName) {
return testFolder.resolve(fileName);
}

@Test
public void interact_firstInput_returnKeywordPrompt() {
CreateModuleInteractivePrompt prompt = new CreateModuleInteractivePrompt();
public void interactFirstInputReturnKeywordPrompt() {
assertEquals("Please key in the name of the module that you want to create",
prompt.interact(""));
}

@Test
public void interact_quitCommand_returnMessage() {
CreateModuleInteractivePrompt prompt = new CreateModuleInteractivePrompt();
public void interactQuitCommandReturnMessage() {
assertEquals(CreateModuleInteractivePrompt.QUIT_COMMAND_MSG, prompt.interact("quit"));
}


@Test
public void interact_secondInput_returnKeywordPrompt() {
CreateModuleInteractivePrompt prompt = new CreateModuleInteractivePrompt();
public void interactSecondInputReturnKeywordPrompt() {
prompt.interact("");
assertEquals("The name of module is set to: " + "Software engineering" + ".\n"
+ "Now key in your module code", prompt.interact("Software engineering"));
assertTrue(prompt.interact("Software engineering").contains("Software engineering"));
}

@Test
public void interact_thirdInput_returnKeywordPrompt() {
CreateModuleInteractivePrompt prompt = new CreateModuleInteractivePrompt();
public void interactThirdInputReturnKeywordPrompt() {
prompt.interact("");
prompt.interact("a");
String reply = "Module Code: " + "CS1101S" + "\n"
+ "Click 'Enter' again to confirm your changes";
assertEquals(reply, prompt.interact("CS1101S"));
assertTrue(prompt.interact("CS1101S").contains("CS1101S"));
}


@Test
public void interact_fourthInput_returnKeywordPrompt() {
CreateModuleInteractivePrompt prompt = new CreateModuleInteractivePrompt();
public void interactFourthInputReturnKeywordPrompt() {
prompt.interact("");
prompt.interact("a");
prompt.interact("CS1101S");
assertThrows(NullPointerException.class, ()->prompt.interact(""));
assertEquals(CreateModuleInteractivePrompt.SUCCESS_COMMAND_MSG, prompt.interact(""));
}

@Test
public void interact_noModuleName_returnCorrectReply() {
CreateModuleInteractivePrompt prompt = new CreateModuleInteractivePrompt();
public void interactNoModuleNameReturnCorrectReply() {
prompt.interact("");
assertEquals("Please key in something as your module name", prompt.interact(""));
assertTrue(prompt.interact("").contains(new ModuleException("emptyInputError").getErrorMessage()));
}

@Test
public void interact_invalidModuleCode_returnCorrectReply() {
CreateModuleInteractivePrompt prompt = new CreateModuleInteractivePrompt();
public void interactInvalidModuleCodeReturnErrorMessage() {
prompt.interact("");
prompt.interact("a");
assertEquals(CreateModuleInteractivePrompt.MODULE_CODE_FORMAT, prompt.interact("Csdsdsa"));
assertEquals(CreateModuleInteractivePrompt.MODULE_CODE_FORMAT, prompt.interact("C111"));
assertEquals(CreateModuleInteractivePrompt.MODULE_CODE_FORMAT, prompt.interact("C1110"));
assertTrue(prompt.interact("Csdsdsa")
.contains(new ModuleException("wrongModuleCodeFormatError").getErrorMessage()));
assertTrue(prompt.interact("C111")
.contains(new ModuleException("wrongModuleCodeFormatError").getErrorMessage()));
assertTrue(prompt.interact("C1110")
.contains(new ModuleException("wrongModuleCodeFormatError").getErrorMessage()));
}

@Test
public void endInteract_test() {
CreateModuleInteractivePrompt prompt = new CreateModuleInteractivePrompt();
prompt.endInteract("a");
}

}