Changeset - ecff2f38c5ea
[Not reviewed]
0 2 0
Brett Smith (brett) - 4 years ago 2019-11-24 21:01:57
brett@sfconservancy.org
base_conservancy: Ready fundraiser bar for 2019.
2 files changed with 13 insertions and 7 deletions:
0 comments (0 inline, 0 general)
www/conservancy/local_context_processors.py
Show inline comments
 
from datetime import datetime as DateTime
 
from pytz import utc as UTC
 

	
 
import conservancy.settings
 
from conservancy.apps.fundgoal.models import FundraisingGoal as FundraisingGoal
 

	
 
SITE_FUNDGOAL = 'cy2018-end-year-match'
 
SITE_FUNDGOAL = 'cy2019-end-year-match'
 
# FIXME: Move this information into the model.
 
FUNDGOAL_ENDTIMES = {
 
    # End of 2019-01-15 AOE is 2019-01-16 noon UTC.
 
    # Noon UTC = the end of the previous day anywhere on Earth (AOE)
 
    'cy2018-end-year-match': DateTime(2019, 1, 16, 12, tzinfo=UTC),
 
    'cy2019-end-year-match': DateTime(2020, 1, 16, 12, tzinfo=UTC),
 
}
 

	
 
def fundgoal_lookup(fundraiser_sought):
 
    try:
 
        return FundraisingGoal.objects.get(fundraiser_code_name=fundraiser_sought)
 
    except FundraisingGoal.DoesNotExist:
www/conservancy/templates/base_conservancy.html
Show inline comments
...
 
@@ -51,26 +51,26 @@
 

	
 
* datetime_now: Current DateTime in UTC
 
* sitefundgoal: The current FundraisingGoal. Attributes:
 
  * fundraiser_goal_amount: The amount being matched
 
  * fundraiser_so_far_amount: The amount contributed so far
 
  * fundraiser_donation_count: The number of people who have contributed so far
 
  * fundraiser_donation_count_disclose_threshold: Not used
 
  * fundraiser_donation_count_disclose_threshold: The number of new Supporters that can be double-matched this fundraiser.
 
      (No, this name makes no sense. We're repurposing an existing model field for this new reason.)
 
* sitefundgoal_endtime: DateTime when sitefundgoal ends.
 

	
 
## Local convenience variables
 

	
 
* sitefundgoal_timeleft: TimeDelta for how much time remains in the current fundraiser
 
* this_match_goal: The amount being matched
 
* this_match_so_far: The amount contributed so far
 
* this_match_remaining: this_match_goal - this_match_so_far
 

	
 
{% endcomment %}
 

	
 
{% comment %}
 
{% if sitefundgoal %}
 
{% if sitefundgoal and sitefundgoal.fundraiser_so_far_amount and datetime_now < sitefundgoal_endtime %}
 
{% with this_match_goal=sitefundgoal.fundraiser_goal_amount this_match_so_far=sitefundgoal.fundraiser_so_far_amount %}
 
{% with this_match_remaining=this_match_goal|subtract:this_match_so_far sitefundgoal_timeleft=sitefundgoal_endtime|subtract:datetime_now %}
 
    <div class="fundraiser-top-text">
 
      <p>
 
        {% if this_match_remaining <= 0 %}
 
          Thanks to {{ sitegoal.fundraiser_donation_count|intcomma }} Supporters we earned our full match!
...
 
@@ -84,13 +84,19 @@
 
            Through tomorrow only, the
 
          {% elif sitefundgoal_timeleft.days < 14 %}
 
            For only {{ sitefundgoal_timeleft.days }} more days, the
 
          {% else %}
 
            The
 
          {% endif %}
 
        next ${{ this_match_remaining|floatformat:0|intcomma }} of support we receive will be matched thanks to Private Internet Access and a group of generous donors, including {{ sitefundgoal.random_providers }}!  <a href="/supporter/">Support Conservancy today!</a>
 
        next ${{ this_match_remaining|floatformat:0|intcomma }} of support we receive will be matched thanks to Private Internet Access and a group of generous donors, including {{ sitefundgoal.random_providers }}!
 

	
 
        {% if sitefundgoal.fundraiser_donation_count_disclose_threshold > 0 %}
 
          The next {{ sitefundgoal.fundraiser_donation_count_disclose_threshold|intcomma }} new Supporters will even have their donations tripled!
 
        {% endif %}
 

	
 
        <a href="/supporter/">Support Conservancy today!</a>
 
        {% endif %}
 
      </p>
 

	
 
{% if sitefundgoal.fundraiser_so_far_amount %}
 
<div id="siteprogressbar">
 
<a href="/supporter">
...
 
@@ -108,13 +114,12 @@
 
{% endif %}
 

	
 
</div>
 
{% endwith %}
 
{% endwith %}
 
{% endif %}
 
{% endcomment %}
 

	
 
      {% block outercontent %}<div id="mainContent"> {% block content %}{% endblock %}</div>{% endblock %}
 
    <div id="conservancyfooter">
 
      <p>Connect with Conservancy on
 
        <a href="https://mastodon.technology/@conservancy">Mastodon</a>,
 
        <a href="https://twitter.com/conservancy">Twitter</a>,
0 comments (0 inline, 0 general)