OZtree icon indicating copy to clipboard operation
OZtree copied to clipboard

Donor_list page, front page and other existing page updates needed to support renewals

Open jrosindell opened this issue 5 years ago • 20 comments

After discussion with Yan and some further thinking here is a strategy for implementing the donor_list page and its interaction with renewals....

Sponsor leaf page

~~- [ ] Add 'anonymous donation' button to sponsor_leaf page so people can do this if they wish~~ ~~- [ ] Rephrase text on sponsor leaf page so that it's clearer that this is the page you fill out to make an acknowledged donation. [no longer necessary because there is no anonymous donation]~~

  • [x] Remove tick box for donor_show and instead make it a radio button with some more explanation to make clear that it's about what type of acknowledgement you want - sponsored leaves only, or include collated view of leaves on donor_list page as well.

Donor list page

~~- [ ] If something expired - grey it out, show the years it was live for, remove link to the tree from it~~ (#447)

  • [x] Obviously also remove text from main tree.

To achieve this we should build the controller to check for whether sponsorships are live or not and return that information. Also, the controller should check in both the reservations and the expired reservations table for data.

Sponsored leaves page

If something has expired then it no longer appears here - so no change to make.

Front page

  • [x] If something is renewed it appears at the top of the recent sponsorship list again
  • [x] number of donors includes all that ever donated even if leaves are expired
  • [x] number of sponsored leaves is ~~only live leaves~~ all leaves that have ever been sponsored - ~~possibly a small change to the text to show this.~~

jrosindell avatar Apr 20 '20 12:04 jrosindell

The front page and donor list pages will therefore require an updated API that looks in the expired reservations table as well

jrosindell avatar Mar 12 '21 09:03 jrosindell

@hyanwong I'm wondering if on the front page we want to say "Their names have appeared as sponsors on x leaves of our tree of life" so that x can equal the total number of leaves that have ever been sponsored at any time. I think it might look bad if x decreases because people are not renewing and whilst x remains small this wording would be better.

The would be instead of saying "Their names appear as sponsors on y leaves of our tree of life" as currently, where y may decrease dramatically if things are not renewed as we hope

jrosindell avatar May 07 '21 11:05 jrosindell

@hyanwong I'm wondering if on the front page we want to say "Their names have appeared as sponsors on x leaves of our tree of life" so that x can equal the total number of leaves that have ever been sponsored at any time. I think it might look bad if x decreases because people are not renewing and whilst x remains small this wording would be better.

Yes, I think that's a good idea

hyanwong avatar May 07 '21 11:05 hyanwong

I think this is clear and should be quite an easy job for @lentinj to do with an update to the content and controller for the front page.

jrosindell avatar Nov 17 '21 17:11 jrosindell

Add 'anonymous donation' button to sponsor_leaf page so people can do this if they wish

There's already a "Make this an anonymous donation" checkbox. Is this something else?

lentinj avatar Nov 22 '21 14:11 lentinj

Obviously also remove text from main tree.

Done by default, it's not in reservations any more

lentinj avatar Nov 22 '21 14:11 lentinj

Hmm, I'm not sure. It might be that we thought it would be good to allow people to donate without having to sponsor anything. But maybe leave it for now?

hyanwong avatar Nov 22 '21 14:11 hyanwong

You could have a "Donate" pill next to the "Sponsor a leaf now!" pill that points straight to PayPal?

lentinj avatar Nov 22 '21 15:11 lentinj

If something is renewed it appears at the top of the recent sponsorship list again

Homepage sponsored item ordering is currently ORDER BY `reservations`.`verified_time` DESC, `reservations`.`reserve_time` . verified_time won't change with renewals (since the verified details are still the same, so no need to re-verify), but there isn't an obvious choice to replace it.

Best I can find is sale_time, but IIRC this isn't necessarily populated for rows added outside the standard PayPal machinations.

lentinj avatar Nov 22 '21 15:11 lentinj

number of donors includes all that ever donated even if leaves are expired number of sponsored leaves is only live leaves - possibly a small change to the text to show this.

Done with the above. Notes:

  • It counts both leaves and donors, expired and unexpired. I'm guessing that's what you meant with the revised wording.
  • Donors are counted by their PP_e_mail, probably not a great choice but I'm not sure there's anything more sensible.
  • The UNION to achieve this isn't exactly efficient, but nowt you can do about that. We should probably be looking into caching the homepage dict anyway, to save server load.

lentinj avatar Nov 22 '21 16:11 lentinj

Remove tick box for donor_show and instead make it a radio button

Done with the above. NB: We also have to do something similar to the renewals page, but I don't think there's room for the radio buttons there. OTOH, once renewing you should hopefully be more familiar with what's going on?

lentinj avatar Nov 22 '21 17:11 lentinj

If something expired - grey it out, show the years it was live for, remove link to the tree from it

This isn't particularly easy, and will mean rewriting the donor page. I'm suspecting it's not that essential in comparison to other things so leaving it, at least for now.

lentinj avatar Nov 22 '21 18:11 lentinj

Add 'anonymous donation' button to sponsor_leaf page so people can do this if they wish

There's already a "Make this an anonymous donation" checkbox. Is this something else?

It was something else, but now we have decided not to bother with it anyway, so we've crossed it out.

hyanwong avatar Nov 23 '21 11:11 hyanwong

  • Donors are counted by their PP_e_mail, probably not a great choice but I'm not sure there's anything more sensible.

I think everyone now has an reservations.username, created on verification, so we could use that. There's a script to allocate usernames for your own database at https://github.com/OneZoom/OZtree/blob/main/OZprivate/ServerScripts/Utilities/OneOff/make_usernames.py

hyanwong avatar Nov 23 '21 12:11 hyanwong

  • The UNION to achieve this isn't exactly efficient, but nowt you can do about that. We should probably be looking into caching the homepage dict anyway, to save server load.

Could we grab (a) the unique usernames from reservations (b) the unique usernames from expired reservations, and use a Python set() to count up the total number of unique entries, so that we do some of the uniqifying in python rather than in SQL?

Can do the same with the sponsored OTTs I guess, but see my comment at https://github.com/OneZoom/OZtree/commit/99f6503c1288bff6105480d34ad570c4dd67954a#r60740434 - this may make the query more efficient, as it should substantially cut down on the number of OTTs to uniqueify

hyanwong avatar Nov 23 '21 12:11 hyanwong

If something is renewed it appears at the top of the recent sponsorship list again

We think this should work as follows.

'verified_time' is used to record the time that this donation row is validated in whatever way is necessary. So for an initial sponsorship it's set when we approve the text AND payment has been received. For a renewal, however, it's only the payment receipt that's needed.

Recent things should be selected to appear on the front page based on their verified_time (maybe this is already the case) - obviously retaining the other existing logic e.g. needs to have an image.

When renewals happen the renewed rows are first copied to the expired reservations table, then the reservations table is updated with a new verified time.

This is all triggered by a successful post by PayPal so for renewals, the verified time will be when this trigger happened.

verified_time won't change with renewals (since the verified details are still the same, so no need to re-verify)

In short we will change verified_time on renewal (contrary to what you thought above): the original time will not be lost because it's been copied into the expired table. Otherwise all that you said is the same.

jrosindell avatar Nov 23 '21 13:11 jrosindell

You could have a "Donate" pill next to the "Sponsor a leaf now!" pill that points straight to PayPal?

good idea but let's leave that for now

jrosindell avatar Nov 23 '21 13:11 jrosindell

I've opened #441 for future consideration in light of @lentinj comment above

The UNION to achieve this isn't exactly efficient, but nowt you can do about that. We should probably be looking into caching the homepage dict anyway, to save server load.

jrosindell avatar Nov 23 '21 13:11 jrosindell

In short we will change verified_time on renewal (contrary to what you thought above): the original time will not be lost because it's been copied into the expired table. Otherwise all that you said is the same.

Okay, with the above we now update the verified_time to now() on renewal as opposed to inheriting it from the previous entry. This means the sorting on the homepage is a non-issue.

lentinj avatar Nov 23 '21 18:11 lentinj

The donor list page now has it's own issue: #447. Everything else should be done.

lentinj avatar Dec 01 '21 11:12 lentinj