#62 remove verification of empty deadline list
This commit is contained in:
parent
d1813f656e
commit
b4a2a8086d
@ -19,9 +19,7 @@ import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.springframework.util.StringUtils.isEmpty;
|
||||
import static ru.ulstu.core.controller.Navigation.CONFERENCES_PAGE;
|
||||
import static ru.ulstu.core.controller.Navigation.CONFERENCE_PAGE;
|
||||
import static ru.ulstu.core.controller.Navigation.REDIRECT_TO;
|
||||
import static ru.ulstu.core.controller.Navigation.*;
|
||||
|
||||
|
||||
@Controller()
|
||||
@ -52,9 +50,6 @@ public class ConferenceController {
|
||||
@PostMapping(value = "/conference", params = "save")
|
||||
public String save(@Valid ConferenceDto conferenceDto, Errors errors) throws IOException {
|
||||
filterEmptyDeadlines(conferenceDto);
|
||||
if (conferenceDto.getDeadlines().isEmpty()) {
|
||||
errors.rejectValue("deadlines", "errorCode", "Не может быть пустым");
|
||||
}
|
||||
if (errors.hasErrors())
|
||||
return CONFERENCE_PAGE;
|
||||
conferenceService.save(conferenceDto);
|
||||
@ -69,6 +64,8 @@ public class ConferenceController {
|
||||
return CONFERENCE_PAGE;
|
||||
conferenceDto.getDeadlines().add(new Deadline());
|
||||
return CONFERENCE_PAGE;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void filterEmptyDeadlines(ConferenceDto conferenceDto) {
|
||||
|
@ -11,11 +11,7 @@ import ru.ulstu.user.model.UserDto;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
||||
|
||||
@ -36,7 +32,6 @@ public class ConferenceDto {
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date endDate = new Date();
|
||||
@NotEmpty
|
||||
private List<Deadline> deadlines = new ArrayList<>();
|
||||
private Set<Integer> userIds = new HashSet<>();
|
||||
private Set<Integer> paperIds = new HashSet<>();
|
||||
@ -45,8 +40,7 @@ public class ConferenceDto {
|
||||
private Integer filterUserId;
|
||||
|
||||
public ConferenceDto() {
|
||||
deadlines.add(new Deadline());
|
||||
}
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public ConferenceDto(@JsonProperty("id") Integer id,
|
||||
|
@ -60,9 +60,7 @@
|
||||
th:field="*{deadlines[__${rowStat.index}__].date}"/>
|
||||
<img class="icon icon-delete grey-border" src="/img/conference/delete.png"
|
||||
alt="Удалить"
|
||||
th:onclick="|$('#deadlines${rowStat.index}\\.description').val('');
|
||||
$('#deadlines${rowStat.index}\\.date').val('');
|
||||
$('#addDeadline').click();|"/>
|
||||
th:onclick="|$(this).parent().remove();|"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user