From 0b448a7cafc5ba5a05e76ba8a60fb094afbe4095 Mon Sep 17 00:00:00 2001 From: EncryptEx Date: Thu, 13 Mar 2025 11:36:12 +0100 Subject: [PATCH 1/2] DEVELOP TO MASTER (#381) * hotfix: qr invitation code * Added helper to travel yes on confirm * Only accept pdf on receipt * fixed status pending receipt approval and data is saved. missing email backend validation * fix bootstrap render error * fix: added devpost link validation * feat: add devpost link to organizer view * Devpost link added to pending demo validation * Reject reimbursement * fix flake8 * feat: this years' parameters * new banner * hide reimbursement tab * idnt * idnt? * deixem passar ja els cheks * idnt? * Creo q todo esta solucionado solo hace falta testeo * fix flake8 * fixed invalidate reimbursement --------- Co-authored-by: Gerard Madrid Co-authored-by: polmf <99polmf@gmail.com> Co-authored-by: enrique.andujar Co-authored-by: polmf <131487213+polmf@users.noreply.github.com> --- app/hackathon_variables.py | 2 +- app/utils.py | 8 +-- applications/emails.py | 2 +- applications/templates/dashboard.html | 18 +++++++ reimbursement/forms.py | 12 ++++- reimbursement/models.py | 9 +++- .../templates/include/devpost_form.html | 13 +++-- .../templates/include/reimbursement_form.html | 4 +- .../include/waitlisted_reimbursement.html | 5 +- .../templates/reimbursement_detail.html | 26 +++++++--- .../templates/reimbursement_hacker.html | 9 ++++ reimbursement/views.py | 49 +++++++++++++++++-- stats/views.py | 6 +-- 13 files changed, 131 insertions(+), 32 deletions(-) diff --git a/app/hackathon_variables.py b/app/hackathon_variables.py index b83194bad..493b10f8b 100644 --- a/app/hackathon_variables.py +++ b/app/hackathon_variables.py @@ -68,7 +68,7 @@ REIMBURSEMENT_ENABLED = True DEFAULT_REIMBURSEMENT_AMOUNT = 100 CURRENCY = '€' -REIMBURSEMENT_EXPIRY_DATE = timezone.datetime(2025, 5, 1, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE)) +REIMBURSEMENT_EXPIRY_DATE = timezone.datetime(2025, 5, 2, 17, 00, tzinfo=timezone.pytz.timezone(TIME_ZONE)) REIMBURSEMENT_REQUIREMENTS = 'You have to submit a project and demo it during the event in order to get reimbursed' REIMBURSEMENT_DEADLINE = timezone.datetime(2025, 5, 5, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE)) diff --git a/app/utils.py b/app/utils.py index 448982bb0..406f39f4b 100644 --- a/app/utils.py +++ b/app/utils.py @@ -235,7 +235,7 @@ def generateGTicketUrl(qrValue: str): }, "logo": { "sourceUri": { - "uri": "https://i.ibb.co/tXt96Xn/Logo-1.png", + "uri": "https://i.ibb.co/b5TQV4md/hackupc2025.png", }, "contentDescription": { "defaultValue": { @@ -298,12 +298,12 @@ def generateGTicketUrl(qrValue: str): }, }, }, - "dateTime": {"start": "2024-05-03T16:00", "end": "2024-05-05T17:00"}, + "dateTime": {"start": "2025-05-02T16:00", "end": "2025-05-04T17:00"}, "reviewStatus": "UNDER_REVIEW", - "hexBackgroundColor": "#0060BF", + "hexBackgroundColor": "#231F20", "heroImage": { "sourceUri": { - "uri": "https://i.ibb.co/2ytdRvf/Gpay-2.png", + "uri": "https://i.ibb.co/LL5T8d0/walletv2.png", }, "contentDescription": { "defaultValue": { diff --git a/applications/emails.py b/applications/emails.py index 22e580910..2b1f09a9b 100644 --- a/applications/emails.py +++ b/applications/emails.py @@ -26,7 +26,7 @@ def create_confirmation_email(application, request): c = { 'name': application.user.get_full_name, 'token': application.uuid_str, - 'qr_url': 'http://chart.googleapis.com/chart?cht=qr&chs=350x350&chl=%s' + 'qr_url': 'https://quickchart.io/qr?size=350&text=%s' % application.uuid_str, 'cancel_url': str(reverse('cancel_app', request=request, kwargs={'id': application.uuid_str})), 'is_hacker': application.user.is_hacker(), diff --git a/applications/templates/dashboard.html b/applications/templates/dashboard.html index 8ff9f58bf..3c4a876c6 100644 --- a/applications/templates/dashboard.html +++ b/applications/templates/dashboard.html @@ -193,6 +193,24 @@

When to leave

checkDietNotice(); }); + let reimb = $('input[name="reimb"]'); + let reimbursement_reminder = '\ +

Remember! You will need to submit your travel tickets after confirming your spot.

\ + '; + + reimb.on('change', function () { + if ($('input[name="reimb"]:checked').val() === 'True') { + console.log('reimb Yes'); + if ($('#reimbursement_reminder').length === 0) { + // add the reminder to the parent's child that has the help-block classname + $('#id_reimb').parent().parent().find('.help-block').append(reimbursement_reminder); + } + } else { + console.log('reimb No'); + $('#reimbursement_reminder').remove(); + } + }); + let origin = $('#origin').text().trim(); origin = origin.toLowerCase().split(','); if (origin[1].includes('barcelona') || origin[1].includes('tarragona') || origin[1].includes('lleida') || origin[1].includes('girona')){ diff --git a/reimbursement/forms.py b/reimbursement/forms.py index 6d9af9aad..877c6dead 100644 --- a/reimbursement/forms.py +++ b/reimbursement/forms.py @@ -47,6 +47,12 @@ def clean_receipt(self): "Please keep resume under %s. Current filesize %s" % (filesizeformat(settings.MAX_UPLOAD_SIZE), filesizeformat(size)) ) + # # check if is pdf + # if receipt and not receipt.name.endswith(".pdf"): + # raise forms.ValidationError("Please upload a PDF file") + + if(not receipt.name.endswith(".pdf")): + raise forms.ValidationError("Please upload a PDF file") return receipt def clean_origin(self): @@ -176,11 +182,15 @@ class Meta: labels = {"devpost": "Devpost URL"} help_texts = {"devpost": "Please provide the URL of your Devpost project"} widgets = { - "devpost": forms.TextInput(attrs={"autocomplete": "off"}), + "devpost": forms.TextInput(attrs={"autocomplete": "off", + "placeholder": "https://devpost.com/software/..."}), } def clean_devpost(self): devpost = self.cleaned_data["devpost"] if not devpost: raise forms.ValidationError("Please provide a Devpost URL") + if not devpost.startswith("https://devpost.com/software/"): + raise forms.ValidationError("Please provide a valid Software Devpost URL \ + that follows the structure: https://devpost.com/software/your-project-name") return devpost diff --git a/reimbursement/models.py b/reimbursement/models.py index 7f45c4883..c89fa6575 100644 --- a/reimbursement/models.py +++ b/reimbursement/models.py @@ -97,7 +97,7 @@ class Reimbursement(models.Model): related_name="reimbursements_made", on_delete=models.SET_NULL, ) - expiration_time = models.DateTimeField(blank=True, null=True) + expiration_time = models.DateTimeField(default=settings.REIMBURSEMENT_EXPIRY_DATE) update_time = models.DateTimeField(default=timezone.now) creation_time = models.DateTimeField(default=timezone.now) status = models.CharField(max_length=2, choices=RE_STATUS, default=RE_PEND_TICKET) @@ -157,6 +157,13 @@ def validate(self, user): self.reimbursed_by = user self.save() + def invalidate(self, user): + if self.status == RE_PEND_DEMO_VAL: + self.status = RE_WAITLISTED + self.status_update_date = timezone.now() + self.reimbursed_by = user + self.save() + def no_reimb(self, user): if self.status == RE_PEND_TICKET: self.status = RE_WAITLISTED diff --git a/reimbursement/templates/include/devpost_form.html b/reimbursement/templates/include/devpost_form.html index 67ee6381e..fbaa01c94 100644 --- a/reimbursement/templates/include/devpost_form.html +++ b/reimbursement/templates/include/devpost_form.html @@ -10,13 +10,12 @@

Devpost Submission

+ + + {% for error in form.errors.devpost %} + {{ error }} + {% endfor %} +
diff --git a/reimbursement/templates/include/reimbursement_form.html b/reimbursement/templates/include/reimbursement_form.html index 40323403f..67d3cf2a3 100644 --- a/reimbursement/templates/include/reimbursement_form.html +++ b/reimbursement/templates/include/reimbursement_form.html @@ -1,7 +1,9 @@ {% load static %} +
+
{% endif %}
@@ -64,7 +78,6 @@

Accepted

{% include 'include/field.html' with desc='Reimbursement money' value=reimb.reimbursement_money %} {% include 'include/field.html' with desc='PayPal email' value=reimb.paypal_email %} - {% include 'include/field.html' with desc='Devpost URL' value=reimb.devpost %} {% endif %} @@ -75,9 +88,10 @@

Accepted

{% csrf_token %}

Edit reimbursement

+ {% bootstrap_form edit_form %} -

diff --git a/reimbursement/templates/reimbursement_hacker.html b/reimbursement/templates/reimbursement_hacker.html index 6964d274a..8429a4dd8 100644 --- a/reimbursement/templates/reimbursement_hacker.html +++ b/reimbursement/templates/reimbursement_hacker.html @@ -13,6 +13,9 @@