Skip to content

Commit a6a1c4d

Browse files
authored
Merge pull request #103 from WildRikku/20_96
Use 'owner' payload from PRINT_DONE which is now available. Fixes #20
2 parents ba65cd3 + c6e85a7 commit a6a1c4d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

octoprint_printhistory/eventHandler.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ def eventHandler(self, event, payload):
102102
printTime = self._comm.getPrintTime() if self._comm is not None else ""
103103
currentFile["printTime"] = printTime
104104

105+
if "owner" in payload:
106+
currentFile["user"] = payload["user"]
107+
else:
108+
currentFile["user"] = ""
109+
105110

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

127132
conn = sqlite3.connect(self._history_db_path)
128133
cur = conn.cursor()
129-
cur.execute("INSERT INTO print_history (fileName, note, filamentVolume, filamentLength, printTime, success, timestamp, parameters) VALUES (:fileName, :note, :filamentVolume, :filamentLength, :printTime, :success, :timestamp, :parameters)", currentFile)
134+
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)
130135
conn.commit()
131136
conn.close()
132137

0 commit comments

Comments
 (0)