adicu / adi-website

[DEPRECATED] The website for the Application Development Initiative, built on Eventum.
https://adicu.com
11 stars 15 forks source link

Events that are happening today are hidden #264

Open evantarrh opened 8 years ago

evantarrh commented 8 years ago

On the front page, events that are happening on the same day aren't shown under the "events" header (or upcoming or anywhere else), although they're still visible at adicu.com/events.

eunicekokor commented 8 years ago

Possibly something on https://github.com/adicu/adi-website/blob/master/app/routes/client.py#L39

Hey @danrschlosser can you explain these lines?

events = (Event.objects(Q(end_date__gt=date.today())
                            |
                            Q(end_date=date.today(), end_time__gt=this_moment))
                   .filter(published=True)
                   .order_by('start_date', 'start_time')
                   .limit(ONE_LARGE_AND_TRIPLE))
eunicekokor commented 8 years ago

I tested this by adding fake events, however it worked as expected?

schlosser commented 8 years ago

So it's using Mongoengine advanced querying to find published events that either end on a date later than this date, or end today at a time greater than this time. (This is necessary because we store a end date and end time separately. Then we order by soonest first and limit.

@evantarrh are you sure the event you weren't seeing hadn't already ended?

evantarrh commented 8 years ago

@danrschlosser the event in question was the alumni dinner, and it definitely hadn't ended yet. It's possible it just was a one-time thing. ¯(ツ)

schlosser commented 8 years ago

We could perhaps examine the differences in the algorithm used to choose which events to show on the homepage vs events page?

eunicekokor commented 8 years ago

events page

recent_and_upcoming = Event.objects(published=True).order_by('start_date',
                                                                 'start_time')
events_this_week = list(
        recent_and_upcoming.filter(end_date__gte=today,
                                   start_date__lt=next_sunday)
    )

home page

events = (Event.objects(Q(end_date__gt=date.today())
                            |
                            Q(end_date=date.today(), end_time__gt=this_moment))
                   .filter(published=True)
                   .order_by('start_date', 'start_time')
                   .limit(ONE_LARGE_AND_TRIPLE))

I think one difference is that on the home page we use end_date__gt rather than end_date__gte (greater than or equal to). Plus the home page includes time, which makes sense, but I'm wondering if the problem might be w/ this_moment which is defined by datetime.now().time() which could maybe be using UTC time instead of nyc time which might explain why it's only a bug on production & not locally?

schlosser commented 8 years ago

Ohhhh @evantarrh with the smartness now lets see dat PR

On Sun, Dec 6, 2015, 11:40 PM eunice notifications@github.com wrote:

events page

recent_and_upcoming = Event.objects(published=True).order_by('start_date', 'start_time') events_this_week = list( recent_and_upcoming.filter(end_date__gte=today, start_date__lt=next_sunday) )

home page

events = (Event.objects(Q(end_dategt=date.today()) | Q(end_date=date.today(), end_timegt=this_moment)) .filter(published=True) .order_by('start_date', 'start_time') .limit(ONE_LARGE_AND_TRIPLE))

I think one difference is that on the home page we use end_date__gt rather than end_date__gte (greater than or equal to). Plus the home page includes time, which makes sense, but I'm wondering if the problem might be w/ this_moment which is defined by datetime.now().time() which could maybe be using UTC time instead of nyc time which might explain why it's only a bug on production & not locally?

— Reply to this email directly or view it on GitHub https://github.com/adicu/adi-website/issues/264#issuecomment-162411390.