Skip to content
This repository has been archived by the owner on Jun 12, 2021. It is now read-only.

Commit

Permalink
bug 1169346, show fallbacks in about-milestone and locale_changes.
Browse files Browse the repository at this point in the history
Prior behavior was to show fallbacks as additions, which confused the
difference between old and new.
For the locale_changes, the trick is to reduce the milestone_signoffs query
to mappings where both the signoff and the milestone are for the current
appversion.
For about-milestone, we need to get the fallbacks listed, and exclude them
from the added data. For a better overview of what's new and what's old,
I'm showing them in an extra column.
  • Loading branch information
Pike committed May 28, 2015
1 parent 5f79855 commit 4c08254
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions apps/shipping/templates/shipping/about-milestone.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ <h1>About {{ms}}</h1>
<td data-ex-role="viewPanel">
<div data-ex-role="view" data-ex-showAll="true" data-ex-view-class="Tabular"
data-ex-show-toolbox="false"
data-ex-column-labels="Locale, Revision, Latest, Snapshot {% ifnotequal ms.status Milestone.SHIPPED %}, Active{% endifnotequal %},Updated from"
data-ex-columns=".label,.revision, .latest_class,.snapshot_class {% ifnotequal ms.status Milestone.SHIPPED %}, .active_class{% endifnotequal %},.updatedFrom">
data-ex-column-labels="Locale, Revision, Latest, Snapshot {% ifnotequal ms.status Milestone.SHIPPED %}, Active{% endifnotequal %},Updated from,Old"
data-ex-columns=".label,.revision, .latest_class,.snapshot_class {% ifnotequal ms.status Milestone.SHIPPED %}, .active_class{% endifnotequal %},.updatedFrom,.fallback">
<table style="display:none;">
<tr>
<td>
Expand All @@ -87,6 +87,9 @@ <h1>About {{ms}}</h1>
<a target="_blank" data-ex-href-subcontent="{% url 'pushes.views.diff' %}?from={&#123;.updatedFromRev}}&to={&#123;.revision}}&repo={{forestname}}/{&#123;.label}}">diff</a></span><span></span></span>
<span data-ex-if-exists=".added"><span class="added">added</span></span>
</td>
<td>
<span data-ex-if-exists=".fallback"><span class="added" data-ex-content=".fallback"></span></span>
</td>
</tr>
</table>
</div>
Expand Down
4 changes: 4 additions & 0 deletions apps/shipping/views/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,12 @@ def changes(request, app_code):
avrow = None # keep track of the first row
rowspan = 0
locales_group.clear()
current = {}
# we're only doing sign-offs for this appversion now, and for milestones
# of this appversion
for _mid, loc, pid in (Milestone_Signoffs.objects
.filter(milestone__appver=av)
.filter(signoff__appversion=av)
.order_by('milestone__id',
'signoff__locale__code')
.values_list('milestone__id',
Expand Down
8 changes: 7 additions & 1 deletion apps/shipping/views/milestone.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,12 @@ def runs2dict(rs, prefix=''):
'signoff__push__id',
'milestone__code'):
previous[loc] = {'signoff': sid, 'push': pid, 'stone': mcode}
fallbacks = dict(ms.signoffs
.exclude(appversion=ms.appver)
.values_list('locale__code', 'appversion__code'))
# whatever is in so_ids but not in previous is added
added = [loc for loc in so_ids.iterkeys() if loc not in previous]
added = [loc for loc in sorted(so_ids.iterkeys())
if loc not in previous and loc not in fallbacks]
removed = [] # not yet used
# drop those from previous that we're shipping in the same rev
for loc, details in previous.items():
Expand Down Expand Up @@ -147,6 +151,8 @@ def items():
d['updatedFrom'] = previous[loc]['stone']
elif loc in added:
d['added'] = 'added'
elif loc in fallbacks:
d['fallback'] = fallbacks[loc]
yield d

return HttpResponse(simplejson.dumps({'items': list(items())}, indent=2),
Expand Down

0 comments on commit 4c08254

Please sign in to comment.