File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 2222from __future__ import absolute_import , unicode_literals
2323
2424import datetime
25+ import operator
2526import re
2627
2728from orderedset import OrderedSet
@@ -184,7 +185,14 @@ def decompose_raw_fact_string(text, raw=False):
184185# Oncec LIB-251 has been fixed this should no longer be needed.
185186def get_recent_activities (controller , start , end ):
186187 """Return a list of all activities logged in facts within the given timeframe."""
187- recent_activities = [fact .activity for fact in controller .facts .get_all (start = start , end = end )]
188+ # [FIXME]
189+ # This manual sorting within python is of cause less than optimal. We stick
190+ # with it for now as this is just a preliminary workaround helper anyway and
191+ # effective sorting will need to be implemented by the storage backend in
192+ # ``hamster-lib``.
193+ facts = sorted (controller .facts .get_all (start = start , end = end ),
194+ key = operator .attrgetter ('start' ), reverse = True )
195+ recent_activities = [fact .activity for fact in facts ]
188196 return OrderedSet (recent_activities )
189197
190198
Original file line number Diff line number Diff line change @@ -350,7 +350,7 @@ def get_start_button(activity):
350350
351351 today = datetime .date .today ()
352352 start = today - datetime .timedelta (90 )
353- activities = reversed ( helpers .get_recent_activities (self ._controller , start , today ) )
353+ activities = helpers .get_recent_activities (self ._controller , start , today )
354354
355355 row_index = 0
356356 for activity in activities :
You can’t perform that action at this time.
0 commit comments