This commit is contained in:
Anton Romanov 2025-01-29 20:17:39 +04:00
parent d04c61b683
commit ebb29d49d3
3 changed files with 12 additions and 9 deletions

View File

@ -1,6 +1,7 @@
package ru.ulstu.admin.model;
import ru.ulstu.indicator.model.Course;
import ru.ulstu.indicator.model.Indicator;
import java.util.ArrayList;
import java.util.List;
@ -16,6 +17,16 @@ public class IndicatorForm {
private List<Course> courses = new ArrayList<>();
public IndicatorForm() {
}
public IndicatorForm(Indicator indicator) {
this.name = indicator.getName();
this.max = indicator.getMax();
this.proofDocuments = indicator.getProofDocuments();
this.courses = indicator.getCourses();
}
public String getName() {
return name;
}

View File

@ -21,7 +21,7 @@ public class AdminIndicatorService {
public void saveIndicator(IndicatorForm indicatorForm) {
Indicator indicator = indicatorForm.getId() == null
? new Indicator(indicatorForm)
? new Indicator()
: indicatorService.getIndicatorById(indicatorForm.getId());
indicator.setName(indicatorForm.getName());
indicator.setMax(indicatorForm.getMax());

View File

@ -9,7 +9,6 @@ import jakarta.persistence.Lob;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import ru.ulstu.admin.model.IndicatorForm;
import ru.ulstu.model.BaseEntity;
import java.util.ArrayList;
@ -37,13 +36,6 @@ public class Indicator extends BaseEntity {
public Indicator() {
}
public Indicator(IndicatorForm indicatorForm) {
this.name = indicatorForm.getName();
this.max = indicatorForm.getMax();
this.proofDocuments = indicatorForm.getProofDocuments();
this.courses = indicatorForm.getCourses();
}
public String getName() {
return name;
}