Compare commits

...

2 Commits

Author SHA1 Message Date
17240b8fd2 Merge pull request '#26 -- Fix variables and term spaces' (#29) from 26-remove-spaces into master
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 1m1s
Reviewed-on: #29
2025-03-14 15:47:38 +04:00
962d677f93 #26 -- Fix variables and term spaces
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 1m2s
2025-03-14 15:40:41 +04:00
3 changed files with 10 additions and 13 deletions

View File

@ -41,6 +41,12 @@ public class Variable extends BaseEntity {
this.fuzzyTerms = fuzzyTerms; this.fuzzyTerms = fuzzyTerms;
} }
public Variable(VariableForm variableForm) {
setId(variableForm.getId());
this.name = variableForm.getName();
this.input = variableForm.isInput();
}
public String getName() { public String getName() {
return name; return name;
} }

View File

@ -39,7 +39,7 @@ public class FuzzyTermService {
} else { } else {
term = getById(fuzzyTermForm.getId()); term = getById(fuzzyTermForm.getId());
} }
term.setDescription(fuzzyTermForm.getDescription()); term.setDescription(fuzzyTermForm.getDescription().replaceAll(" ", ""));
term.setCrispValue(fuzzyTermForm.getCrispValue()); term.setCrispValue(fuzzyTermForm.getCrispValue());
FuzzyTerm ft = fuzzyTermRepository.save(term); FuzzyTerm ft = fuzzyTermRepository.save(term);
if (fuzzyTermForm.getId() == null || fuzzyTermForm.getId() == 0) { if (fuzzyTermForm.getId() == null || fuzzyTermForm.getId() == 0) {

View File

@ -30,16 +30,7 @@ public class VariableService {
} }
public Variable save(VariableForm variableForm) { public Variable save(VariableForm variableForm) {
Variable variable; return save(new Variable(variableForm), variableForm.getProjectId());
if (variableForm.getId() == null || variableForm.getId() == 0) {
variable = new Variable();
} else {
variable = getById(variableForm.getId());
}
variable.setProject(projectService.getById(variableForm.getProjectId()));
variable.setName(variableForm.getName());
variable.setInput(variableForm.isInput());
return variableRepository.save(variable);
} }
public Variable save(Variable variable, Integer projectId) { public Variable save(Variable variable, Integer projectId) {
@ -50,9 +41,9 @@ public class VariableService {
dbVariable = getById(variable.getId()); dbVariable = getById(variable.getId());
} }
dbVariable.setProject(projectService.getById(projectId)); dbVariable.setProject(projectService.getById(projectId));
dbVariable.setName(variable.getName()); dbVariable.setName(variable.getName().replaceAll(" ", ""));
dbVariable.setInput(variable.isInput()); dbVariable.setInput(variable.isInput());
return variableRepository.save(variable); return variableRepository.save(dbVariable);
} }
public void delete(VariableForm ruleForm) { public void delete(VariableForm ruleForm) {