Skip to content

Commit

Permalink
Merge pull request #302 from hackupc/develop
Browse files Browse the repository at this point in the history
Develop to Master
  • Loading branch information
EncryptEx authored Mar 13, 2024
2 parents e28c562 + cf9d7e0 commit dfabe7e
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 17 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/deployProd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Deploy on Production

on:
push:
branches:
- 'master'

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Git pull and rebuild docker
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
port: ${{ secrets.PORT }}
key: ${{ secrets.SSHKEY }}
script: ${{ secrets.PRODSCRIPT }}
2 changes: 1 addition & 1 deletion app/hackathon_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
CURRENCY = '€'
REIMBURSEMENT_EXPIRY_DAYS = 5
REIMBURSEMENT_REQUIREMENTS = 'You have to submit a project and demo it during the event in order to get reimbursed'
REIMBURSEMENT_DEADLINE = timezone.datetime(2023, 5, 11, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
REIMBURSEMENT_DEADLINE = timezone.datetime(2024, 5, 5, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))

# (OPTIONAL) Max team members. Defaults to 4
TEAMS_ENABLED = True
Expand Down
28 changes: 25 additions & 3 deletions applications/forms/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,16 @@ class ConfirmationInvitationForm(BootstrapFormMixin, forms.ModelForm):
'fields': [{'name': 'tshirt_size', 'space': 4}, {'name': 'diet', 'space': 4},
{'name': 'other_diet', 'space': 4},
{'name': 'reimb', 'space': 12}, {'name': 'reimb_amount', 'space': 12},
{'name': 'terms_and_conditions', 'space': 12}, {'name': 'mlh_required_terms', 'space': 12},
{'name': 'mlh_required_privacy', 'space': 12}, {'name': 'mlh_subscribe', 'space': 12}
{'name': 'terms_and_conditions', 'space': 12},
{'name': 'mlh_required_terms', 'space': 12},
{'name': 'mlh_required_privacy', 'space': 12}, {'name': 'mlh_subscribe', 'space': 12},
{'name': 'diet_notice', 'space': 12}
],
},
}

diet = forms.ChoiceField(label='Dietary requirements', choices=models.DIETS, required=True)

reimb = forms.TypedChoiceField(
required=False,
label='Do you need a travel reimbursement to attend?',
Expand All @@ -160,7 +163,7 @@ class ConfirmationInvitationForm(BootstrapFormMixin, forms.ModelForm):
initial=False,
widget=forms.RadioSelect(),
help_text='We only provide travel reimbursement if you attend from outside of Catalonia, '
'you can find more info in our website\'s FAQ'
'you can find more info in our website\'s <a target="_blank" href="https://hackupc.com/#faqs">FAQs</a>.'
)

mlh_required_terms = forms.BooleanField(
Expand All @@ -174,6 +177,12 @@ class ConfirmationInvitationForm(BootstrapFormMixin, forms.ModelForm):
"Organizer Newsletters and other communications from MLH."
)

diet_notice = forms.BooleanField(
required=False,
label='I authorize "Hackers at UPC" to use my food allergies and intolerances information to '
'manage the catering service only.<span style="color: red; font-weight: bold;"> *</span>'
)

mlh_required_privacy = forms.BooleanField(
label="I authorize you to share my application/registration information with Major League Hacking for "
"event administration, ranking, and MLH administration in-line with the MLH "
Expand Down Expand Up @@ -224,6 +233,19 @@ def clean_mlh_optional_communications(self):
)
return cc


def clean_diet_notice(self):
diet = self.cleaned_data.get('diet', 'None')
diet_notice = self.cleaned_data.get('diet_notice', False)
# Check that if it's the first submission hackers checks terms and conditions checkbox
# self.instance.pk is None if there's no Application existing before
# https://stackoverflow.com/questions/9704067/test-if-django-modelform-has-instance
if diet != 'None' and not diet_notice and not self.instance.pk:
raise forms.ValidationError(
"In order to apply and attend you have to accept us to use your personal data related to your food "
"allergies and intolerances only in order to manage the catering service."
)
return diet_notice
def clean_other_diet(self):
data = self.cleaned_data.get('other_diet', '')
diet = self.cleaned_data.get('diet', 'None')
Expand Down
1 change: 0 additions & 1 deletion applications/forms/volunteer.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class VolunteerApplicationForm(_BaseApplicationForm):
night_shifts = forms.TypedChoiceField(
required=True,
label="¿Estarias de acuerdo en seguir ayudando pasado medianoche?",
coerce=lambda x: x == "True",
choices=models.NIGHT_SHIFT_ES,
help_text="No exigimos a nadie quedarse hasta ninguna hora en particular",
widget=forms.RadioSelect,
Expand Down
2 changes: 1 addition & 1 deletion applications/models/hacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class HackerApplication(
reimb = models.BooleanField(default=False)
reimb_amount = models.FloatField(blank=True, null=True, validators=[
MinValueValidator(0, "Negative? Really? Please put a positive value"),
MaxValueValidator(150.0, "Not that much")])
MaxValueValidator(200.0, "Do not exceed the maximum amount of 200")])

# Info for hardware
hardware = models.CharField(max_length=300, null=True, blank=True)
Expand Down
21 changes: 21 additions & 0 deletions applications/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ <h3>When to leave</h3>
{% include 'include/deadline_countdown.html' with timeleft=invite_timeleft %}</b>
</p>
<p>Please confirm that this information regarding your application is correct. If you see that something's not right, now is the time to change it!</p>
<p><b><span style="color:#E23532;">Disclaimer:</span></b> <span style="color:#FC5C5A;">We cannot guarantee that the meat provided at the event will be Halal. We strongly advise to consider opting for a vegetarian diet instead.</span></p>
{% include 'include/bootstrap_form.html' with form=confirm_form %}
<script src="{% static 'js/form_modifiers.js' %}"></script>
<script>
Expand All @@ -155,6 +156,26 @@ <h3>When to leave</h3>
conditional_field(other_diet, diet, function () {
return diet.val() === 'Others';
}, 1);

diet_notice = $('#id_diet_notice');
conditional_field(diet_notice, diet, function () {
return diet.val() !== 'None';
}, 1);

function checkDietNotice(){
if(diet.val() !== 'None'){
diet_notice.parent().parent().parent().addClass('required');
diet_notice.attr('required', 'true');
}else{
diet_notice.removeAttr('required');
diet_notice.parent().parent().parent().removeClass('required');
}
}
checkDietNotice();
diet.on('change', function () {
checkDietNotice();
});

let needs_reimb = $('input[name="reimb"][value="True"]');
let no_reimb = $('input[name="reimb"][value="False"]');
let reimb_amout = $('#id_reimb_amount');
Expand Down
2 changes: 1 addition & 1 deletion applications/templates/mails/confirmation_subject.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Ticket to {{ h_name }}
Your ticket to {{ h_name }}
29 changes: 25 additions & 4 deletions applications/templates/mails/include/cancel.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
<p>If you cannot make it, please let us know by clicking "Cancel".</p>
<p>If you cannot make it, please let us know by clicking the "Cancel" button.</p>
{% if is_hacker %}
<p>We want as many people as possible to experience the hackathon!</p>
{% endif %}
<p style="text-align: center">
<a href="{{ cancel_url }}">Cancel</a>
</p>
<table border="0" cellpadding="0" cellspacing="0"
class="btn btn-primary"
style="border-collapse:separate;mso-table-lspace:0pt;mso-table-rspace:0pt;box-sizing:border-box;width:100%;">
<tbody>
<tr>
<td align="center"
style="font-family:sans-serif;font-size:14px;vertical-align:top;padding-bottom:15px;">
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse:separate;mso-table-lspace:0pt;mso-table-rspace:0pt;width:100%;width:auto;">
<tbody>
<tr>
<td style="font-family:sans-serif;font-size:14px;vertical-align:top;background-color:#7F27A2;border-radius:5px;text-align:center; margin: 0 auto;">
<a href="{{ cancel_url }}" target="_blank"
style="text-decoration:underline;border:solid 1px #7F27A2;border-radius:5px;box-sizing:border-box;cursor:pointer;display:inline-block;font-size:14px;font-weight:bold;margin:0;padding:12px 25px;text-decoration:none;text-transform:capitalize;background-color:#7F27A2;color:#ffffff;">
Cancel
</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
10 changes: 5 additions & 5 deletions applications/templates/mails/invitation_hacker_message.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<p>
Congratulations {{ name }}, you have been officially invited to <b>{{ h_name }}</b>!
</p>
{% include 'mails/include/email_button.html' with text='Review & Confirm' url=confirm_url %}
<p>
Respond to this invitation by clicking on the "Confirm" link below.
<b>Please confirm your spot within 5 days of receiving this email. Otherwise we will give your spot to another
hacker on the waitlist.</b>
Confirm your spot by clicking on the "Confirm" link above within <b>5 days of receiving this email</b>.
Otherwise we will give your spot to another hacker on the waitlist.
</p>
<p>
After clicking, you will be redirected to our site and asked to confirm your dietary requirements, travel reimbursement amount and t-shirt size. We need to make sure that information’s right!
After clicking, you will be redirected to our site and asked to confirm your dietary requirements, travel reimbursement amount and t-shirt size. We need to make sure that the information is right!
</p>
{% include 'mails/include/email_button.html' with text='Review & Confirm' url=confirm_url %}

{% include 'mails/include/cancel.html' %}
{% if reimb.waitlisted %}
{% include 'include/waitlisted_reimbursement.html' %}
Expand Down
2 changes: 1 addition & 1 deletion applications/templates/mails/invitation_hacker_subject.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Congrats! You have been accepted!
Confirm your spot!

0 comments on commit dfabe7e

Please sign in to comment.