Skip to content

Commit

Permalink
Fix for #12 - Cannot Export CSV or Excel
Browse files Browse the repository at this point in the history
  • Loading branch information
imrahil committed Jun 26, 2015
1 parent 0aa8961 commit 29babb0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions octoprint_printhistory/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ def exportHistoryData(self, exportType):
for historyHash in history_dict.keys():
historyDetails = history_dict[historyHash]
output = list()
output.append(historyDetails["fileName"] if historyDetails["fileName"] else "-")
output.append(historyDetails["timestamp"] if historyDetails["timestamp"] else "-")
output.append(historyDetails["success"])
output.append(historyDetails["printTime"] if historyDetails["printTime"] else "-")
output.append(historyDetails["filamentLength"] if historyDetails["filamentLength"] else "-")
output.append(historyDetails["filamentVolume"] if historyDetails["filamentVolume"] else "-")
output.append(historyDetails["fileName"] if "fileName" in historyDetails and historyDetails["fileName"] is not None else "-")
output.append(historyDetails["timestamp"] if "timestamp" in historyDetails and historyDetails["timestamp"] is not None else "-")
output.append(historyDetails["success"] if "success" in historyDetails and historyDetails["success"] is not None else "-")
output.append(historyDetails["printTime"] if "printTime" in historyDetails and historyDetails["printTime"] is not None else "-")
output.append(historyDetails["filamentLength"] if "filamentLength" in historyDetails and historyDetails["filamentLength"] is not None else "-")
output.append(historyDetails["filamentVolume"] if "filamentVolume" in historyDetails and historyDetails["filamentVolume"] is not None else "-")

writer.writerow(output);

Expand All @@ -57,12 +57,12 @@ def exportHistoryData(self, exportType):
row = 1
for historyHash in history_dict.keys():
historyDetails = history_dict[historyHash]
worksheet.write(row, 0, (historyDetails["fileName"] if historyDetails["fileName"] else "-"))
worksheet.write(row, 1, (historyDetails["timestamp"] if historyDetails["timestamp"] else "-"))
worksheet.write(row, 2, historyDetails["success"])
worksheet.write(row, 3, (historyDetails["printTime"] if historyDetails["printTime"] else "-"))
worksheet.write(row, 4, (historyDetails["filamentLength"] if historyDetails["filamentLength"] else "-"))
worksheet.write(row, 5, (historyDetails["filamentVolume"] if historyDetails["filamentVolume"] else "-"))
worksheet.write(row, 0, (historyDetails["fileName"] if "fileName" in historyDetails and historyDetails["fileName"] is not None else "-"))
worksheet.write(row, 1, (historyDetails["timestamp"] if "timestamp" in historyDetails and historyDetails["timestamp"] is not None else "-"))
worksheet.write(row, 2, (historyDetails["success"] if "success" in historyDetails and historyDetails["success"] is not None else "-"))
worksheet.write(row, 3, (historyDetails["printTime"] if "printTime" in historyDetails and historyDetails["printTime"] is not None else "-"))
worksheet.write(row, 4, (historyDetails["filamentLength"] if "filamentLength" in historyDetails and historyDetails["filamentLength"] is not None else "-"))
worksheet.write(row, 5, (historyDetails["filamentVolume"] if "filamentVolume" in historyDetails and historyDetails["filamentVolume"] is not None else "-"))

row += 1

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
plugin_identifier = "printhistory"
plugin_package = "octoprint_%s" % plugin_identifier
plugin_name = "OctoPrint-PrintHistory"
plugin_version = "0.5.1"
plugin_version = "0.6"
plugin_description = "Saves filename, print time and filament usage for each print"
plugin_author = "Jarek Szczepanski"
plugin_author_email = "[email protected]"
Expand Down

0 comments on commit 29babb0

Please sign in to comment.