Skip to content

Update deadlines #383

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/hackathon_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
HACKATHON_GITHUB_REPO = 'https://github.com/hackupc/myhackupc/'

# (OPTIONAL) Applications deadline
HACKATHON_APP_DEADLINE = timezone.datetime(2030, 4, 24, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
VOLUNTEER_APP_DEADLINE = timezone.datetime(2030, 4, 18, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
MENTOR_APP_DEADLINE = timezone.datetime(2030, 3, 25, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
HACKATHON_APP_DEADLINE = timezone.datetime(2025, 4, 21, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
VOLUNTEER_APP_DEADLINE = timezone.datetime(2025, 4, 11, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
MENTOR_APP_DEADLINE = timezone.datetime(2025, 4, 21, 23, 59, tzinfo=timezone.pytz.timezone(TIME_ZONE))
# (OPTIONAL) Online checkin activated
ONLINE_CHECKIN = timezone.datetime(2020, 5, 3, 17, 00, tzinfo=timezone.pytz.timezone(TIME_ZONE))
# (OPTIONAL) When to arrive at the hackathon
Expand All @@ -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))

Expand Down
8 changes: 4 additions & 4 deletions app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion applications/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
18 changes: 18 additions & 0 deletions applications/templates/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,24 @@ <h3>When to leave</h3>
checkDietNotice();
});

let reimb = $('input[name="reimb"]');
let reimbursement_reminder = '\
<p id="reimbursement_reminder"><b style="color: #E23532">Remember!</b> You will need to submit your travel tickets after confirming your spot.</p>\
';

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')){
Expand Down
12 changes: 11 additions & 1 deletion reimbursement/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
9 changes: 8 additions & 1 deletion reimbursement/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions reimbursement/templates/include/devpost_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ <h3 class="heading-primary">Devpost Submission</h3>
<div class="col-md-12">
<div class="form-group {% if form.errors.devpost_link %} has-error{% endif %}">
<label for="id_devpost_link">Devpost Link <span style="color: red">*</span></label>
<input class="form-control" id="devpost" name="devpost" placeholder="https://devpost.com/your-project-name" type="url" value="{{ form.devpost_link.value }}">
{% if form.errors.devpost_link %}
<span class="help-block
{% if form.errors.devpost_link %} has-error{% endif %}">{{ form.errors.devpost_link }}</span>
{% endif %}
<small id="devpost-error" class="form-text text-muted" style="color:red" hidden>Please provide the link to your project on Devpost.</small>
</div>
<input class="form-control" id="devpost" name="devpost" placeholder="https://devpost.com/software/your-project-name" type="url" value="{{ form.devpost_link.value }}">

{% for error in form.errors.devpost %}
<small id="devpost-error" class="form-text text-muted" style="color:red">{{ error }}</small>
{% endfor %}
</div>
</div>
</div>
</fieldset>
Expand Down
4 changes: 3 additions & 1 deletion reimbursement/templates/include/reimbursement_form.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{% load static %}
<form class="signup " enctype="multipart/form-data" id="signup_form" method="post" action="" name="reimbursement_form">
{% csrf_token %}
{% include 'include/bootstrap_form.html' %}
{% if form %}
{% include 'include/bootstrap_form.html' %}
{% endif %}
<small><span style="color: red">*</span>Indicates required field</small>

<button class="btn btn-success btn-block" type="submit">Submit receipt</button>
Expand Down
5 changes: 2 additions & 3 deletions reimbursement/templates/include/waitlisted_reimbursement.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<p>Unfortunately, we don't have enough budget to cover your travel expenses. We would like to have enough money for
everyone but our budget is limited. We added you to our travel reimbursement wait list.
Hope you can still make it! If you can't, please cancel your application invite.</p>
<p>Unfortunately, we don't have enough budget to cover your travel expenses, or the project you submitted was invalid. We would like to have enough money for
everyone but our budget is limited. We have added you to our travel reimbursement wait list.</p>
26 changes: 20 additions & 6 deletions reimbursement/templates/reimbursement_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,27 @@ <h3>Status</h3>
{% if reimb.public_comment %}
{% include 'include/field.html' with desc='Reject reason' value=reimb.public_comment %}
{% endif %}
{% if reimb.devpost %}
{% include 'include/field.html' with desc='Devpost Link' value='<a href="'|add:reimb.devpost|add:'" target="_blank">'|add:reimb.devpost|add:"</a>"|safe %}
{% endif %}
{% if reimb.is_pending_demo_validation %}
<br>
<form action="" method="post" name="validate_form">
{% csrf_token %}
<input type="hidden" name="id" value="{{ reimb.pk }}"/>
<button name="validate" class="btn btn-success btn-block"
value="validate">Validate
</button>

<div class="col-md-6" style="padding: 0; display: flex; gap: 10px; width: 100%;">
<button name="validate" class="btn btn-success btn-block"
value="validate">Validate
</button>
<br>
<button name="invalidate" class="btn btn-danger btn-block"
value="invalidate">Invalidate
</button>
</div>
</form>
<br>
<hr>
{% endif %}
<hr>
<dt>
Expand All @@ -64,7 +78,6 @@ <h3>Accepted</h3>
<dd></dd>
{% 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 %}
</dl>
</div>
Expand All @@ -75,9 +88,10 @@ <h3>Accepted</h3>
<form action="" method="post" class="form" name="edit_form">
{% csrf_token %}
<h4>Edit reimbursement</h4>
<input type="hidden" name="id" value="{{ reimb.pk }}"/>
{% bootstrap_form edit_form %}
<button name="invite" class="btn btn-success btn-block"
value="invite">Submit changes
<button name="edit" class="btn btn-success btn-block"
value="edit">Submit changes
</button>
</form>
<br>
Expand Down
9 changes: 9 additions & 0 deletions reimbursement/templates/reimbursement_hacker.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<script src="{% static 'js/form_modifiers.js' %}"></script>
<script>
$(document).ready(function () {
let receipt = document.getElementById('id_receipt');
receipt.accept = '.pdf';

fetch('{% static 'cities.json' %}')
.then((response) => response.json())
.then((json) => {
Expand Down Expand Up @@ -95,6 +98,7 @@ <h3>Reimbursement information</h3>
{% elif reimbursement.is_accepted %}
{% include "include/devpost_form.html" %}
{% endif %}
<br>
<dt>Origin</dt>
<dd>{{ reimbursement.origin }}</dd>
<br>
Expand All @@ -108,6 +112,7 @@ <h3>Reimbursement information</h3>
{{ reimbursement.reimbursement_money }}{{ h_currency }}
{% endif %}
</dd>
<br>
<dt>Uploaded Receipt</dt>
<dd>
<a href="{{ reimbursement.receipt.url }}" target="_blank">{{ reimbursement.receipt.name }}</a>
Expand All @@ -123,6 +128,10 @@ <h3>Reimbursement information</h3>
<small>comment by {{ reimbursement.reimbursed_by.email|urlize }}</small>
</dd>
{% endif %}
{% if reimbursement.devpost %}
<dt>Devpost Link</dt>
<dd><a href="{{ reimbursement.devpost }}" target="_blank">{{ reimbursement.devpost }}</a></dd>
{% endif %}
</dl>


Expand Down
49 changes: 45 additions & 4 deletions reimbursement/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def get_context_data(self, **kwargs):
return c

def post(self, request, *args, **kwargs):
if "reimbursement_form" in request.POST:
# check reimbursment status and act accordingly
# if status is pending demo link, then validate the devpost link
# if status is pending receipt, then validate the receipt
if request.user.reimbursement.status == models.RE_PEND_TICKET:
try:
form = forms.ReceiptSubmissionReceipt(
request.POST, request.FILES, instance=request.user.reimbursement
Expand All @@ -52,13 +55,14 @@ def post(self, request, *args, **kwargs):
if form.is_valid():
reimb = form.save(commit=False)
reimb.hacker = request.user
# set status to pending demo link
reimb.status = models.RE_PEND_APPROVAL
reimb.save()
messages.success(
request,
"We have now received your reimbursement. "
"Processing will take some time, so please be patient.",
)

return HttpResponseRedirect(reverse("reimbursement_dashboard"))
else:
c = self.get_context_data()
Expand Down Expand Up @@ -119,7 +123,7 @@ def get_context_data(self, **kwargs):
return c

def post(self, request, *args, **kwargs):
if "edit_form" in request.POST:
if "edit" in request.POST:
id_ = kwargs.get("id", None)
reimb = models.Reimbursement.objects.get(pk=id_)
form = forms.EditReimbursementForm(request.POST, instance=reimb)
Expand All @@ -133,7 +137,7 @@ def post(self, request, *args, **kwargs):
return render(
request, self.template_name, {"reimb": reimb, "edit_form": form}
)
if "validate" in request.POST:
elif "validate" in request.POST:
id_ = kwargs.get("id", None)
reimb = models.Reimbursement.objects.get(pk=id_)
form = forms.ValidateReimbursementForm(request.POST, instance=reimb)
Expand All @@ -147,6 +151,27 @@ def post(self, request, *args, **kwargs):
return render(
request, self.template_name, {"reimb": reimb, "validate_form": form}
)
elif "reject" in request.POST:
id_ = kwargs.get("id", None)
reimb = models.Reimbursement.objects.get(pk=id_)
form = forms.RejectReceiptForm(request.POST, instance=reimb)
if form.is_valid():
form.save(commit=False)
m = form.instance.reject_receipt(request.user, request)
m.send()
form.save()
messages.success(request, "Receipt rejected")
else:
a_form = forms.AcceptReceiptForm(instance=reimb)
r_form = forms.RejectReceiptForm(instance=reimb)
c = self.get_context_data()
c.update({"reject_form": r_form, "accept_form": a_form})
return render(request, self.template_name, c)
elif "invalidate" in request.POST:
id_ = kwargs.get("id", None)
reimb = models.Reimbursement.objects.get(pk=id_)
reimb.invalidate(request.user)
messages.success(request, "Reimbursement invalidated")
else:
id_ = request.POST.get("id", None)
reimb = models.Reimbursement.objects.get(pk=id_)
Expand Down Expand Up @@ -203,6 +228,9 @@ def get_context_data(self, **kwargs):
"reject_form": forms.RejectReceiptForm(instance=reimb),
"review": True,
"accept_form": forms.AcceptReceiptForm(instance=reimb),
"back_url": reverse("receipt_review"),
"edit_form": forms.EditReimbursementForm(instance=reimb),
"form": forms.ReceiptSubmissionReceipt(instance=reimb)
}
)
return c
Expand All @@ -212,6 +240,7 @@ def post(self, request, *args, **kwargs):
reimb = models.Reimbursement.objects.get(pk=id_)
a_form = forms.AcceptReceiptForm(instance=reimb)
r_form = forms.RejectReceiptForm(instance=reimb)
e_form = forms.EditReimbursementForm(instance=reimb)

if request.POST.get("accept", None):
a_form = forms.AcceptReceiptForm(request.POST, instance=reimb)
Expand All @@ -238,6 +267,18 @@ def post(self, request, *args, **kwargs):
c.update({"reject_form": r_form, "accept_form": a_form})
return render(request, self.template_name, c)

elif request.POST.get("edit", None):
e_form = forms.EditReimbursementForm(request.POST, instance=reimb)
if e_form.is_valid():
e_form.save()
messages.success(
self.request, "Changes in reimbursement successfully saved!"
)
else:
c = self.get_context_data()
c.update({"reimb": reimb, "edit_form": e_form})
return render(request, self.template_name, c)

return HttpResponseRedirect(reverse("receipt_review"))


Expand Down
6 changes: 3 additions & 3 deletions stats/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datetime

from django.conf import settings
# from django.conf import settings
from django.db.models import Count, Sum, F, Value, IntegerField
from django.db.models.functions import TruncDate, TruncHour
from django.http import JsonResponse
Expand All @@ -25,8 +25,8 @@ def stats_tabs():
('Volunteer', reverse('volunteer_stats'), False), ('Mentor', reverse('mentor_stats'), False),
('Sponsor', reverse('sponsor_stats'), False), ('Users', reverse('users_stats'), False),
('Check-in', reverse('checkin_stats'), False), ]
if getattr(settings, 'REIMBURSEMENT_ENABLED', False):
tabs.append(('Reimbursements', reverse('reimb_stats'), False))
# if getattr(settings, 'REIMBURSEMENT_ENABLED', False):
# tabs.append(('Reimbursements', reverse('reimb_stats'), False))
return tabs


Expand Down