Commit 2704f8ba authored by s7_spruge_k's avatar s7_spruge_k
Browse files

add-new-event bug fix

parent 814bf788
......@@ -121,9 +121,13 @@ public class EventController {
//--
Calendar c1 = calendarRepo.findByNameAndUser(calName, currUser);
if(c1 == null)
{
c1 = calendarRepo.findByNameAndUser(currUser.getActiveCalendar(), currUser);
}
event.setCalendar(c1);
eventValidator.validate(event, bindingResult);
if (bindingResult.hasErrors()) {
......@@ -131,12 +135,7 @@ public class EventController {
}
Calendar c1 = calendarRepo.findByNameAndUser(calName, currUser);
if(c1 == null)
{
c1 = calendarRepo.findByNameAndUser(currUser.getActiveCalendar(), currUser);
}
event.setCalendar(c1);
eventRepo.save(event);
return "redirect:/calendar";
......
......@@ -75,6 +75,7 @@ public class EventValidator implements Validator {
for (Event event : allUserEvents) {
if(e.getStartDate().equals(event.getStartDate()) && e.getStartTime().equals(event.getStartTime()))
{
errors.rejectValue("startDate", "DateTaken");
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment