Open evantarrh opened 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))
I tested this by adding fake events, however it worked as expected?
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?
@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. ¯(ツ)/¯
We could perhaps examine the differences in the algorithm used to choose which events to show on the homepage vs events page?
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?
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.
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
.