--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -155,7 +155,10 @@
h.text.truncate(m.name, 72),
self.url + fld.name[1:] + '/' + m.name + '/',
className='nav_child',
- small=TM.Ticket.query.find({"custom_fields._milestone": m.name, "app_config_id": c.app.config._id}).count()))
+ small=sum(1 for t in TM.Ticket.query.find({
+ "custom_fields._milestone": m.name,
+ "app_config_id": c.app.config._id})
+ if has_access(t, 'read'))))
if ticket.isdigit():
ticket = TM.Ticket.query.find(dict(app_config_id=self.config._id,ticket_num=int(ticket))).first()
else:
@@ -1124,13 +1127,18 @@
result = TM.Ticket.paged_query(
self.mongo_query, page=page, sort=sort, columns=columns, **kw)
result['allow_edit'] = has_access(c.app, 'write')()
- d = c.app.globals.milestone_count('%s:%s' % (self.field.name, self.milestone.name))
+ # get milestone progress from mongo
+ d = TM.Ticket.query.find(self.mongo_query.update(app_config_id=c.app.config._id))
+ tickets = [t for t in d if has_access(t, 'read')]
+ total = len(tickets)
+ closed = sum(1 for t in tickets
+ if t.status in c.app.globals.set_of_closed_status_names)
result.pop('q')
result.update(
field=self.field,
milestone=self.milestone,
- total=d['hits'],
- closed=d['closed'])
+ total=total,
+ closed=closed)
c.ticket_search_results = W.ticket_search_results
c.auto_resize_textarea = W.auto_resize_textarea
return result