Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: sitescripts/reports/bin/mailDigests.py

Issue 8625042: Reports - user usefullness (Closed)
Left Patch Set: Created Oct. 18, 2012, 1:17 p.m.
Right Patch Set: Reports - user usefulness Created Oct. 29, 2012, 12:35 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | sitescripts/reports/bin/parseNewReports.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This Source Code is subject to the terms of the Mozilla Public License 3 # This Source Code is subject to the terms of the Mozilla Public License
4 # version 2.0 (the "License"). You can obtain a copy of the License at 4 # version 2.0 (the "License"). You can obtain a copy of the License at
5 # http://mozilla.org/MPL/2.0/. 5 # http://mozilla.org/MPL/2.0/.
6 6
7 import MySQLdb, os, sys, re, marshal 7 import MySQLdb, os, sys, re, marshal
8 from datetime import date 8 from datetime import date
9 from time import time 9 from time import time
10 from email.utils import parseaddr 10 from email.utils import parseaddr
11 from sitescripts.utils import get_config, setupStderr 11 from sitescripts.utils import get_config, setupStderr
12 from sitescripts.templateFilters import formatmime 12 from sitescripts.templateFilters import formatmime
13 from sitescripts.reports.utils import mailDigest, getReports, getReportSubscript ions, calculateReportSecret, getDigestId, getDigestSecret 13 from sitescripts.reports.utils import mailDigest, getReports, getReportSubscript ions, calculateReportSecret, getDigestId, getDigestSecret, getUserUsefulnessScor e
14 import sitescripts.subscriptions.subscriptionParser as subscriptionParser 14 import sitescripts.subscriptions.subscriptionParser as subscriptionParser
15 15
16 def loadSubscriptions(): 16 def loadSubscriptions():
17 global interval, weekDay 17 global interval, weekDay
18 18
19 subscriptions = subscriptionParser.readSubscriptions() 19 subscriptions = subscriptionParser.readSubscriptions()
20 20
21 results = {} 21 results = {}
22 resultList = [] 22 resultList = []
23 for subscription in subscriptions.values(): 23 for subscription in subscriptions.values():
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 elif report['hasscreenshot'] == 2: 134 elif report['hasscreenshot'] == 2:
135 weight += 0.3 135 weight += 0.3
136 if report['knownissues'] > 0: 136 if report['knownissues'] > 0:
137 weight -= 0.3 137 weight -= 0.3
138 if report['comment'] != None: 138 if report['comment'] != None:
139 if re.search(r'\btest\b', report['comment'], re.IGNORECASE): 139 if re.search(r'\btest\b', report['comment'], re.IGNORECASE):
140 weight -= 0.5 140 weight -= 0.5
141 elif re.search(r'\S', report['comment']): 141 elif re.search(r'\S', report['comment']):
142 weight += 0.5 142 weight += 0.5
143 if report['contact'] != None: 143 if report['contact'] != None:
144 weight += 0.3 144 weight += getUserUsefulnessScore(report['contact'])
145 145
146 weight += (report['ctime'] - startTime) / (currentTime - startTime) * 0.2 146 weight += (report['ctime'] - startTime) / (currentTime - startTime) * 0.2
147 return weight 147 return weight
148 148
149 if __name__ == '__main__': 149 if __name__ == '__main__':
150 setupStderr() 150 setupStderr()
151 151
152 if len(sys.argv) < 2: 152 if len(sys.argv) < 2:
153 raise Exception('No interval specified') 153 raise Exception('No interval specified')
154 154
(...skipping 10 matching lines...) Expand all
165 if interval == 'week': 165 if interval == 'week':
166 startTime = currentTime - 7*24*60*60 166 startTime = currentTime - 7*24*60*60
167 elif interval == 'day': 167 elif interval == 'day':
168 startTime = currentTime - 24*60*60 168 startTime = currentTime - 24*60*60
169 169
170 fakeSubscription = {'url': 'https://fake.adblockplus.org', 'name': get_config( ).get('reports', 'defaultSubscriptionName'), 'email': get_config().get('reports' , 'defaultSubscriptionRecipient')} 170 fakeSubscription = {'url': 'https://fake.adblockplus.org', 'name': get_config( ).get('reports', 'defaultSubscriptionName'), 'email': get_config().get('reports' , 'defaultSubscriptionRecipient')}
171 subscriptions, subscriptionList = loadSubscriptions() 171 subscriptions, subscriptionList = loadSubscriptions()
172 subscriptionList.append(fakeSubscription) 172 subscriptionList.append(fakeSubscription)
173 reports = scanReports() 173 reports = scanReports()
174 sendNotifications(reports) 174 sendNotifications(reports)
LEFTRIGHT

Powered by Google App Engine
This is Rietveld