Index: sitescripts/reports/utils.py |
=================================================================== |
--- a/sitescripts/reports/utils.py |
+++ b/sitescripts/reports/utils.py |
@@ -99,6 +99,12 @@ |
template.stream(reportData).dump(file, encoding='utf-8') |
def removeReport(guid): |
+ reportData = getReport(guid) |
+ if (reportData.get('email', None)): |
+ utility = reportData['utility'] |
+ contact = getUserId(reportData['email']) |
+ updateUserUtility(contact, utility) |
Wladimir Palant
2012/10/18 15:45:52
So you are updating user's score only after 30 day
|
+ |
cursor = get_db().cursor() |
executeQuery(cursor, |
'''DELETE FROM #PFX#reports WHERE guid = %s''', |
@@ -111,6 +117,20 @@ |
if os.path.isfile(file): |
os.remove(file) |
+def updateUserUtility(contact, utility): |
+ if utility == 0: |
+ return |
+ cursor = get_db().cursor() |
+ if utility > 0: |
+ executeQuery(cursor, |
+ '''UPDATE #PFX#users SET positive = positive + 1 WHERE id = %s''', |
+ (contact)) |
+ else: |
+ executeQuery(cursor, |
+ '''UPDATE #PFX#users SET negative = negative + 1 WHERE id = %s''', |
+ (contact)) |
+ get_db().commit() |
+ |
def saveScreenshot(guid, screenshot): |
prefix = 'data:image/png;base64,' |
if not screenshot.startswith(prefix): |