Commit 9c3c0fa8 authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Add skip for existent actions

parent 40492ba6
...@@ -22,16 +22,20 @@ class Command(BaseCommand): ...@@ -22,16 +22,20 @@ class Command(BaseCommand):
@transaction.atomic @transaction.atomic
def handle(self, *args, **options): def handle(self, *args, **options):
answered_actions_ids = Action.objects.filter(verb='answered').values_list('id', flat=True) answered_actions_ids = Action.objects.filter(verb='answered').values_list('action_object_object_id', flat=True)
counter = 0
# Create any missing Answer action # Create any missing Answer action
for answer in Answer.objects.all(): answers = Answer.objects.all()
for answer in answers:
activity_id = answer.activity_id activity_id = answer.activity_id
user = answer.user user = answer.user
verb = 'answered' verb = 'answered'
#if in answered_actions_ids: if str( in answered_actions_ids:
# continue continue
timesince = djtimesince(answer.timestamp).encode('utf8').replace(b'\xc2\xa0', b' ').decode('utf8') timesince = djtimesince(answer.timestamp).encode('utf8').replace(b'\xc2\xa0', b' ').decode('utf8')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment