Making WordPress.org

Opened 7 years ago

Closed 6 years ago

#2994 closed enhancement (fixed)

Make WordCamps sticky in the Events API

Reported by: iandunn's profile iandunn Owned by: iandunn's profile iandunn
Milestone: Priority: high
Component: API Keywords: good-first-bug has-patch
Cc:

Description (last modified by iandunn)

In many cities, WordCamps don't show up in the API until just a week before the event, since other meetup events happen earlier. That's not enough time to promote a large, annual event like a WordCamp, though.

This will need work on both the API and Core sides. The Core ticket is wp:#41112.

Additional background info is in wp:#41112:comment:2.

Attachments (1)

2994.diff (4.8 KB) - added by metalandcoffee 6 years ago.

Download all attachments as: .zip

Change History (12)

#1 @iandunn
7 years ago

  • Owner set to iandunn
  • Status changed from new to accepted

#2 @iandunn
7 years ago

  • Description modified (diff)

#3 follow-up: @casiepa
7 years ago

Wondering if sticky is the correct way. Not sure who would be allowed to put the sticky or how that would work.
My proposal would be like:

  • The box shows 3 events.
  • List all WordCamps in the next 3 months.
  • If there are 2 or more WordCamps, only take the 2 earliest ones and show them together with the 1 upcoming meetup, ordered by date.
  • If there is only 1 WordCamp, show in date order, together with 2 upcoming meetups
  • If there are no WordCamps, show 3 meetups.

#4 in reply to: ↑ 3 @iandunn
7 years ago

Replying to casiepa:

Not sure who would be allowed to put the sticky or how that would work.

I'm not picturing any human interaction, the "stickyness" would just be determined by the API and the Core client, similar to your proposal.

My proposal would be like:

  • The box shows 3 events.
  • List all WordCamps in the next 3 months.
  • If there are 2 or more WordCamps, only take the 2 earliest ones and show them together with the 1 upcoming meetup, ordered by date.
  • If there is only 1 WordCamp, show in date order, together with 2 upcoming meetups
  • If there are no WordCamps, show 3 meetups.

That's pretty close to what I was thinking. The only thing I'd maybe want to change would be how it handles 2+ camps.

I worry about about showing 2 camps and only 1 meetup, since there are some cities that have several meetup events per week. If only 1 is displayed, that could have the unintended side-effect of some of those events only showing up for a day or two.

I wonder if it'd be ok to increase the total # of events to 4 if there are 2+ upcoming WordCamps in the area? So, we'd show 2 meetups and 2 WordCamps. That won't be very common, so I don't think having the extra row would add too much clutter. That would allow there to still be at least 2 meetups at all times. cc @mapk

Another alternative would be to only have 1 sticky camp at a time. Either the one that's closest geographically, or the one whose date is nearest. I'd lean towards the one that's closest geographically. I think allowing 4 events sounds like a better option to me personally, though.

#5 @iandunn
6 years ago

  • Owner iandunn deleted
  • Status changed from accepted to assigned

#6 @iandunn
6 years ago

  • Keywords needs-patch good-first-bug added
  • Priority changed from normal to high

#7 @iandunn
6 years ago

List all WordCamps in the next 3 months.

I'm wondering if that's too far in advance. I think one of the main appeals of the widget is that there's always something new there, which encourages people to check it whenever they log in. I worry that if a user sees the same event every time they look at the widget, then there might be an unintended consequence where they feel like the content isn't updated regularly, and they could stop checking it as often.

I think 6 weeks might be a good balance, but I'm open to other thoughts.

Another alternative would be to only have 1 sticky camp at a time. Either the one that's closest geographically, or the one whose date is nearest. I'd lean towards the one that's closest geographically. I think allowing 4 events sounds like a better option to me personally, though.

On second thought, I don't think we even need to worry about the situation where there are multiple camps, since that's an edge case. That can definitely be a future iteration, but it's not important enough to slow down the main enhancement.

@metalandcoffee
6 years ago

#8 @metalandcoffee
6 years ago

  • Keywords has-patch added; needs-patch removed

Hello 🌻

I submitted a patch for this ticket. I added a separate query near the end of the get_events function to look for the next local WordCamp within the upcoming 6 weeks. If one is found, it'll go ahead and add it to the events[] array (removing duplicates in the process - just in case it was already in there to begin with). Then it checks to see if the events array count is less than the specified limit previously given and if it's greater, it cuts out meetup(s) with the date furthest away. That's just my way of making sure the limit/number parameter is met.

Feedback would be great!

Version 0, edited 6 years ago by metalandcoffee (next)

#9 @iandunn
6 years ago

Thanks @metalandcoffee! I tested this out today and it's working well :)

I think we might want to optimize the queries, by grabbing the extra camps in the initial query, rather than making an additional one. That kind of approach isn't always faster, but it seems like it will be in this case. We'd need to move the date_utc clause so that it just applies to meetups, and then increase the LIMIT to ~25. That introduces a filesort to the first query, but it doesn't seem to add a significant delay the the execution time, and the second query also requires a filesort anyway. I haven't tested a lot of different cities yet, though.

That change could make the PHP logic more complex than it needs to be, though, so it might not be a great tradeoff. I'm still playing around with some options to see what might be best.

#10 @iandunn
6 years ago

In 6209:

Events: Define DAY_IN_SECONDS to improve readability.

Props metalandcoffee for the initial patch
See #2994

#11 @iandunn
6 years ago

  • Owner set to iandunn
  • Resolution set to fixed
  • Status changed from assigned to closed

In 6275:

Events: Stick an upcoming WordCamp to the response to improve visibility.

Fixes #2994
Props metalandcoffee for the initial patch

Note: See TracTickets for help on using tickets.