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

Organisation-wide fundraiser-leaders? #16

Open
parkersweb opened this issue Aug 22, 2017 · 5 comments
Open

Organisation-wide fundraiser-leaders? #16

parkersweb opened this issue Aug 22, 2017 · 5 comments

Comments

@parkersweb
Copy link
Contributor

Hey guys,

On our public website we used to have a nice "top fundraisers" wall that showcased people from across all events & campaigns that were near to target and had raised over a nominal amount. That broke since API1 went away - so we're obviously looking to revive it in a shiny new API2 suit :)

Trouble is [classy-campaign-fundraiser-leaders id="12345" title="Top Fundraisers"] doesn't quite seem to fit the bill because I don't think we don't have a campaign id? Is that right?

Is there any way of achieving what we need?

Thanks!

Andrew

@dpfavand
Copy link
Contributor

@parkersweb as the plugin currently stands, no. However the API does allow you to pull all of an organization's fundraisers. I believe you could write a shortcode that would pull the following (as a starting point).

  • Fundraising pages created in the last 12 months
  • That are active (not deleted)
  • That are over 70% to goal OR that have raised over X dollars. (Note - I think there is an API bug right now preventing you from filtering on total_raised so it might not work if you try it now.)
  • Ordered by highest to lowest

so the request params would look like:

$params = array(
                'aggregates' => 'true',
                'sort'       => 'total_raised:desc',
                'per_page'   => $count,
                'with'       => 'supporter',
                'filter'     => 'status=active,created_at>=${TWELVE_MONTHS_AGO},percent_to_goal>=70'
            );

Does that sound like it would achieve your goal?

@parkersweb
Copy link
Contributor Author

@dpfavand that sounds perfect - I'm guessing it'll take some digging through the current shortcodes to work out how to build on the API from the plugin to do that - unless there's some documentation available somewhere?

@dpfavand
Copy link
Contributor

dpfavand commented Nov 6, 2017

@parkersweb it shouldn't be too difficult from the API perspective. There is documentation at https://developers.classy.org/api-docs/v2/index.html but I think the filter param above should work, provided the variable TWELVE_MONTHS_AGO is defined properly as an ISO date string without milliseconds. (Classy's API breaks if you supply ISO 8601-compliant milliseconds.)

However, the ClassyContent class would probably have to be reworked to provide caching for these options to ensure that multiple uses of the shortcode with different parameters don't clash.

@mjalkio and @cj-beck would adding this shortcode be acceptable for the plugin? I suspect we don't want a shortcode for every possible use case, but showing top organization fundraisers seems like a fairly general need and we can provide reasonable options for configuration.

I'd suggest a shortcode with these options to meet @parkersweb's needs:

  • max_page_age="365": if present, filter fundraising pages by ended_at after that number of days ago
  • min_percent_to_goal="70": if present, filter fundraising pages to show only those who raised over X percent of their goal
  • minimum_raised="1000": if present, filter fundraising pages that raised over X amount. Once API is fixed.

Perhaps the options should also be added to the campaign fundraisers and teams leaderboards? Again if we do this the caching mechanisms would have to be reworked.

@mjalkio
Copy link
Contributor

mjalkio commented Nov 6, 2017

Unfortunately, the issue you're referring to with filtering on total_raised is actually an issue with filtering by any aggregate. So a percent_to_goal filter would also not work.

Everything else seems very reasonable. I don't see the need to update the caching mechanism (although it's all on the WP side, so it's doable). It's caching whatever resource you ask for, regardless of the options you provide. Unless you have a use-case where the same resource would be requested with different settings in a single use of the plugin, the current caching should still be fine.

@dpfavand
Copy link
Contributor

dpfavand commented Nov 7, 2017

Ah good point re percent_to_goal. @parkersweb for now would a the option to show the top 5 fundraisers from the past year across all your campaigns work for you? Once the API is fixed we can look at adding a minimum threshold.

@mjalkio for caching, I'm thinking of exactly those use cases - for instance if your home page shows the top five fundraisers this year but on an inside page you show the top 50 fundraisers of all time. If the cache key is simply the org or campaign ID, they will conflict. Maybe the cache key could just be built out of the supplied shortcode/widget options?

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

No branches or pull requests

3 participants