Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Make initial signin friendlier; #634
Browse files Browse the repository at this point in the history
This varies the message for people with no giving or receiving based on
how long they've been on the site. For the first minute, we say "just
joined Gittip!" then for a week we say "joined recently," then after
that we go with "is lurking." It was too abrasive to say "is lurking" as
the first thing people see when they join the site.
  • Loading branch information
chadwhitacre committed Feb 12, 2013
1 parent a0fe39a commit df1cc6a
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gittip/models/participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ def get_og_title(self):
out += " is"
return out + " on Gittip"

def get_age_in_seconds(self):
out = -1
if self.claimed_time is not None:
now = datetime.datetime.now(self.claimed_time.tzinfo)
out = (now - self.claimed_time).total_seconds()
return out


# TODO: Move these queries into this class.

Expand Down
5 changes: 5 additions & 0 deletions templates/participant.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ <h2 class="pad-sign">{{ participant.id }} receives</h2>
{% end %}
</div>
{% else %}
{% set age = participant.get_age_in_seconds() %}
<h2>{{ participant.id }}
{% if g > 0 %}
gives anonymously
{% elif age < 60 %}
just joined Gittip! :D
{% elif age < (60 * 60 * 24 * 7) %}
joined recently
{% else %}
is lurking
{% end %}
Expand Down
13 changes: 13 additions & 0 deletions tests/test_participant_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,19 @@ def test_gnob_looks_at_latest_tip_only(self):
assert actual == 0, actual


# get_age_in_seconds - gais

def test_gais_gets_age_in_seconds(self):
now = datetime.datetime.now(pytz.utc)
alice = self.make_participant('alice', claimed_time=now)
actual = alice.get_age_in_seconds()
assert 0 < actual < 1, actual

def test_gais_returns_negative_one_if_None(self):
alice = self.make_participant('alice', claimed_time=None)
actual = alice.get_age_in_seconds()
assert actual == -1, actual

# def get_details(self):
# def resolve_unclaimed(self):
# def set_as_claimed(self):
Expand Down

0 comments on commit df1cc6a

Please sign in to comment.