Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit fc46f53

Browse files
1 parent 16cdeee commit fc46f53

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

sormas-ui/src/main/java/de/symeda/sormas/ui/samples/SampleController.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ private void saveSample(SampleCreateForm createForm) {
174174
pathogenTest.setTestedDisease((Disease) (createForm.getField(PathogenTestDto.TESTED_DISEASE)).getValue());
175175
pathogenTest.setTestDateTime((Date) (createForm.getField(PathogenTestDto.TEST_DATE_TIME)).getValue());
176176
pathogenTest.setTestResultText((String) (createForm.getField(PathogenTestDto.TEST_RESULT_TEXT)).getValue());
177-
pathogenTest.setCqValue(Float.parseFloat((String) createForm.getField(PathogenTestDto.CQ_VALUE).getValue()));
177+
String cqValue = (String) createForm.getField(PathogenTestDto.CQ_VALUE).getValue();
178+
if (cqValue != null) {
179+
pathogenTest.setCqValue(Float.parseFloat(cqValue));
180+
}
178181
FacadeProvider.getSampleFacade().saveSample(newSample);
179182
FacadeProvider.getPathogenTestFacade().savePathogenTest(pathogenTest);
180183
final EventParticipantReferenceDto eventParticipantRef = newSample.getAssociatedEventParticipant();

sormas-ui/src/main/java/de/symeda/sormas/ui/samples/SampleCreateForm.java

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import java.util.Arrays;
77
import java.util.Date;
88

9+
import com.vaadin.v7.data.util.converter.StringToFloatConverter;
910
import com.vaadin.v7.ui.CheckBox;
1011
import com.vaadin.v7.ui.ComboBox;
1112
import com.vaadin.v7.ui.TextArea;
@@ -52,6 +53,7 @@ protected void addFields() {
5253
ComboBox testTypeField = addCustomField(PathogenTestDto.TEST_TYPE, PathogenTestType.class, ComboBox.class);
5354
ComboBox testDiseaseField = addCustomField(PathogenTestDto.TESTED_DISEASE, Disease.class, ComboBox.class);
5455
TextField cqValueField = addCustomField(PathogenTestDto.CQ_VALUE, Float.class, TextField.class);
56+
cqValueField.setConverter(new StringToFloatConverter());
5557
DateTimeField testDateField = addCustomField(
5658
PathogenTestDto.TEST_DATE_TIME,
5759
I18nProperties.getPrefixCaption(PathogenTestDto.I18N_PREFIX, PathogenTestDto.TEST_DATE_TIME),

0 commit comments

Comments
 (0)