This commit is contained in:
unknown 2020-01-16 20:48:32 +01:00
parent 4de7f29290
commit e11a52583f
4 changed files with 9 additions and 10 deletions

View File

@ -91,8 +91,9 @@ public class TestController {
(o1, o2) -> o1.getId().compareTo(o2.getId()));
}
}
if (testToReturn.getHelp()){
for (Question question : testToReturn.getQuestions()) {
if (question.getHelp()){
if (question instanceof QuestionChoices){
QuestionChoices questionChoices = (QuestionChoices) question;
List<AnswerChoices> answers = questionChoices.getAnswers();
@ -146,7 +147,7 @@ public class TestController {
}
List<AnswerChoices> helpers = new ArrayList<>();
if (question.getType().equals("single-choice")) {
if (test.get().getHelp()){
if (question.getHelp()){
List<AnswerChoices> answers = answersDTOs;
if (answers.size() > 2) {
for (AnswerChoices answerChoices : answers){
@ -369,8 +370,6 @@ public class TestController {
test.setAddDate();
test.setEditDate();
test.setGrade();
if (testDTO.getHelp() != null)
test.setHelp(testDTO.getHelp());
// Badge for creating first test
if(userBadgeRepository.findByIdAndUser((long)4, user.getId()).isEmpty()) {
@ -551,8 +550,6 @@ public class TestController {
// System.out.println("usuwam "+oldquestion.getId());
}
}
if (testDTO.getHelp() != null)
test.setHelp(testDTO.getHelp());
testRepository.save(test);
for (Long a : deletea)

View File

@ -66,8 +66,7 @@ public class Test {
@Nullable
private Long availableTo = null;
@Column(columnDefinition = "TINYINT(1)")
private Boolean help = false;
public void setAddDate() {

View File

@ -31,8 +31,6 @@ public class TestCreateDTO {
@ApiModelProperty(value = "Default value for note", required = true,example = "public")
private String permission;
private Boolean help = false;
@JsonIgnore
private Long grade;
@JsonProperty("body")

View File

@ -68,4 +68,9 @@ public abstract class Question {
@Setter
private int time;
@Getter
@Setter
@Column(columnDefinition = "TINYINT(1)")
private Boolean help = false;
}