Skip to content

Commit

Permalink
Use 'owner' payload from PRINT_DONE which is now available. Fixes #20
Browse files Browse the repository at this point in the history
…and also fixes #96.
  • Loading branch information
WildRikku committed Sep 2, 2024
1 parent ba65cd3 commit c6e85a7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion octoprint_printhistory/eventHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ def eventHandler(self, event, payload):
printTime = self._comm.getPrintTime() if self._comm is not None else ""
currentFile["printTime"] = printTime

if "owner" in payload:
currentFile["user"] = payload["user"]
else:
currentFile["user"] = ""


# when print happened and what was the result
if "history" in fileData:
Expand All @@ -126,7 +131,7 @@ def eventHandler(self, event, payload):

conn = sqlite3.connect(self._history_db_path)
cur = conn.cursor()
cur.execute("INSERT INTO print_history (fileName, note, filamentVolume, filamentLength, printTime, success, timestamp, parameters) VALUES (:fileName, :note, :filamentVolume, :filamentLength, :printTime, :success, :timestamp, :parameters)", currentFile)
cur.execute("INSERT INTO print_history (fileName, note, filamentVolume, filamentLength, printTime, success, timestamp, user, parameters) VALUES (:fileName, :note, :filamentVolume, :filamentLength, :printTime, :success, :timestamp, :user, :parameters)", currentFile)
conn.commit()
conn.close()

Expand Down

0 comments on commit c6e85a7

Please sign in to comment.