From 13d1016982b9e00890847384a79e4f17fff62931 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Wed, 15 Mar 2017 17:07:52 +0000 Subject: [PATCH] Forgot to make the id unique --- app/celery/tasks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/celery/tasks.py b/app/celery/tasks.py index ae16f6c5e..4488f551d 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -1,3 +1,5 @@ +import random + import botocore from boto3 import resource from datetime import (datetime) @@ -266,7 +268,9 @@ def build_dvla_file(self, job_id): file = "" for n in notifications: t = {"content": n.template.content, "subject": n.template.subject} - template = LetterDVLATemplate(t, n.personalisation, 1) + # This unique id is a 7 digits requested by DVLA, not known if this number needs to be sequential. + unique_id = int(''.join(map(str, random.sample(range(9), 7)))) + template = LetterDVLATemplate(t, n.personalisation, unique_id) # print(str(template)) file = file + str(template) + "\n" s3upload(filedata=file,