Skip to content

Commit

Permalink
Adding price to the CSV
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed May 8, 2024
1 parent e222b05 commit 65a28c6
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void clear() {

private void saveLocal() {
saving = true;
String csv = "name,qty,source\n";
String csv = "name,qty,source,unit price (USD)\n";
String content = null;

content = gson.toJson(database);
Expand All @@ -181,9 +181,13 @@ private void saveLocal() {
Map<String, Object> configuration = getConfiguration(e.getName());
String URL = (String) configuration.get("source");
if(URL==null) {
System.out.println(configuration);
URL="http://commonwealthrobotics.com";
}
csv += key + "," + size + "," + URL + "\n";
String price = (String) configuration.get("price");
if(price==null) {
price="0.01";
}
csv += key + "," + size + "," + URL +","+price+ "\n";
} else {
System.out.println("Failure on " + key);
}
Expand Down

0 comments on commit 65a28c6

Please sign in to comment.