mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 15:15:38 -05:00
Use a simpler method of generating random number
Rather than generating each digit of the number, generate the whole
random number in one go. Should be faster, and is a bit easier to read.
Don’t need to worry about it not being zero-padded because the
`Template` class handles this here:
6ddd2ff352/notifications_utils/template.py (L410)
This commit is contained in:
@@ -273,7 +273,7 @@ def build_dvla_file(self, job_id):
|
||||
notification.personalisation,
|
||||
# This unique id is a 7 digits requested by DVLA, not known
|
||||
# if this number needs to be sequential.
|
||||
numeric_id=int(''.join(map(str, random.sample(range(9), 7)))),
|
||||
numeric_id=random.randint(1, int('9' * 7)),
|
||||
))
|
||||
for notification in dao_get_all_notifications_for_job(job_id)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user