mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 07:57:07 +00:00
Update insert_event.py.
This script now works with the new event log. Fixes #234. Midnight positions can be added via a cronjob such as: $DOUGAL_ROOT/BIN/insert_event.py -t "$(date -I) 00:00:00Z" \ -l Daily -l Prod \ "Midnight position: @DMS@ (@POS@)"
This commit is contained in:
@@ -38,11 +38,11 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
message = " ".join(args["remarks"])
|
message = " ".join(args["remarks"])
|
||||||
|
|
||||||
print("new event:", schema, tstamp, message)
|
print("new event:", schema, tstamp, message, args["label"])
|
||||||
|
|
||||||
if schema and tstamp and message:
|
if schema and tstamp and message:
|
||||||
db.set_survey(schema)
|
db.set_survey(schema)
|
||||||
with db.conn.cursor() as cursor:
|
with db.conn.cursor() as cursor:
|
||||||
qry = "INSERT INTO events_timed (tstamp, remarks) VALUES (%s, %s);"
|
qry = "INSERT INTO event_log (tstamp, remarks, labels) VALUES (%s, replace_placeholders(%s, %s, NULL, NULL), %s);"
|
||||||
cursor.execute(qry, (tstamp, message))
|
cursor.execute(qry, (tstamp, message, tstamp, args["label"]))
|
||||||
db.maybe_commit()
|
db.maybe_commit()
|
||||||
|
|||||||
Reference in New Issue
Block a user