Skip to content
Snippets Groups Projects
Commit 99f45390 authored by Jan Tymel's avatar Jan Tymel
Browse files

Add default values of attributes to a newly created Task

Related to #5
parent e463cca9
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ public class Task {
private String content;
private String flag;
private String solution;
private Long incorrectFlagLimit;
private int incorrectFlagLimit;
@Column(name = "order_in_training_phase", nullable = false)
private Integer order;
......@@ -75,11 +75,11 @@ public class Task {
this.solution = solution;
}
public Long getIncorrectFlagLimit() {
public int getIncorrectFlagLimit() {
return incorrectFlagLimit;
}
public void setIncorrectFlagLimit(Long incorrectFlagLimit) {
public void setIncorrectFlagLimit(int incorrectFlagLimit) {
this.incorrectFlagLimit = incorrectFlagLimit;
}
......
......@@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull;
public class PhaseCreateDTO {
@ApiModelProperty(value = "Type of phase.", required = true, allowableValues = "QUESTIONNAIRE, INFO, GAME", example = "GAME")
@ApiModelProperty(value = "Type of phase.", required = true, allowableValues = "QUESTIONNAIRE_ADAPTIVE, QUESTIONNAIRE_GENERAL, INFO, GAME", example = "TRAINING")
@NotNull(message = "Phase type must be specified")
private PhaseType phaseType;
......
......@@ -10,7 +10,7 @@ public class TaskDto implements Serializable {
private String content;
private String flag;
private String solution;
private Long incorrectFlagLimit;
private int incorrectFlagLimit;
public Long getId() {
return id;
......@@ -60,11 +60,11 @@ public class TaskDto implements Serializable {
this.solution = solution;
}
public Long getIncorrectFlagLimit() {
public int getIncorrectFlagLimit() {
return incorrectFlagLimit;
}
public void setIncorrectFlagLimit(Long incorrectFlagLimit) {
public void setIncorrectFlagLimit(int incorrectFlagLimit) {
this.incorrectFlagLimit = incorrectFlagLimit;
}
......
......@@ -41,9 +41,12 @@ public class TaskService {
// TODO add check to trainingDefinitionId (field structure will be probably changed)
Task task = new Task();
task.setTitle("Title of task");
task.setTitle("Title of a new task");
task.setTrainingPhase(trainingPhase);
task.setOrder(taskRepository.getCurrentMaxOrder(phaseId) + 1);
task.setFlag("Secret flag");
task.setContent("Task content ...");
task.setSolution("Task solution ...");
Task persistedEntity = taskRepository.save(task);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment