Skip to content

Commit

Permalink
Fix listings fail to be written to the local CSV file
Browse files Browse the repository at this point in the history
Fix #89
  • Loading branch information
EtienneLamoureux committed Dec 12, 2024
1 parent 9f37a68 commit efaaaa1
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,11 @@ private Collection<List<String>> buildLines(CommoditySubmission submission) {
}

private List<String> buildLine(CommodityListing listing) {
return Arrays.asList(listing.location(), listing.transactionType().toString(),
listing.commodity(), String.valueOf(listing.price()), String.valueOf(listing.inventory()),
listing.inventoryLevel().getLabel(),
return Arrays.asList(listing.location(),
listing.transactionType() == null ? "" : listing.transactionType().toString(),
listing.commodity(), listing.price() == null ? "" : String.valueOf(listing.price()),
listing.inventory() == null ? "" : String.valueOf(listing.inventory()),
listing.inventoryLevel() == null ? "" : listing.inventoryLevel().getLabel(),
TimeUtil.getAsString(TimeFormat.CSV_COLUMN, listing.timestamp()));
}
}

0 comments on commit efaaaa1

Please sign in to comment.