Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: appengine/monorail/tracker/spam_helpers.py

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « appengine/monorail/tracker/spam.py ('k') | appengine/monorail/tracker/tablecell.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is govered by a BSD-style
3 # license that can be found in the LICENSE file or at
4 # https://developers.google.com/open-source/licenses/bsd
5
6 """Set of helpers for constructing spam-related pages.
7 """
8 from framework import template_helpers
9 from third_party import ezt
10
11 from datetime import datetime
12
13 def DecorateModerationQueue(
14 cnxn, issue_service, spam_service, user_service, moderation_items):
15 issue_ids = [item.issue_id for item in moderation_items]
16 issues = issue_service.GetIssues(cnxn, issue_ids)
17 issue_map = {}
18 for issue in issues:
19 issue_map[issue.issue_id] = issue
20
21 flag_counts = spam_service.LookUpFlagCounts(cnxn, issue_ids)
22
23 reporter_ids = [issue.reporter_id for issue in issues]
24 reporters = user_service.GetUsersByIDs(cnxn, reporter_ids)
25 comments = issue_service.GetCommentsForIssues(cnxn, issue_ids)
26
27 items = []
28 for item in moderation_items:
29 issue=issue_map[item.issue_id]
30 first_comment = comments.get(item.issue_id, ["[Empty]"])[0]
31
32 items.append(template_helpers.EZTItem(
33 issue=issue,
34 summary=template_helpers.FitUnsafeText(issue.summary, 80),
35 comment_text=template_helpers.FitUnsafeText(first_comment.content, 80),
36 reporter=reporters[issue.reporter_id],
37 flag_count=flag_counts.get(issue.issue_id, 0),
38 is_spam=ezt.boolean(item.is_spam),
39 verdict_time=item.verdict_time,
40 classifier_confidence=item.classifier_confidence,
41 reason=item.reason,
42 ))
43
44 return items
OLDNEW
« no previous file with comments | « appengine/monorail/tracker/spam.py ('k') | appengine/monorail/tracker/tablecell.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698