Closed
Bug 528203
Opened 16 years ago
Closed 16 years ago
[dashboard][shipping] factorize and simplify _get_signoff_statuses, _get_accepted_signoff and _get_signoffs
Categories
(Mozilla Localizations :: Infrastructure, defect, P2)
Mozilla Localizations
Infrastructure
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: Pike, Assigned: Pike)
Details
Attachments
(1 file)
|
13.54 KB,
patch
|
zbraniecki
:
review+
|
Details | Diff | Splinter Review |
I think we can get around using the hand-written query in _get*signoff* with a code snippet like:
sos=list(Signoff.objects.filter(appversion=appver).annotate(latest_action=Max('action__id')).values('locale__id','id','latest_action'))
actionflags=dict(Action.objects.filter(id__in=map(lambda d: d['latest_action'], sos)).values_list('id','flag'))
actionflags[0] = 0 # migrated pending signoffs lack any action :-(
lf = defaultdict(list)
for d in sos:
lf[d['locale__id']].append(actionflags[d['latest_action'] or 0])
We can either do at least parts of the filter logic here or keep the code that cleans the arrays afterwards.
I think that we should move those three methods into at least on basic piece of code, it's hard to maintain like this right now.
| Assignee | ||
Updated•16 years ago
|
Priority: -- → P2
| Assignee | ||
Comment 2•16 years ago
|
||
The new _signoffs method is a tad funky in that it returns different things depending on params passed, but it's documented that it does, and it was the easiest way to reuse the code without making the call sites all funky.
Attachment #414378 -
Flags: review?(gandalf)
Comment 3•16 years ago
|
||
Comment on attachment 414378 [details] [diff] [review]
factor our the calls to get signoffs into a single method
nit:
"all that are new than the" -> "all that are newer than the"
r+, great stuff!
Attachment #414378 -
Flags: review?(gandalf) → review+
| Assignee | ||
Comment 4•16 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
| Assignee | ||
Updated•15 years ago
|
Summary: [dashboard] factorize and simplify _get_signoff_statuses, _get_accepted_signoff and _get_signoffs → [dashboard][shipping] factorize and simplify _get_signoff_statuses, _get_accepted_signoff and _get_signoffs
You need to log in
before you can comment on or make changes to this bug.
Description
•