add
command in this documentation was inspired by the documentation of the past project NetworkBook.Refer to the guide Setting up and getting started.
The Architecture Diagram given above explains the high-level design of the App.
Given below is a quick overview of main components and how they interact with each other.
Main components of the architecture
Main
(consisting of classes Main
and MainApp
) is in charge of the app launch and shut down.
The bulk of the app's work is done by the following four components:
UI
: The UI of the App.Logic
: The command executor.Model
: Holds the data of the App in memory.Storage
: Reads data from, and writes data to, the hard disk.Commons
represents a collection of classes used by multiple other components.
How the architecture components interact with each other
The Sequence Diagram below shows how the components interact with each other for the scenario where the user issues the command delete 1
.
Each of the four main components (also shown in the diagram above),
interface
with the same name as the Component.{Component Name}Manager
class (which follows the corresponding API interface
mentioned in the previous point.For example, the Logic
component defines its API in the Logic.java
interface and implements its functionality using the LogicManager.java
class which follows the Logic
interface. Other components interact with a given component through its interface rather than the concrete class (reason: to prevent outside component's being coupled to the implementation of a component), as illustrated in the (partial) class diagram below.
The sections below give more details of each component.
The API of this component is specified in Ui.java
The UI consists of a MainWindow
that is made up of parts e.g.CommandBox
, ResultDisplay
, StudentListPanel
, StatusBarFooter
etc. All these, including the MainWindow
, inherit from the abstract UiPart
class which captures the commonalities between classes that represent parts of the visible GUI.
The UI
component uses the JavaFx UI framework. The layout of these UI parts are defined in matching .fxml
files that are in the src/main/resources/view
folder. For example, the layout of the MainWindow
is specified in MainWindow.fxml
.
The UI
component,
Logic
component.Model
data so that the UI can be updated with the modified data.Logic
component, because the UI
relies on the Logic
to execute commands.Model
component, as it displays Student
object residing in the Model
.API : Logic.java
Here's a (partial) class diagram of the Logic
component:
The sequence diagram below illustrates the interactions within the Logic
component, taking execute("delete 1")
API call as an example.
Note: The lifeline for DeleteCommandParser
should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline continues till the end of diagram.
How the Logic
component works:
Logic
is called upon to execute a command, it is passed to an AddressBookParser
object which in turn creates a parser that matches the command (e.g., DeleteCommandParser
) and uses it to parse the command.Command
object (more precisely, an object of one of its subclasses e.g., DeleteCommand
) which is executed by the LogicManager
.Model
when it is executed (e.g. to delete a student).Model
) to achieve.CommandResult
object which is returned back from Logic
.Here are the other classes in Logic
(omitted from the class diagram above) that are used for parsing a user command:
How the parsing works:
AddressBookParser
class creates an XYZCommandParser
(XYZ
is a placeholder for the specific command name e.g., AddCommandParser
) which uses the other classes shown above to parse the user command and create a XYZCommand
object (e.g., AddCommand
) which the AddressBookParser
returns back as a Command
object.XYZCommandParser
classes (e.g., AddCommandParser
, DeleteCommandParser
, ...) inherit from the Parser
interface so that they can be treated similarly where possible e.g, during testing.API : Model.java
The Model
component,
Student
objects (which are contained in a UniqueStudentList
object).Student
objects (e.g., results of a search query) as a separate filtered list which is exposed to outsiders as an unmodifiable ObservableList<Student>
that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.UserPref
object that represents the user’s preferences. This is exposed to the outside as a ReadOnlyUserPref
objects.Model
represents data entities of the domain, they should make sense on their own without depending on other components)API : Storage.java
The Storage
component,
AddressBookStorage
and UserPrefStorage
, which means it can be treated as either one (if only the functionality of only one is needed).Model
component (because the Storage
component's job is to save/retrieve objects that belong to the Model
)Classes used by multiple components are in the seedu.address.commons
package.
This section describes some noteworthy details on how certain features are implemented.
The add command is used to add a new student to the address book. The AddCommandParser
is responsible for parsing the user input and creating an AddCommand
object. The AddCommand
object is then executed by the Logic
component.
AddCommandParser
obtains the values corresponding to the prefixes n/
p/
e/
a/
t/
s/
r/
paid/
owed/
from the user input. The AddCommandParser
will enforce the following constraints:
add
command word and the prefixes.n/
p/
e/
a/
t/
s/
r/
must be provided (paid/
and owed/
are optional).If the constraints are not met, the AddCommandParser
will throw a ParseException
with an error message indicating the constraint that was violated.
Otherwise, a new instance of Student
is created with the values obtained from the user input.
A new instance of AddCommand
is then created with the Student
instance.
On execution, AddCommand
first queries the supplied model if it contains a student with both an identical name and an identical phone number. If no such student exists, AddCommand
then calls on model::addStudent
to add the student into the addressBook data.
Finally, AddCommand
queries the model to see if the student's schedule clashes with others in the address book. If conflicts are found, a warning message is displayed along with the conflicting students.
The following diagram summarizes how a user may add a student into UGTeach.
The following sequence diagram shows how an add operation goes through the Logic
component:
Note: The lifeline for AddCommand
should end at the destroy marker (X) but due to a limitation of PlantUML, the lifeline reaches the end of diagram.
Similarly, how an AddCommand operation goes through the Model
component is shown below:
Aspect: How add command is carried out:
Alternative 1 (current choice): Key in all the details for student in one command.
Alternative 2: Key in the details for students in multiple steps.
The owe command is part of UGTeach's payment tracking feature. It is used to track the amount of tuition fee owed by a student. The OweCommandParser
is responsible for parsing the user input and creating an OweCommand
object. The OweCommand
object is then executed by the Logic
component.
OweCommandParser
obtains the INDEX
of the student and the values corresponding to the prefix hr/
from the user input. The OweCommandParser
will enforce the following constraints:
INDEX
must be a positive integer.hr/
must be provided.If the constraints are not met, the OweCommandParser
will throw a ParseException
with an error message indicating the constraint that was violated.
Otherwise, a new instance of OweCommand
is then created with the values of INDEX
and HOURS_OWED
parsed by OweCommandParser
.
On execution, OweCommand
first queries the supplied model for the student to be updated using the INDEX
.
Then, OweCommand
calculates the amount of tuition fee owed and checks if the total amount owed by the student exceeds the limit of 9999999.99
. If it exceeds, OweCommand
will throw a CommandException
with an error message indicating that limit was violated.
Finally, OweCommand
updates the total amount of tuition fee owed by the student by creating a new Student
instance with updated fields to replace the outdated Student
instance in the model.
The following activity diagram summarizes what happens when a user wants to track payment after a lesson:
How an OweCommand operation goes through the Model
component is shown below:
Aspect: How owe executes:
Alternative 1 (current choice): Calculations for amount owed done by UGTeach.
Alternative 2: Calculations for amount owed done by the user.
Target user profile:
Value proposition: Our CLI-based address book empowers Singapore-based undergraduate private tutors to efficiently manage payments and organize schedules. It streamlines tutoring operations and ensures you stay organized. It is optimized for users who prefer CLI.
Priorities: High (must have) - * * *
, Medium (nice to have) - * *
, Low (unlikely to have) - *
Priority | As a … | I want to … | So that I can… |
---|---|---|---|
* * * | new user | see usage instructions | refer to instructions when I forget how to use the App |
* * * | tutor | add a new student | keep track of my student's information |
* * * | user | delete an entry | remove entries that I no longer need |
* * * | private tutor | view all my students' details | have an overview of how many student I am managing |
* * * | tutor with many students | find a student by name | locate details of students without having to go through the entire list |
* * * | tutor with many students | be warned if the new added class clashes | better manage my teaching schedule and the number of students at the same time |
* * * | busy undergraduate tutor | record students' payment status | how much students have paid or owe me |
* * * | busy undergraduate tutor | record it when students settle the owed amount | avoid mistakenly reminding him/her again |
* * | busy undergraduate tutor | find students by day | locate details of students that has tuition on a specific day |
* * | new user | see sample entries | understand how the interface will look like with entries added |
* * | user | edit contact details | keep my information up-to-date |
* * | busy undergraduate tutor | check who owes me tuition fee | identify and remind them to pay |
* * | busy undergraduate tutor | be reminded of my tuition for today | remember to teach for today (if any) |
* * | busy undergraduate tutor | have an overview of the tuition fee earned/ owed as of now | easily keep track of how much more I should receive |
* * | forgetful user | detect duplicates | avoid manually finding and deleting the duplicates |
* * | forgetful user | tag my students with the day and time of the tuition | differentiate between different contacts |
* | user | hide private contact details | minimize chance of someone else seeing them by accident |
* | user with many students in the UGTeach application | sort students by name | locate a student easily |
* | user that types fast | be able to undo my actions | revert back if I have made a mistake |
* | busy undergraduate tutor | have information of both the student and his/her guardian | contact either of them |
* | tutor with many students | to know which guardian is associated with which student | know which student is under that guardian/ vice-versa |
(For all use cases below, the System is the UGTeach
and the Actor is the user
, unless specified otherwise)
Use case: UC01 - Adding a student
MSS
User enters command to create a new student entry.
UGTeach displays success message and the command line is cleared.
Use case ends.
Extensions
Use case: UC02 - Read all entries
MSS
User enters command to view all entries.
UGTeach displays list with all entries to the user.
Use case ends.
Extension
1a. UGTeach detects error in entered command.
1b. UGTeach detects the list is empty.
Use case: UC03 - Read total earnings
MSS
User enters command to read total earnings and total amount owed by the students.
UGTeach displays total earnings and total amount owed to the user.
Use case ends.
Extension
Use case: UC04 - Delete a student entry
MSS
User requests to find a student(UC05).
User enters command to delete a specific student.
UGTeach displays list with specified student deleted from the list.
Use case ends.
Extensions
1a. UGTeach cannot find the specified student.
Use case ends.
2a. UGTeach detects error in format of entered command.
Use case: UC05 - Find student entries
MSS
User enters command to find students based on the specified keywords.
UGTeach displays list with students with matching details.
Use case ends.
Extensions
1a. UGTeach cannot find any student with the specified keyword.
1b. UGTeach detects error in entered command.
Use case: UC06 - Receiving tuition fee from a student
MSS
User requests to find a student(UC05).
User enters command to record payment received from the specified student after a lesson.
UGTeach updates the total tuition fee paid by the student.
UGTeach displays success message.
Use case ends.
Extensions
1a. UGTeach cannot find the specified student.
2a. UGTeach detects error in entered command.
Use case: UC07 - Updating amount of tuition fee owed by student
MSS
User requests to find a student(UC05).
User enters command to update amount of tuition fee owed by the specified student after a lesson.
UGTeach updates the total tuition fee owed by the student.
UGTeach displays success message.
Use case ends.
Extensions
1a. UGTeach cannot find the specified student.
2a. UGTeach detects error in entered command.
Use case: UC08 - Settle outstanding fees for student
MSS
User requests to find a student(UC05).
User enters command to settle outstanding fees for the specified student.
UGTeach updates the total tuition fee paid and total tuition fee owed by the student.
UGTeach displays success message.
Use case ends.
Extensions
1a. UGTeach cannot find the specified student.
2a. UGTeach detects error in entered command.
Environment Requirements
17
or above installed.Data Requirements
Performance Requirements
Accessibility
Concurrency Control
Testability
Security Requirements
Maintainability Requirements
Logging
Given below are instructions to test the app manually.
Note: These instructions only provide a starting point for testers to work on; testers are expected to do more exploratory testing.
Initial launch
Download the jar file and copy into an empty folder.
Open a command terminal, cd
into the folder that you put the jar file in.
Run the jar file with the command in the terminal java -jar ugteach.jar
Expected: Shows the GUI with a set of sample contacts and a reminder for lessons scheduled today.
The window size may not be optimum.
Saving window preferences
Resize the window to an optimum size. Move the window to a different location. Close the window.
Re-launch the app by double-clicking the jar file.
Expected: The most recent window size and location is retained.
Finding students by name
Test case: find n/Alex
Expected: Only students whose name contains keyword Alex
listed.
Test case: find n/Alex Bernice
Expected: Only students whose name contains keyword Alex
OR Bernice
listed.
Test case: find n/Alex!
Expected: Search not performed. UGTeach shows an error message.
Other incorrect find commands to try: find n/
, find n/Bernice!
(where keyword supplied contains non-alphanumeric characters or only whitespace)
Expected: Similar to previous.
Finding students by day
Test case: find d/Thursday
Expected: Only students whose tuition day falls on Thursday
listed.
Test case: find d/Wednesday Thursday
Expected: Only students whose tuition day falls on Wednesday
OR Thursday
listed.
Test case: find d/Thur
Expected: Search not performed. UGTeach shows an error message.
Other incorrect find commands to try: find d/
, find d/foo
(where days supplied does not match any day or contains only whitespace)
Expected: Similar to previous.
Test case: find n/Alex d/Thursday
Expected: Only students whose name contains keyword Alex
AND their tuition day falls on Thursday
listed.
Test case: find d/Thursday n/Alex
Expected: Similar to previous.
Test case: find d/Alex Bernice d/Wednesday Thursday
Expected: Only students whose name contains keyword Alex
OR Bernice
AND their tuition day falls on Wednesday
OR Thursday
listed.
Test case: find n/Alex d/
Expected: Search not performed. UGTeach shows an error message.
Other incorrect find commands to try: find n/ d/Thursday
, find n/Alex! d/Thursday
, find n/Alex d/Thur
(where keywords supplied contains non-alphanumeric characters or only whitespace) or
(where days supplied does not match any day or contains only whitespace)
Expected: Similar to previous.
Note: You are encouraged to follow the test cases in order to see the expected results
Adding a new student with all parameters specified
Type add
and press Enter
on your keyboard.
You will see an error message in the result display area that shows you how to use this command.
In the error message, an example is provided. Copy the example.
Test case: same as the example you copied.
Expected: A new student with the corresponding information will be added to the end of the current list.
Adding a new student with only compulsory parameters specified, order changed and case-insensitive command words
Test case: aDD n/A Lucky Tester t/Sunday-1000-1200 s/Biology r/500 p/87903288 e/ilovecs2103t@nus.edu.sg a/COM2
.
Expected: The student is successfully added.
Adding a duplicated student
Test case: add n/a lucky Tester p/87903288 e/suchANiceApp@meta.sg a/COM1 B1 r/10 paid/0 owed/0 t/Tuesday-1500-1600 s/Physics
.
Expected: An error message shown: A student with the same name and the same phone number already exists in the address book
.
Adding a new student with a clashing schedule
Test case: add n/software Developer p/65894545 e/coderwithoutbug@gmail.com a/Jurong West Condo r/100 t/Sunday-1130-1330 s/GP
Expected: The new student is successfully added with a warning message.
Adding a new student with mixed-case prefixes
Test case: add N/Teaching Assistant p/90908767 e/getaboveAtobeaTA123@hotmail.com a/21 Lower Kent Ridge Drive r/40.00 t/Thursday-1130-1330 s/Economics Paid/12.00
Expected: A new contact with the corresponding information will be added to the end of the current list. Whether there is a warning message on the schedule or not depends on your current data.
Editing a student while all students are being shown
Prerequisites: List all students using the list
command. Multiple students in the list.
Test case: eDit 3 owed/500 p/89873423
Expected: Student number 3 will have the new values for their OWED_AMOUNT and PHONE_NUMBER.
Other incorrect edit commands to try: edit
, edit 0
, edit x
, ...
(where x is larger than the list size)
Expected: No student is deleted. Error details shown in the status message. Status bar remains the same.
Editing a student in a filtered list
Prerequisites: Filter the students using find
command.
Test case: find n/irfan d/thursday
. (Given that at least 1 student with the mentioned NAME and SCHEDULE is available in the list)
Test case: edit 1 n/Jonathan e/jonjon4343@canadian.com
Expected: The NAME and EMAIL of the first student in the filtered list will be updated. The list shows all students instead of the previous filtered list.
Editing a student with invalid values
Test case: edit 1 r/0
Expected: An error message displayed reminds you that RATE must be from $0.01 to $1000.00.
Test case: edit 1 n/ p/65432123
Expected: An error message displayed reminds you that NAME must not be empty and must contain only alphanumeric characters and space.
Deleting a student while all students are being shown
Prerequisite: List all students using the list
command. There should be at least 1 student listed.
Test case: delete 1
Expected: First contact is deleted from the list. UGTeach displays success message with details of the deleted student.
Test case: delete 0
Expected: No student is deleted. UGTeach displays error message.
Other incorrect delete commands to try: delete
, delete x
(where x is larger than the list size)
Expected: Similar to previous.
Deleting a student from a filtered list
Prerequisite: Find a student using the find
command. There should be at least 1 student found.
Test case: delete 1
Expected: First contact is deleted from the filtered list. UGTeach displays success message with details of the deleted student.
Test case: delete 0
Expected: No student is deleted. UGTeach displays error message.
Other incorrect delete commands to try: delete
, delete x
(where x is larger than the list size)
Expected: Similar to previous.
Getting a reminder when there are lessons scheduled for today
Prerequisite: There should be at least 1 lesson scheduled for today.
Test case: remind
Expected: UGTeach displays success message with details such as student's name, time of the lesson and the subject to be taught.
Getting a reminder when there are no lessons scheduled for today
Prerequisite: There should be no lessons scheduled for today.
Test case: remind
Expected: UGTeach displays congratulatory message for having no lessons scheduled today.
Using pay command while all students are being shown
Prerequisite: List all students using the list
command. There should be at least 1 student listed.
Test case: pay 1 hr/1
Expected: Paid amount for 1st student increases by (1 hr * rate). UGTeach displays a message that 1st student paid (1 hr * rate).
Test case: pay 1 hr/-1
Expected: No changes. UGTeach displays error message notifying that number of hours provided is invalid.
Test case: pay 0 hr/1
Expected: No changes. UGTeach displays error message of invalid command format.
Using pay command from a filtered list
Prerequisite: Find a student using the find
command. There should be at least 1 student found.
Test case: pay 1 hr/1
Expected: Paid amount for 1st student in filtered list increases by (1 hr * rate). UGTeach displays a message that 1st student paid (1 hr * rate).
Test case: pay 1 hr/-1
Expected: No changes. UGTeach displays error message notifying that number of hours provided is invalid.
Test case: pay 0 hr/1
Expected: No changes. UGTeach displays error message of invalid command format.
Using owe command while all students are being shown
Prerequisite: List all students using the list
command. There should be at least 1 student listed.
Test case: owe 1 hr/1
Expected: Owed amount for 1st student increases by (1 hr * rate). UGTeach displays a message that 1st student owed another (1 hr * rate).
Test case: owe 1 hr/-1
Expected: No changes. UGTeach displays error message notifying that number of hours provided is invalid.
Test case: owe 0 hr/1
Expected: No changes. UGTeach displays error message of invalid command format.
Using owe command from a filtered list
Prerequisite: Find a student using the find
command. There should be at least 1 student found.
Test case: owe 1 hr/1
Expected: Owed amount for 1st student in filtered list increases by (1 hr * rate). UGTeach displays a message that 1st student owed another (1 hr * rate).
Test case: owe 1 hr/-1
Expected: No changes. UGTeach displays error message notifying that number of hours provided is invalid.
Test case: owe 0 hr/1
Expected: No changes. UGTeach displays error message of invalid command format.
Using settle command while all students are being shown
Prerequisite: List all students using the list
command. There should be at least 1 student listed.
Test case: settle 1 amount/10
Expected: For 1st student, assuming owed amount is more than 10, owed amount decreases by 10, while paid amount increases by 10. UGTeach displays a message that payment of 10.00 has been settled.
Test case: settle 1 amount/-10
Expected: No changes. UGTeach displays error message notifying that amount is invalid.
Test case: settle 0 amount/10
Expected: No changes. UGTeach displays error message of invalid command format.
Test case: settle 1 amount/10000
Expected: No changes, assuming that the amount entered is more than the amount owed.
UGTeach displays error message that entered amount is more than amount owed.
Using settle command from a filtered list
Prerequisite: Find a student using the find
command. There should be at least 1 student found.
Test case: settle 1 amount/10
Expected: For 1st student in filtered list, assuming owed amount is more than 10, owed amount decreases by 10, while paid amount increases by 10. UGTeach displays a message that payment of 10.00 has been settled.
Test case: settle 1 amount/-10
Expected: No changes. UGTeach displays error message notifying that amount is invalid.
Test case: settle 0 amount/10
Expected: No changes. UGTeach displays error message of invalid command format.
Dealing with missing/corrupted data files
Prerequisite: UGTeach application is closed. You have not edited the preferences.json
file. There is a folder named data
in the same directory as the jar file, and there is a ugteach.json
file in the data
folder.
Test case: Delete the ugteach.json
file, then start the application.
Expected: UGTeach should create a new ugteach.json
file with default data.
Test case: Delete the data
folder together with the ugteach.json
file, then start the application.
Expected: Similar to previous.
Test case: Corrupt the ugteach.json
file by changing its contents to invalid format, then start the application.
e.g. add a non-alphanumeric character to one of the student's name.
Expected: UGTeach should discard all data in the file and start with an empty ugteach.json
file.
Given below are the planned enhancements for UGTeach (to be implemented in the future).
Team size: 5
Make Add Command fields shorter: The current add command
has 7 compulsory parameters which might be tedious and long even for users who can type fast.
We plan to make the add command
shorter by making the email
field optional. This is the new format: add n/NAME p/PHONE_NUMBER a/ADDRESS t/SCHEDULE s/SUBJECT r/RATE [e/EMAIL] [paid/PAID_AMOUNT] [owed/OWED_AMOUNT]
, where parameters in square brackets are optional.
Improve duplicate detection to meet real-world use cases: The current version only considers students with both the same name and the same phone number as duplicates. We take the 2 fields as the main criteria for differentiating students, since different students may have the exact same name. However, the email address could also serve as a unique identifier for students.
In the future version, we plan to include email address as another criterion for detecting duplicates. To be specific,
The following code snippet shows how 2 students are differentiated. Specifically, this will be the updated isSameStudent
method of the Student
class.
public boolean isSameStudent(Student otherStudent) {
if (otherStudent == this) {
return true;
}
if (otherStudent == null || !otherStudent.getName().equals(getName())) {
return false;
}
return otherStudent.getPhone().equals(getPhone())
|| getEmail() == null
|| otherStudent.getEmail().equals(getEmail());
}
Allow students to have multiple classes: Currently, UGTeach only allow 1 student to have 1 subject and 1 schedule. UGTeach also forbid users from duplicating contacts.
Hence, users are unable to record multiple classes for students who require tutoring for more than one subject.
Therefore, we plan to combine the subject
and schedule
parameters to form a class
parameter that takes in 1 or more classes (comma-separated). For instance, the input
edit 1 class/Mathematics Monday-1500-1600, Science Wednesday-1200-1400
would mean the first student in UGTeach is receiving tutoring
for Mathematics on Monday (1500-1600) and Science on Wednesday (1200-1400).
Allow phone numbers from other countries: Currently, UGTeach only allows Singapore phone numbers as we assumed that students (local or international) should have a Singapore number. However, the user might provide tuition to international students who do not have a Singapore number. Hence, we plan to ease the restriction on phone numbers to allow phone numbers ranging from 3-digits to 17-digits since the shortest and longest phone number in the world are 3 and 17 digits long respectively, according to the World Population Review.
Improve UI to be horizontally scrollable: Currently, UGTeach only allows vertical scrolling as it is unlikely for students to have an extremely long name or email. Hence, 'extreme' inputs (e.g., name with 1000 characters) are truncated which might interfere with the normal usage of UGTeach. Therefore, we plan to improve the UI by adding a horizontal scroll bar so that users can view 'extreme' inputs.
Allow negative HOURS_OWED for owe
: Currently, UGTeach only allow positive multiples of 0.5 for the hours specified in the owe command
. Hence, if users have used the owe command
on mistake,
e.g. keyed in the wrong number of hours, the only way for user to revert back to the previous amount owed by the student is through remembering the previous amount owed, and edit the student's owedAmount
field using the edit command
.
This might be inconvenient for the user, as the user might not remember the previous amount that was owed by the student.
Therefore, we plan to allow negative multiples of 0.5 for the hours specified in the owe command
. If users were to make a mistake in the owe command
, he can enter the same owe command
, but with the negative hours specified.
e.g. User typed owe 1 hr/2
wrongly, when he wants to increase the owed amount of the student by 3 hours * rate
instead.
He can first type owe 1 hr/-2
to 'undo' the previous owe command, and type owe 1 hr/3
this time for the correct update.
Special cases that we handle:
owe command
is to allow user to 'undo' his mistakes made due to him specifying the wrong number of hours owed by the student.
Hence, the resulting owed amount from the execution of the owe command
should not be negative in any daily use case.Integrate pay
and settle
command to reduce user confusion: In the current version, the pay
command adds the student's payment to the paid amount, while the settle
command subtracts the amount repaid from the owed amount and adds to the paid amount. Having two commands for the two similar use cases might confuse new users.
pay hr/HOURS_PAID | amount/AMOUNT
.
pay
command accepts either hr/HOURS_PAID
or amount/AMOUNT
but not both and there must be exactly one argument given.hr/HOURS_PAID
specifies number of hours the student pays for, and the amount of HOURS_PAID * RATE
will be added to the paid amount.amount/AMOUNT
specifies the amount the student repays, which will be subtracted from the owed amount then added to the paid amount.Allow negative HOURS_PAID and negative AMOUNT for the new pay
command pay hr/HOURS_PAID | amount/AMOUNT
: Currently, UGTeach only allows positive multiples of 0.5 for the hours specified in the pay command
. Hence, if users have used the pay command
on mistake,
e.g. keyed in the wrong number of hours, the only way for user to revert back to the previous amount paid by the student is through remembering the previous amount paid, and edit the student's paidAmount
field using the edit command
.
This might be inconvenient for the user, as the user might not remember the previous amount that was paid by the student.
Therefore, we plan to allow negative multiples of 0.5 for the hours specified in the pay
command. If users were to make a mistake in the pay command
, he can enter the same pay command
, but with the negative hours specified.
e.g. User typed pay 1 hr/2
wrongly, when he wants to increase the paid amount of the student by 3 hours * rate
field of that student instead.
He can first type pay 1 hr/-2
to "undo" the previous pay command
, and type pay 1 hr/3
this time for the correct update.
Special cases that we handle:
hr/0
will still not be accepted.Similarly, we plan to also allow a negative number with at most 2 decimal places as a valid AMOUNT when the user needs to "undo" the previous settlement of the owed amount. Special cases that we handle:
amount/0
will still not be accepted.The main purpose for allowing negative hours and negative amount for the new pay command
is to allow user to "undo" his mistakes made due to him specifying the wrong number of hours paid or the wrong amount settled by the student.
Hence, the resulting paid amount from the execution of the pay command
should not be negative in any daily use case.
Enforce double confirmation for clear command: The current clear command
clears all the students in the list without any confirmation from the user.
This might be inconvenient for the user, as the user might accidentally type the clear command
and lose all the students' data.
Therefore, we plan to enforce a double confirmation for the clear command
. When the user types the clear command
, UGTeach will prompt the user to confirm the deletion of all students in the list.
The user will have to type yes
(case-insensitive) to confirm the deletion of all students in the list. If the user types anything else, the deletion will not be executed. Even typing y
will not be accepted as confirmation, to prevent accidental deletion of all students in the list.
While this might be slightly inconvenient for the fast typists, as the user will have to type more to confirm the deletion of all students in the list, this will prevent accidental deletion of all students in the list, thereby reducing the risk of complete data loss.
We believe that the benefits of preventing accidental deletion of all students in the list outweigh the slight inconvenience of having to type more to confirm the deletion of all students in the list.
Enhance storage component to save data in a backup file: Assuming user have not changed the preferences.json
file, the current storage component for UGTeach only saves data in the ugteach.json
file. If the ugteach.json
file is corrupted or deleted, all the data will be lost.
This might be inconvenient for the user, as the user might accidentally delete the ugteach.json
file or the file might be corrupted due to some reasons.
Therefore, we plan to save data in a backup file named ugteachbackup.json
. The ugteachbackup.json
file will be updated whenever the ugteach.json
file is updated.
The read and write operations will be done only on the ugteach.json
file, while the ugteachbackup.json
file will only be updated when the application needs to save the data.
If the ugteach.json
file is corrupted or deleted, the user can restore the data from the ugteach_backup.json
file.
This will prevent accidental data loss due to the deletion or corruption of the ugteach.json
file.
Example of the two files:
The following code snippet shows the planned enhancement for the storage component to save data in a backup file. Specifically, this will be the updated saveAddressBook
method for JsonAddressBookStorage
class.
public void saveAddressBook(ReadOnlyAddressBook addressBook, Path filePath) throws IOException {
requireNonNull(addressBook);
requireNonNull(filePath);
// Save to the primary file
FileUtil.createIfMissing(filePath);
JsonUtil.saveJsonFile(new JsonSerializableAddressBook(addressBook), filePath);
// Create backup file path with "backup" before ".json"
String fileName = filePath.getFileName().toString();
String backupFileName = fileName.replace(".json", "backup.json");
Path backupFilePath = filePath.resolveSibling(backupFileName);
// Save to the backup file
FileUtil.createIfMissing(backupFilePath);
JsonUtil.saveJsonFile(new JsonSerializableAddressBook(addressBook), backupFilePath);
}
This code snippet will handle the case even when user have changed their addressBookFilePath
in the preferences.json
file. The backup file will be saved in the same directory as the primary file, with the same name as the primary file, but with "backup"
before ".json"
.
The user will be informed of the backup file location and be recommended to only edit the primary data file, and not the backup file.
While the amount of storage needed might be slightly larger due to the backup file, this will prevent accidental data loss due to the deletion or corruption of the primary data file. Also, for our standalone application, the amount of storage needed for the backup file will likely not be significant, as the data stored in the ugteach.json
file is likely not large.