Skip to content

Commit

Permalink
Fixes and closes #911 - additional seedbank field
Browse files Browse the repository at this point in the history
  • Loading branch information
djtfmartin committed Jun 16, 2023
1 parent 42beccd commit 568f632
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class SeedbankInterpreter {
.map(SeedbankTerm.numberTested, SeedbankInterpreter::setNumberTested)
.map(SeedbankTerm.dateInStorage, this::interpretDateInStorage)
.map(SeedbankTerm.dateCollected, this::interpretDateCollected)
.map(SeedbankTerm.numberNotViable, SeedbankInterpreter::setNumberNotViable)
.map(SeedbankTerm.testDateStarted, this::interpretTestDateStarted);

@Builder(buildMethodName = "create")
Expand Down Expand Up @@ -229,6 +230,14 @@ public static void setNumberTested(SeedbankRecord sr, String value) {
}
}

public static void setNumberNotViable(SeedbankRecord sr, String value) {
try {
sr.setNumberNotViable(Long.parseLong(value));
} catch (Exception e) {
// do nothing
}
}

public void interpretDateCollected(SeedbankRecord sr, String dateCollected) {
if (dateCollected != null) {
String normalised =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public enum SeedbankTerm implements Term {
numberFull,
numberGerminated,
numberPlantsSampled,
numberNotViable,
numberTested,
plantForm,
pretreatment,
Expand Down
3 changes: 2 additions & 1 deletion sdks/models/src/main/avro/json/common-json-record.avsc
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@
{"name": "testDateStarted", "type": ["null", "long"], "default": null},
{"name": "testLengthInDays", "type": ["null", "double"], "default": null},
{"name": "thousandSeedWeight", "type": ["null", "double"], "default": null},
{"name": "viabilityPercentage", "type": ["null", "double"], "default": null}
{"name": "viabilityPercentage", "type": ["null", "double"], "default": null},
{"name": "numberNotViable", "type": ["null", "long"], "default": null}
]
}
]

0 comments on commit 568f632

Please sign in to comment.