Permalink
Browse files

183/184 gift/wish fulfillment workflow

fix so that thank you & you're welcome must be to & from same user to complete gift/wish
  • Loading branch information...
1 parent 79892d2 commit 0fefd55109dca64059db5346a08fef514f90dd66 @djudd djudd committed Apr 13, 2012
Showing with 8 additions and 8 deletions.
  1. +6 −6 records/models.py
  2. +2 −2 templates/messaging/view.html
View
@@ -206,8 +206,8 @@ def _generate_accept_message(self, giver, wisher, record):
record = record
)
- def _find_corresponding_thank_you(self, wisher, record):
- thankyous = ThankYou.objects.filter(record=record,user=wisher).order_by('-pk')
+ def _find_corresponding_thank_you(self, giver, wisher, record):
+ thankyous = ThankYou.objects.filter(record=record,user=wisher,other_user=giver).order_by('-pk')
if len(thankyous) > 0:
return thankyous[0]
else:
@@ -220,7 +220,7 @@ def create(self, commit=True):
RecordResponse._validate(giver, wisher, record)
- thank_you = self._find_corresponding_thank_you(wisher, record)
+ thank_you = self._find_corresponding_thank_you(giver, wisher, record)
if thank_you:
self.thank_you = thank_you
message = self._generate_accept_message(giver, wisher, record)
@@ -266,8 +266,8 @@ def _generate_message(self, giver, wisher, record):
record = record
)
- def _find_corresponding_youre_welcome(self, giver, record):
- welcomes = YoureWelcome.objects.filter(record=record,user=giver).order_by('-pk')
+ def _find_corresponding_youre_welcome(self, giver, wisher, record):
+ welcomes = YoureWelcome.objects.filter(record=record,user=giver,other_user=wisher).order_by('-pk')
if len(welcomes) > 0:
return welcomes[0]
else:
@@ -282,7 +282,7 @@ def create(self, commit=True):
message = self._generate_message(giver, wisher, record)
- welcome = self._find_corresponding_youre_welcome(giver, record)
+ welcome = self._find_corresponding_youre_welcome(giver, wisher, record)
if welcome:
self.youre_welcome = welcome
record.mark_completed()
@@ -27,10 +27,10 @@
{% ifequal message.recipient.pk user.pk %}
{% if record_response %}
{% if record_response.thankyou and not record_response.thankyou.has_reply %}
- <a href="/welcome?record={{ message.record.pk }}&other_user={{ message.sender.pk }}"><strong>{% trans "Accept Thank-You Note" %}</strong></a>
+ <a href="/welcome?record={{ message.record.pk }}&other_user={{ message.sender.pk }}"><strong>{% trans "Accept Thank-You Note" %}</strong></a><br />
{% endif %}
{% if record_response.yourewelcome and not record_response.yourewelcome.has_reply %}
- <a href="/thank?record={{ message.record.pk }}&other_user={{ message.sender.pk }}"><strong>{% trans "Write Thank-You Note" %}</strong></a>
+ <a href="/thank?record={{ message.record.pk }}&other_user={{ message.sender.pk }}"><strong>{% trans "Write Thank-You Note" %}</strong></a><br />
{% endif %}
{% endif %}

0 comments on commit 0fefd55

Please sign in to comment.