Givewp: feat: sort form grid by goal progress

Created on 31 Oct 2018  路  11Comments  路  Source: impress-org/givewp

Feature Request

User Story


As a site admin, I want to order my form grid by those that are expiring soonest and by forms that are closest to meeting their goal so that can create a sense of urgency on particular forms.

Possible Solution


Providing this as an option in the Give shortcode builder.

Related

https://secure.helpscout.net/conversation/693671917/27970/

Acceptance Criteria

  • [x] Create a new meta key to be added for each form that stores the normalized goal progress.
  • [x] This goal progress would be updated every time when the form is saved or when a donation occurs.
  • [x] After new donation, add/update the goal progress into donation form.
  • [x] Update the goal progress percentage when the admin changes goal types.
  • [x] Update the goal progress percentage when new donation occurs from front-side after changing goal types from admin side.
  • [x] Make sure this functionality works fine with backward compatibility with DB update script.
  • [x] Add Closest To Goal parameter in Order by a parameter in Donation Form Grid shortcode generator.
  • [x] Based on Closest To Goal parameter from shortcode generator the Form will be the sort that is nearest to goal.
  • [x] Add Closest To Goal parameter in Order by a parameter in Gutenberg Form Grid block setting ( @ravinderk )
  • [x] Review give_totals shortcode and use goal progress meta key in logic if required

All 11 comments

@kakshak please consult with @mehul0810 as to whether either one of these is possible:

  • Ordering forms by Expiration

    • I don't believe we have functionality for any type of expiration date unless the user has the Form Countdown plugin installed.

  • Ordering forms by Closest to Goal

    • This might be possible but would require a complex query because we do not store a normalized percentage of progress. We only store the goal and current amount given.

Slack Call Summary

Participants: @kakshak , @mehul0810
Topic: Discussion about provide option to sort form grid by expiring soonest and closest to goal.
Result: I have talked with Mehul regarding the Acceptance Criteria and Ordering forms by Closest to Goal scenarios. I'll check the flow of Ordering forms by Expiration by using the Form Countdown plugin installed. Mehul explained me to the flow for how we can achieve the flow for Closest to Goal.

@kakshak Do not worry about ordering by Expiration since that only applies to the Form Countdown add-on. Instead focus on ordering by Goal Progress since that is a feature that would benefit all Give core users.

Slack Call Summary

Participants: @kakshak @ravinderk @kevinwhoffman
Topic: How to sort forms by goal progress
Result: We agree there needs to be a new meta key added to each form that stores the normalized goal progress so that forms can be sorted by a common key no matter which type of goal is selected.

For example:

  • $20 out of $25 = 聽80% goal progress
  • 9 out of 10 donors = 90% goal progress
  • 99 out of 100 donations = 99% goal progress

This goal progress would be updated when the form is saved or when a donation occurs. One concern regarding backwards compatibility is that a DB update would be required in order to add this normalized goal progress as form meta for existing forms.

Since this is a more complex implementation than the other order methods, I will discuss with @DevinWalker to decide whether to pursue the feature.

@kakshak Devin confirmed in Slack that we can move forward on this feature. As we discussed above, this functionality will require a new form meta key to be added for each form going forward in addition to a database upgrade routine so that existing forms get the same key.

@kevinwhoffman I've added the acceptance criteria for this flow. Please review it and let me know about it.

@kakshak Review this commit: https://github.com/impress-org/give/compare/d8a061cc36be...382e42f77bea

@kakshak when sort form grid on basis of goal then admin form listing and front form list is different, can you review that?

@kevinwhoffmanthere there can be forms in Form Grid which do not has a goal but still, we are storing goal progress in meta key for sorting purpose. How do you want to sort these 0 goal based form list ( as in admin list or any custom logic )?

@ravinderk Ideally all of the forms without goals set at all appear at the end of the list, after forms that do have goals without progress. This may require sorting by a secondary meta key so that the forms are grouped together like so:

  • 80%
  • 60%
  • 40%
  • 0%
  • 0%
  • 0%
  • no goal set
  • no goal set

@kevinwhoffman @kakshak Acceptance criteria updated: https://github.com/impress-org/give/issues/3818#issuecomment-438536047

Slack Call Summary

Participants: @kakshak @ravinderk
Topics: Discussion on No Goal Set meta value
Discussion: I need to update the logic like if a goal is disabled for any form then update meta_key value to -1 or 0.01 (decimal). If a goal is enabled then only meta_key update to either 0 value or percentage value based on settings.

@ravinderk I've checked the meta_key value by updating with -1 and it's working fine with this. Now, the forms are grouped together perfectly.

Was this page helpful?
0 / 5 - 0 ratings