diff --git a/tildes/tildes/templates/intercooler/invite_code.jinja2 b/tildes/tildes/templates/intercooler/invite_code.jinja2 index dd81f1f..5f4a7f7 100644 --- a/tildes/tildes/templates/intercooler/invite_code.jinja2 +++ b/tildes/tildes/templates/intercooler/invite_code.jinja2 @@ -1,12 +1,18 @@ - +
+ {% if num_remaining > 0 %} + + {% else %} +

You don't currently have any invite codes available.

+ {% endif %} +

You have the following invite codes active that have not been used yet:

+
-{% if num_remaining > 0 %} - -{% endif %} + diff --git a/tildes/tildes/templates/invite.jinja2 b/tildes/tildes/templates/invite.jinja2 index 4689995..e8b0f33 100644 --- a/tildes/tildes/templates/invite.jinja2 +++ b/tildes/tildes/templates/invite.jinja2 @@ -17,23 +17,29 @@
+
+ {% if request.user.invite_codes_remaining > 0 %} + + {% else %} +

You don't currently have any invite codes available.

+ {% endif %} + {% if codes %} -

You have the following invite codes active that have not been used yet:

+

You have the following invite codes active that have not been used yet:

+
{% for code in codes %} {% endfor %} -{% endif %} - -{% if request.user.invite_codes_remaining > 0 %} - {% else %} -

You don't currently have any invite codes available.

+ {% endif %} + {% endblock %} diff --git a/tildes/tildes/views/user.py b/tildes/tildes/views/user.py index 3b3da0b..220a4d4 100644 --- a/tildes/tildes/views/user.py +++ b/tildes/tildes/views/user.py @@ -70,6 +70,7 @@ def get_invite(request: Request) -> dict: UserInviteCode.user_id == request.user.user_id, UserInviteCode.invitee_id == None, # noqa ) + .order_by(desc(UserInviteCode.created_time)) .all() )