diff --git a/examples/commodity-v0.1.json b/examples/commodity-v0.1.json index 3ef668c..715b243 100644 --- a/examples/commodity-v0.1.json +++ b/examples/commodity-v0.1.json @@ -14,7 +14,7 @@ "supplyLevel": "Low", "sellPrice": 1138, "demand": 42, - "demandLevel": "Med" + "demandLevel": "Med", "timestamp": "2014-11-17T12:34:56+00:00" } } \ No newline at end of file diff --git a/examples/commodity-v2.0-draft.json b/examples/commodity-v2.0-draft.json index 82a4e4b..98538a9 100644 --- a/examples/commodity-v2.0-draft.json +++ b/examples/commodity-v2.0-draft.json @@ -8,7 +8,7 @@ "message": { "systemName": "Eranin", "stationName": "Azeban Orbital", - "timestamp": "2014-11-17T12:34:56+00:00" + "timestamp": "2014-11-17T12:34:56+00:00", "commodities": [ { "name": "Gold", diff --git a/src/eddn/Monitor.py b/src/eddn/Monitor.py index 3e00f93..201accc 100644 --- a/src/eddn/Monitor.py +++ b/src/eddn/Monitor.py @@ -51,8 +51,17 @@ class Monitor(Thread): softwareID = json['header']['softwareName'] + ' | ' + json['header']['softwareVersion'] c = db.cursor() - c.execute('UPDATE uploaders SET hits = hits + 1 WHERE `name` = ? AND `dateStats` = ?', (softwareID, currentDate)) - c.execute('INSERT OR IGNORE INTO uploaders (name, dateStats) VALUES (?, ?)', (softwareID, currentDate)) + c.execute('UPDATE softwares SET hits = hits + 1 WHERE `name` = ? AND `dateStats` = ?', (softwareID, currentDate)) + c.execute('INSERT OR IGNORE INTO softwares (name, dateStats) VALUES (?, ?)', (softwareID, currentDate)) + db.commit() + + + # Update uploader count + uploaderID = json['header']['uploaderID'] + + c = db.cursor() + c.execute('UPDATE uploaders SET hits = hits + 1 WHERE `name` = ? AND `dateStats` = ?', (uploaderID, currentDate)) + c.execute('INSERT OR IGNORE INTO uploaders (name, dateStats) VALUES (?, ?)', (uploaderID, currentDate)) db.commit() @@ -66,6 +75,7 @@ class Monitor(Thread): print softwareID + print uploaderID print schemaID print currentDate sys.stdout.flush()