Exemple #1
0
 def check_due_reminder(self):
     time_passed = datetime.date.today() - self.due_date
     if time_passed.days == -3 and self.current_state in self.DUE_STATES:
         state_change_signal.send(
                 sender=self,
                 role='system',
                 action=6,
                 previous_state=-1,
             )
         logger.info('#%s trade due reminder sent' % self.id)
Exemple #2
0
 def move_state(self, role, action):
     try:
         self.lease.move_state(role, action)
         self.previous_state = self.lease.previous_state
         self.current_state = self.lease.current_state            
         self.request_status = self.lease.request_status
         self.sequence = self.lease.sequence
         self.save()
         state_change_signal.send(
             sender=self,
             role=role,
             action=action,
             previous_state=self.previous_state,
         )
     except Lease.DoesNotExist:
         self.sale.move_state(role, action)
         self.previous_state = self.sale.previous_state
         self.current_state = self.sale.current_state
         self.request_status = self.sale.request_status
         self.sequence = self.sale.sequence
         self.save()
         state_change_signal.send(
             sender=self,
             role=role,
             action=action,
             previous_state=self.previous_state,
         )
     
     # reset unread cache when action required condtion changed
     if self.action_required('seller') is not self.action_required('seller', True):
         reset_unread_cache(self.seller)
     if self.action_required('buyer') is not self.action_required('buyer', True):
         reset_unread_cache(self.buyer)
     
     # update response rate and accept count
     if self.current_state in [4, 5, 6, 10]:
         if self.current_state == 10:
             self.update_acceptance()
         # either clicked ignored or never respond
         elif self.previous_state == 3 or self.current_state == 4 and self.previous_state == 2:
             self.update_non_response()
         else:
             self.update_response()