From 77728535293cebc02bb85bb2a0e76441f0f31344 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Tue, 17 Jul 2018 14:36:46 +0200
Subject: [PATCH] number is shortened by one digit

---
 smash/web/forms/voucher_forms.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/smash/web/forms/voucher_forms.py b/smash/web/forms/voucher_forms.py
index 67dabe3c..12aaa876 100644
--- a/smash/web/forms/voucher_forms.py
+++ b/smash/web/forms/voucher_forms.py
@@ -70,7 +70,7 @@ class VoucherForm(ModelForm):
             instance.expiry_date = instance.issue_date + datetime.timedelta(days=90)
             max_id = str(1).zfill(5)
             if Voucher.objects.all().count() > 0:
-                max_id = str(Voucher.objects.latest('id').id + 1).zfill(5)
+                max_id = str(Voucher.objects.latest('id').id + 1).zfill(4)
             # number in format  {ND_NUMBER}-{DATE}-{VOUCHER_TYPE_CODE}-{VOUCHER_TYPE}-{SEQ_NUMBER}{CHECKSUM}
             instance.number = instance.study_subject.nd_number + "-" + \
                               datetime.datetime.now().strftime("%Y%m%d") + "-" + \
-- 
GitLab