Skip to content

Commit

Permalink
abstract lister now sorting by date before printing
Browse files Browse the repository at this point in the history
  • Loading branch information
sbillinge committed Nov 5, 2023
1 parent 5815406 commit 5d69833
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions news/l_abstracts_lists_meeting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
**Changed:**

* Abstract lister now outputs the meeting name and basic information about the meeting of the presentation
* Abstract lister now lists in date order

**Deprecated:**

Expand Down
11 changes: 7 additions & 4 deletions regolith/helpers/l_abstracthelper.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import operator

from regolith.dates import get_dates
from regolith.helpers.basehelper import SoutHelperBase
from regolith.fsclient import _id_key
Expand Down Expand Up @@ -126,17 +128,18 @@ def sout(self):
for talk in presentations
if all(talk in presentations
for presentations in nonempty_filtered_presentations_by_args)]
flat_filtered_presentations = list({talk['_id']: talk for talk in filtered_presentations}.values())

for talk in filtered_presentations:
talk.update({"meeting_date": get_dates(talk).get('date', get_dates(talk).get('end_date', get_dates(talk).get('begin_date')))})
filtered_presentations_sorted = sorted(filtered_presentations, key=operator.itemgetter('meeting_date'))
flat_filtered_presentations = list({talk['_id']: talk for talk in filtered_presentations_sorted}.values())
for presentation in flat_filtered_presentations:
if presentation.get("type") in SEMINAR_TYPES:
dereference_institution(presentation, institutions)
meeting_info = f"{presentation.get('type').title()} {presentation.get('department')}, {presentation.get('institution')}"
else:
meeting_info = f"{presentation.get('meeting_name')}, {presentation.get('location')}"
meeting_date = get_dates(presentation).get('date', get_dates(presentation).get('end_date', get_dates(presentation).get('begin_date'))).isoformat()
print("---------------------------------------")
print(f"{meeting_date} - {meeting_info}")
print(f"{presentation.get('meeting_date').isoformat()} - {meeting_info}")
print("---------------------------------------")
print(f"Title: {presentation.get('title')}\n")
author_list = [author
Expand Down

0 comments on commit 5d69833

Please sign in to comment.