NeilUrquhart / TimeTable

Uni Project. MVP for a future project
0 stars 0 forks source link

Student can move from an old event even if it it's not part of that event #1

Open GrowlingM1ke opened 5 years ago

GrowlingM1ke commented 5 years ago

Currently there is an issue where the student can move from an old event EVEN if it is not part of that old event, there is no check. The following should be done:

1). In moveStudentToNewEvent method there should be a check to see if the student has the oldEvent in its list of events and return to the proper response code (See point 2).

2). Update the ResponseMove enum to contain NOT_IN_OLD_EVENT

GrowlingM1ke commented 5 years ago

The above changes have implemented on the MLBranch using the following code in

boolean hasOldEvent = false;
    for (StudentInEvent e : student.getEvents()) {
        if (e.getEvent().getId() == oldEvent.getId()) {
            hasOldEvent = true;
            break;
        }
    }
    if (!hasOldEvent) {
        return ResponseMove.NOT_IN_OLD_EVENT;
    }

Until the fix is not merged into master the issue will remain open.