Skip to content
This repository has been archived by the owner on Nov 25, 2017. It is now read-only.

Events that are happening today are hidden #264

Open
evantarrh opened this issue Dec 4, 2015 · 7 comments
Open

Events that are happening today are hidden #264

evantarrh opened this issue Dec 4, 2015 · 7 comments

Comments

@evantarrh
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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

@schlosser
Copy link
Member

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
Copy link
Contributor Author

@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
Copy link
Member

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

@eunicekokor
Copy link
Contributor

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
Copy link
Member

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_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?


Reply to this email directly or view it on GitHub
#264 (comment).

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

No branches or pull requests

3 participants