diff --git a/gittip/models/participant.py b/gittip/models/participant.py
index e3a9dc5586..ba203809a6 100644
--- a/gittip/models/participant.py
+++ b/gittip/models/participant.py
@@ -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.
diff --git a/templates/participant.html b/templates/participant.html
index 4a1bae3e07..922b4dc2e7 100644
--- a/templates/participant.html
+++ b/templates/participant.html
@@ -30,9 +30,14 @@
{{ participant.id }} receives
{% end %}
{% else %}
+ {% set age = participant.get_age_in_seconds() %}
{{ 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 %}
diff --git a/tests/test_participant_model.py b/tests/test_participant_model.py
index dde4046264..2eeb9e6fd5 100644
--- a/tests/test_participant_model.py
+++ b/tests/test_participant_model.py
@@ -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):