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)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: Pike, Assigned: Pike)

Details

Attachments

(1 file)

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.
Taking.
Assignee: nobody → l10n
Status: NEW → ASSIGNED
Priority: -- → P2
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 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+
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
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.

Attachment

General

Created:
Updated:
Size: