www.fgks.org   »   [go: up one dir, main page]

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

Always show CTA banner if no reading goal exists #8606

Merged

Conversation

jimchamp
Copy link
Collaborator
@jimchamp jimchamp commented Dec 8, 2023

Closes #8580

Ensures that the main My Books page always shows one of the following:

  1. The current year's reading goal progress bar.
  2. A banner suggesting that the patron set a reading goal for the current year.

Technical

The get_reading_goals_year function has been removed, as its sole purpose was to aid in showing the banner during December. within_date_range and its unit tests have also been removed.

Banner cookie name was changed to yrgYY, where YY is the last two digits of the current year. Cookie duration has been increased to one year.

Important: After deployment, any patron who has hidden this banner will have to hide the banner one more time (due to the cookie change).

Testing

Screenshot

Stakeholders

@mekarpeles

Comment on lines 79 to 84
$ year = current_year()
$ current_goal = get_reading_goals(year=year)
$ next_year = year + 1
$ next_goal = get_reading_goals(year=next_year)

$# Is date between 1 Dec and 1 Feb?
$if not current_goal and within_date_range(12, 1, 2, 1):
$if (within_date_range(1, 1, 11, 30) and not current_goal) or (within_date_range(12, 1, 12, 31) and not next_goal):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$ year = current_year()
$ goal = get_reading_goals(year=year)
$if not goal:
    ...

rm within_date_range

@mekarpeles
Copy link
Member

Let's reapply on a fresh master and then force-push here with the code review feedback

@mekarpeles mekarpeles added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Dec 13, 2023
@jimchamp jimchamp force-pushed the 8580/bug/yrg-banner-visibility branch from 2683d51 to 7a45bd3 Compare December 13, 2023 23:43
@jimchamp jimchamp added On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing Needs: Review This issue/PR needs to be reviewed in order to be closed or merged (see comments). [managed] and removed Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] labels Dec 14, 2023
@jimchamp
Copy link
Collaborator Author

Noting here your observation about yearly reading goal "hide banner" cookie not working well on shared computers, @mekarpeles.
As a follow-up, perhaps we can set this as a User preference and set the cookie on login. The newly created clear_cookies function could also be extended to remove the current year's yrgYY cookie.

$ cookie_name = 'yrg'
$:render_template('site/banner', announcement, cookie_name, cookie_duration_days=65)
$ cookie_name = 'yrg%d' % (year % 100)
$:render_template('site/banner', announcement, cookie_name, cookie_duration_days=365)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of 365, we should use the number of days until the end of the year.

Note: either way, this shouldn't impact site behavior because the cookie name is pinned to the year and so one year cannot bleed and effect another year.

@mekarpeles mekarpeles merged commit ecfd0b1 into internetarchive:master Dec 20, 2023
3 checks passed
@jimchamp jimchamp deleted the 8580/bug/yrg-banner-visibility branch January 31, 2024 00:03
@jimchamp jimchamp removed the On testing.openlibrary.org This PR has been deployed to testing.openlibrary.org for testing label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Review This issue/PR needs to be reviewed in order to be closed or merged (see comments). [managed]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Yearly Reading Goals Start-date (make Jan 1st)
2 participants