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

Display Ongoing Events on the Events Page #2167

Closed
wants to merge 4 commits into from

Conversation

saadmk11
Copy link
Contributor

closes #2138

Copy link
Member

@JacobCoffee JacobCoffee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some nits

@@ -57,6 +57,26 @@ <h3 class="event-title"><a href="{{ object.get_absolute_url }}">{{ object.title|
</ul>
</div>

{% if events_ongoing %}
<h3 class="widget-title">Ongoing Events</h3>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<h3 class="widget-title">Ongoing Events</h3>
<h3 class="widget-title">Happening Now<h3>

I feel like this is "cooler" but just a nit :)

Comment on lines +214 to +217
try:
recurring_start = recurring_starts[0]
except IndexError:
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
try:
recurring_start = recurring_starts[0]
except IndexError:
pass
with contextlib.suppress(IndexError):
recurring_start = recurring_starts[0]

except OccurringRule.DoesNotExist:
pass
else:
if occurring_rule and occurring_rule.dt_start < now and occurring_rule.dt_end > now:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if occurring_rule and occurring_rule.dt_start < now and occurring_rule.dt_end > now:
if occurring_rule and occurring_rule.dt_start < now < occurring_rule.dt_end:

Comment on lines +96 to +104
def ongoing_datetime(self, dt=None):
if dt is None:
dt = timezone.now()
else:
dt = convert_dt_to_aware(dt)
return self.filter(
(Q(occurring_rule__dt_start__lt=dt) & Q(occurring_rule__dt_end__gt=dt))
| (Q(recurring_rules__begin__lt=dt) & Q(recurring_rules__finish__gt=dt))
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def ongoing_datetime(self, dt=None):
if dt is None:
dt = timezone.now()
else:
dt = convert_dt_to_aware(dt)
return self.filter(
(Q(occurring_rule__dt_start__lt=dt) & Q(occurring_rule__dt_end__gt=dt))
| (Q(recurring_rules__begin__lt=dt) & Q(recurring_rules__finish__gt=dt))
)
def ongoing_datetime(self, dt=None):
dt = timezone.now() if dt is None else convert_dt_to_aware(dt)
return self.filter(
(Q(occurring_rule__dt_start__lt=dt) & Q(occurring_rule__dt_end__gt=dt))
| (Q(recurring_rules__begin__lt=dt) & Q(recurring_rules__finish__gt=dt))
)

@JacobCoffee
Copy link
Member

Closing in favor of #2556, I wasnt able to get this to work. I will probably yank some things from this though so ill make sure to give commit credits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Events Page - Currently ongoing events do not display
2 participants