Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Highlight reminder events on conrad show #60

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions conrad/cli.py
Expand Up @@ -171,6 +171,12 @@ def _show(ctx, *args, **kwargs):
events = list(
session.query(Event).filter(*filters).order_by(Event.start_date).all()
)
reminders = list(
IamShivamJaiswal marked this conversation as resolved.
Show resolved Hide resolved
session.query(Event, Reminder)
.filter(Event.id == Reminder.id)
.order_by(Event.start_date)
.all()
)
if len(events):
header = [
"id",
Expand All @@ -197,6 +203,27 @@ def _show(ctx, *args, **kwargs):
event.end_date.strftime("%Y-%m-%d"),
]
)

reminders = list(
session.query(Event, Reminder)
.filter(Event.id == Reminder.id)
.order_by(Event.start_date)
.all()
)

events_output_event_id = [row[0] for row in events_output]

if(reminders):
for reminder, __ in reminders:
try:
event_index = events_output_event_id.index(reminder.id)
temp_event = events_output[event_index]
temp_event = [ Fore.YELLOW + Style.BRIGHT + row +Style.RESET_ALL for row in temp_event ]
events_output[event_index] = temp_event

except ValueError:
pass

session.close()

formatted = tabular_output.format_output(
Expand Down