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

feat: sort form grid by goal progress #3818

Closed
10 tasks done
samsmith89 opened this issue Oct 31, 2018 · 11 comments
Closed
10 tasks done

feat: sort form grid by goal progress #3818

samsmith89 opened this issue Oct 31, 2018 · 11 comments
Assignees

Comments

@samsmith89
Copy link

samsmith89 commented Oct 31, 2018

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

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

kevinwhoffman commented Oct 31, 2018

@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.

@kakshak
Copy link

kakshak commented Nov 1, 2018

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.

@kevinwhoffman
Copy link
Contributor

kevinwhoffman commented Nov 2, 2018

@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.

@kevinwhoffman
Copy link
Contributor

kevinwhoffman commented Nov 2, 2018

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.

@kevinwhoffman kevinwhoffman changed the title feat: provide option to sort form grid by expiring soonest and closest to goal feat: sort form grid by goal progress Nov 2, 2018
@kevinwhoffman
Copy link
Contributor

kevinwhoffman commented Nov 14, 2018

@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.

@kakshak
Copy link

kakshak commented Nov 15, 2018

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

@ravinderk
Copy link
Collaborator

@kakshak Review this commit: d8a061c...382e42f

@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 )?

@kevinwhoffman
Copy link
Contributor

@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

@ravinderk
Copy link
Collaborator

@kevinwhoffman @kakshak Acceptance criteria updated: #3818 (comment)

@kakshak
Copy link

kakshak commented Nov 21, 2018

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.

@kakshak
Copy link

kakshak commented Nov 21, 2018

@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.

DevinWalker added a commit that referenced this issue Jan 10, 2019
* release/2.4.0:
  fix: update wpcs code formatting
  fix: resolve query for no goal exist to check if metakey is empty. resolve PHP notice and simplified give_form_search_query function
  refactor: provide better CSS for responsiveness and to match other filter bars in Give
  refactor: remove comment scss code
  refactor: print advance form search option before bulk actions
  feat: advanced filter added for donation list, query filter added for search result
  temp commit local changes before pull #3818
DevinWalker added a commit that referenced this issue Jan 10, 2019
* release/2.4.0:
  fix: update wpcs code formatting
  fix: resolve query for no goal exist to check if metakey is empty. resolve PHP notice and simplified give_form_search_query function
  refactor: provide better CSS for responsiveness and to match other filter bars in Give
  refactor: remove word "sales" from dashboard stats widget functions
  fix: add missing custom comment table before moving notes
  style: improve id and function naming
  feat: load dashboard widget with ajax
  fix: if callback for upgrade will be array then first parameter will be object of callback class
  fix: dynamically call the method of a class
  fix: improve code as optional param is now required so no conditions
  fix: update indirect access variable to support php 5 and 7
  refactor: remove comment scss code
  refactor: print advance form search option before bulk actions
  feat: advanced filter added for donation list, query filter added for search result
  temp commit local changes before pull #3818
DevinWalker added a commit that referenced this issue Jan 10, 2019
* release/2.4.0:
  docs: use proper @param to ref WP_Query
  fix: update wpcs code formatting
  fix: resolve query for no goal exist to check if metakey is empty. resolve PHP notice and simplified give_form_search_query function
  refactor: provide better CSS for responsiveness and to match other filter bars in Give
  refactor: remove word "sales" from dashboard stats widget functions
  fix: query added for search by first name + last name
  fix: add missing custom comment table before moving notes
  style: improve id and function naming
  feat: load dashboard widget with ajax
  fix: if callback for upgrade will be array then first parameter will be object of callback class
  fix: dynamically call the method of a class
  fix: convert donation id to int before comparision
  fix: remove double px border for first thead th cell
  fix: improve code as optional param is now required so no conditions
  fix: update indirect access variable to support php 5 and 7
  refactor: remove comment scss code
  refactor: print advance form search option before bulk actions
  feat: advanced filter added for donation list, query filter added for search result
  temp commit local changes before pull #3818
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

4 participants