PROJECT: Centralised Human Resource System (CHRS)


Overview

Centralised Human Resource System (CHRS) is an application for managing employees within the company. The application is created to assist the Human Resource Department of the company to better manage the employees' information. CHRS is capable of checking work schedule, creating recruitment posts, checking of expenses claims and storage of various information of each employee such as salary, department, position, etc.

Summary of contributions

  • Project Management:

    • Assists in approving, reviewing and merging pull requests.

  • Major enhancement: Implements Schedule feature with the following commands: addSchedule, deleteSchedule, addWorks, deleteWorks, addLeaves, deleteLeaves, calculateLeaves, clearSchedules, selectSchedule.

    • What it does: Allows the user to perform scheduling for the company.

    • Justification: This feature improves the product significantly because HR admin requires to schedule employees very often.

    • Highlights: User is able to schedule work/leave for multiple employees and multiple dates within a single command.

  • Minor enhancement: Enhanced undo/redo by implementing VersionedModelList to save and keep track of which storage has been committed changes, which is essential for undo/redo to work properly with multiple storages. (#123). Enhanced list command to lists schedules as well (#73). Enhanced delete command such that when an employee is deleted and all schedules linked to the person. (#73)

  • Code contributed: [Reposense Dashboard]

  • Other contributions:

    • GUI:

      • Updated the GUI color scheme, background, Menu Bar, Status bar, App icon and greeting when program is lunched. (#145, #168, #182)

      • Upgraded the Menu bar, when menu items clicked, edit text sets the command word, cursor points to the end of the word. Command ready to be entered. (#168)

    • Test cases:

      • Wrote additional tests for existing features to increase coverage from 70.2% to 80.6% (#222), 73.7% to 78.7% (#73), 68.8% to 74.4% (#70).

    • Documentation:

    • Community:

    • Tools:

      • Coveralls (#45) and Codacy (#46)

Contributions to the User Guide

Given below are sections I contributed to the User Guide. They showcase my ability to write documentation targeting end-users.

Add a new schedule : addSchedule

Add a new schedule for an employee.

Format: addSchedule id/EMPLOYEEID d/DATE t/TYPE or as id/EMPLOYEEID d/DATE t/TYPE

Examples:

  • addSchedule id/000001 d/02/02/2019 t/WORK
    Adds a new schedule for employee id 000001, date 02/02/2019, to work on that day.

  • as id/000001 d/03/03/2019 t/LEAVE Adds a new schedule for employee id 000001, date 03/03/2019, to be on leave for that day.

Scheduling with an employee id that doesn’t exist in the address book will be rejected.
You are not allowed to schedule for dates that have past today’s date.
Exact duplicate schedules will be rejected.

Delete an existing schedule : deleteSchedule

Deletes the specified schedule from the schedule list panel.

Format: deleteSchedule INDEX or ds INDEX

Examples:

  • deleteSchedule 1
    Deletes the schedule with the index of '1' in the list.

  • ds 2
    Deletes the schedule with the index of '2' in the list.

Add multiple work schedules : addWorks

Add work schedules for all the observable employees in the employees list pane.
Use find / filter / list to get the desired employees you wish to schedule.
All observable employees in the employees list pane will be scheduled work schedule with the date specified by the user.

Format: addWorks d/DATE [d/DATE]…​ or aw d/DATE [d/DATE]…​

Examples:

  • addWorks d/02/02/2019
    Adds a new schedule for all observable employees in the employees list panel with date 02/02/2019, to work on that day.

  • aw d/02/02/2019 d/03/03/2019
    Adds new schedules for all observable employees in the employees list panel with date 02/02/2019 and 03/03/2019, to work on that day.

For those employees whom are not scheduled with the date, the command will create a new schedule.
When all employees are scheduled with the date, the command will tell the user that every observable employee in the list have been scheduled with the specified date.
You are not allowed to schedule for dates that have past today’s date.

Delete multiple work schedules : deleteWorks

Delete work schedules for all the observable employees in the employees list pane.
Use find / filter / list to get the desired employees you wish to schedule.
All observable employees in the employees list pane will be deleted work schedules with date specified by the user.

Format: deleteWorks d/DATE [d/DATE]…​ or dw d/DATE [d/DATE]…​

Examples:

  • deleteWorks d/02/02/2019
    Deletes a schedule for all observable employees in the employees list panel with date 02/02/2019, with work on that day.

  • dw d/02/02/2019 d/03/03/2019
    Deletes schedules for all observable employees in the employees list panel with date 02/02/2019 and 03/03/2019, with work on that day.

For those employees whom are scheduled with the date, the command will delete the work schedule.
When all employees are deleted with the scheduled date, the command will tell the user every observable employees in the list does not have work schedule on the specified date.

Add multiple leave schedules : addLeaves

Add leave schedules for all the observable employees in the employees list pane.
Use find / filter / list to get the desired employees you wish to schedule.
All observable employees in the employees list pane will be scheduled with leave and date specified by the user.

Format: addLeaves d/DATE [d/DATE]…​ or al d/DATE [d/DATE]…​

Examples:

  • addLeaves d/02/02/2019
    Adds a new schedule for all observable employees in the employees list panel with date 02/02/2019, to be on leave on that day.

  • al d/02/02/2019 d/03/03/2019
    Adds new schedules for all observable employees in the employees list panel with date 02/02/2019 and 03/03/2019, to be on leave on that day.

For those employees whom are not scheduled with the date, the command will create a new leave schedule.
When all employees are scheduled with the date, the command will tell the user that every observable employees in the list have been scheduled with the specified date.
You are not allowed to schedule for dates that have past today’s date.

Delete multiple leave schedules : deleteLeaves

Delete leave schedules for all the observable employees in the employees list pane. Use find / filter / list to get the desired employees you wish to schedule. All observable employees in the employees list pane will be deleted leave schedules with date specified by the user.

Format: deleteLeaves d/DATE [d/DATE]…​ or dl d/DATE [d/DATE]…​

Examples:

  • deleteLeaves d/02/02/2019
    Deletes a schedule for all observable employees in the employees list panel with. date 02/02/2019, with leave on that day.

  • dl d/02/02/2019 d/03/03/2019
    Deletes schedules for all observable employees in the employees list panel with. date 02/02/2019 and 03/03/2019, with leave on that day.

For those employees whom are scheduled with the date, the command will delete the schedule.
When all employees are deleted with the scheduled date, the command will tell the user every observable employee in the list does not have leave schedule on the specified date.

Calculate total leaves in a year : calculateLeaves

Calculates total number of leaves scheduled for an employee for the entire specified year in the schedule list.

Format: calculateLeaves id/EMPLOYEEID y/YYYY or cl id/EMPLOYEEID y/YYYY

Examples:

  • calculateLeaves id/000001 date/2019
    Calculates total number of leave scheduled for an employee id 000001 in whole of year 2019.

  • cl id/000002 date/2020
    Calculates total number of leave scheduled for an employee id 000002 in whole of year 2020.

Select schedule in the schedule list : selectSchedule

Select a schedule based on schedule index ID.

Format: selectSchedule INDEX or ss INDEX.

Examples:

  • selectSchedule 1
    Select the schedule with the index of '1'

  • ss 1
    Select the schedule with the index of '1'

Clear the entire schedule list : clearSchedules

Clear the entire schedule list.

Format: clearSchedules. or cs.

Examples:

  • clearSchedules
    Clear the entire Schedule List.

Contributions to the Developer Guide

Given below are sections I contributed to the Developer Guide. They showcase my ability to write technical documentation and the technical depth of my contributions to the project.

Schedule Feature

Schedule command helps the HR admins to schedule employee’s work and leave schedules in the company. A person can have multiple schedules. Type field describes whether the schedule is a work or a leave. Below is the schedule class diagram.

schedule class

For each schedule commands, it comes with a dedicated schedule parser. First, the schedule parsers ensure that the prefix required are all present with !arePrefixesPresent.

    ...
    private static boolean arePrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) {
        return Stream.of(prefixes).allMatch(prefix -> argumentMultimap.getValue(prefix).isPresent());
    }
    ...

The parsers validate field inputs by creating a new Type, Date, EmployeeId and Schedule object.

        ...
        Type type = ParserUtil.parseStatus(argMultimap.getValue(PREFIX_SCHEDULE_TYPE).get());
        Date date = ParserUtil.parseDate(argMultimap.getValue(PREFIX_SCHEDULE_DATE).get());
        EmployeeId id = ParserUtil.parseEmployeeId(argMultimap.getValue(PREFIX_EMPLOYEEID).get());
        Schedule schedule = new Schedule(id, type, date);
        ...

The objects will throw exception if it does not conform to the following field restrictions.

Field Name Prefix Limitations

EMPLOYEEID

id/

Employee Id should only contain exactly 6 numbers.

DATE

d/

Date must be a valid date in the calendar DD/MM/YYYY]. Year must also fall into the range of 2000-2099. Leading 0s can be omitted in day and month field. You are not allowed to schedule for dates that have past today’s date.

TYPE

t/

Type can be either WORK or LEAVE only, case not sensitive.

Add Schedule

addSchedule command allows a new work or leave schedule to be added. Shown below is the normal flow of the sequence diagram for adding a new schedule.

addSchedule seq

In addition, Command Exception will be thrown due to the following:

  1. Employee Id of the schedule to be added is not found in address book.

  2. A duplicated schedule exists.

  3. User wants to add a work schedule, but a leave schedule exists on same date.

  4. User wants to add leave schedule, but a work schedule exists on same date.

The AddScheduleParser parses a Schedule object to the AddWorks command. AddWorks command looks at the Type inside the Schedule.

Type type = toAddSchedule.getType();

If the Type is equals to leave and work is not scheduled on the same date model.hasSchedule(toCheckWork), no exception will be thrown.

...
if (type.equals(leave)) {
    Schedule toCheckWork = new Schedule(toAddSchedule.getEmployeeId(), work,
        toAddSchedule.getScheduleDate());
    if (model.hasSchedule(toCheckWork)) {
        throw new CommandException(MESSAGE_HAS_WORK);
}
...

And it adds the schedule and commit to the storage.

...
model.addSchedule(toAddSchedule);
model.commitScheduleList();
...

Delete Schedule

deleteSchedule command allows a schedule to be deleted. Shown below is the normal flow of the sequence diagram for adding a new schedule.

deleteSchedule seq

In addition, Command Exception will be thrown due to the following:

  1. Index parsed is an invalid index in the ScheduleList panel.

Add Works

addWorks command allows multiple work schedules to be added based on the employees shown in the employee’s panel. Shown below is the normal flow of the sequence diagram for adding a working schedule.

addWorks seq

In addition, Command Exception will be thrown due to the following:

  1. Size of the filtered person list is 0. This happens when there are no employees shown.

  2. Commit is false. This happens either when all employees have been added work, or some had leave on the same day.

The AddWorksParser parses a set of dates Set<Date> to be scheduled work to the AddWorks command. For each date specified by the user in the set of dates for (Date date :setOfDates), it will be checked by for each observable employee in the employee list for (Person person : model.getFilteredPersonList()) for the possibility of scheduling work. No schedules will be created if a duplicate schedule model.hasSchedule(toAddSchedule) or existing work schedule model.hasSchedule(hasLeaveSchedule) is found on that date.

...
for (Date date :setOfDates) {
    for (Person person : model.getFilteredPersonList()) {
        Schedule toAddSchedule = new Schedule(person.getEmployeeId(), work , date);
        Schedule hasLeaveSchedule = new Schedule(person.getEmployeeId(), leave , date);
        if (model.hasSchedule(hasLeaveSchedule)) {
            employeeIdMapToLeaves.put(person.getEmployeeId(), date);
        } else if (!model.hasSchedule(toAddSchedule)) {
            commit = true;
            model.addSchedule(toAddSchedule);
        }
    }
}
...

Delete Works

deleteWorks command allows multiple work schedules to be deleted based on the employees shown in the employee’s panel. Shown below is the normal flow of the sequence diagram for deleting multiple work schedules.

deleteWorks seq

In addition, Command Exception will be thrown due to the following:

  1. Size of the filtered person list is 0. This happens when there are no employees shown.

The deleteWorksParser parses a set of dates Set<Date> to be deleted work to the DeleteWorks command.

For each date specified by the user in the set of dates for (Date date :setOfDates), it will be checked by for each observable employee in the employee list for (Person person : model.getFilteredPersonList()) for the possibility of deleting work. Work schedule will be deleted model.deleteSchedule(toDeleteSchedule) if found on that date model.hasSchedule(toDeleteSchedule).

...
for (Date date : setOfDates) {
    for (Person person : model.getFilteredPersonList()) {
        Schedule toDeleteSchedule = new Schedule(person.getEmployeeId(), work , date);
        if (model.hasSchedule(toDeleteSchedule)) {
            commit = true;
            model.deleteSchedule(toDeleteSchedule);
        }
    }
}
...

Calculate Leaves

calculateLeaves command allows user to calculate leaves taken for the specified employee id and year. Shown below is the normal flow of the sequence diagram for calculating leaves.

calculateLeaves seq

In addition, Command Exception will be thrown due to the following:

  1. Employee Id to be calculated is not found in address book.

  2. Employee Id has not taken any leaves in the specified year.

The CalculateLeavesCommandParser parses a EmployeeId and Year object to the CalculateLeaves command. CalculateLeaves filters the schedule list to show only schedules that contains the employeeId to be calculated.

List<String> employeeIdList = new ArrayList<>();
employeeIdList.add(employeeId.value);
EmployeeIdScheduleContainsKeywordsPredicate employeeIdPredicate =
        new EmployeeIdScheduleContainsKeywordsPredicate(employeeIdList);
model.updateFilteredScheduleList(employeeIdPredicate);

For each schedule in the filtered schedule list for (Schedule schedule : model.getFilteredScheduleList() if the leave and year matches the one to be calculated, it increments the number of leaves numLeaves.

...
for (Schedule schedule : model.getFilteredScheduleList()) {
    if (schedule.getScheduleYear().equals(year.toString())
            && schedule.getType().toString().equals(Type.LEAVE)) {
        numLeaves++;
    }
}
...

Finally it returns the calculated leave.

CommandResult(String.format(MESSAGE_SUCCESS, employeeId, year, numLeaves))

Send Schedule: sendSchedule [Upcoming in 2.0]

Send schedules to the employee for calendar import using the Employee’s email address. [Upcoming in 2.0]

Design considerations for Schedule Features

Aspect: Command

  • Alternative 1 (current choice): Have separate commands to add work/leave schedules.

    • Pros: Easier for the user to use, without the need to specify the type of schedule.

    • Cons: More codes needed, but easier for user to schedule for multiple employees with multiple dates.

  • Alternative 2: Have a single command to add work/leave schedule.

    • Pros: Easier to code.

    • Cons: Requires user to specify type of schedule. Can only schedule 1 at a time.

Aspect: Storage

  • Alternative 1 (current choice): Have schedules stored in a separate XML file.

    • Pros: Easier to manage scalability issues as schedules grow in numbers. Possibility of having a database for schedule in future.

    • Cons: More codes needed. Extra time is needed to delete schedules when employee is deleted.

  • Alternative 2: Have schedules stored in the same XML file as addressbook.xml

    • Pros: Pros: Easier to implement, as only an additional field is required by modeling it as a set of schedules.

    • Cons: Very hard to manage large number of schedules, or add additional fields to describe the schedule.