From c5a271ba3b7a54e80d3c3a20b1887a85eae38134 Mon Sep 17 00:00:00 2001 From: Gerard Madrid Date: Sun, 11 May 2025 17:01:06 +0200 Subject: [PATCH 1/9] added dubious type and dubious by in DB and review --- .../migrations/0058_auto_20250511_1425.py | 27 +++++++++++++++++++ applications/models/constants.py | 14 ++++++++++ applications/models/hacker.py | 6 ++++- organizers/templates/application_detail.html | 15 +++++++++++ organizers/views.py | 4 +-- 5 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 applications/migrations/0058_auto_20250511_1425.py diff --git a/applications/migrations/0058_auto_20250511_1425.py b/applications/migrations/0058_auto_20250511_1425.py new file mode 100644 index 00000000..1e7b7907 --- /dev/null +++ b/applications/migrations/0058_auto_20250511_1425.py @@ -0,0 +1,27 @@ +# Generated by Django 3.2.23 on 2025-05-11 14:25 + +from django.conf import settings +import django.core.validators +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('applications', '0057_auto_20250203_2145'), + ] + + operations = [ + migrations.AddField( + model_name='hackerapplication', + name='dubious_type', + field=models.CharField(choices=[('OK', 'Not dubious'), ('INVALID_CV', 'Invalid CV'), ('LATE_GRAD', 'Invalid graduation year'), ('NOT_STUDENT', 'Not a student'), ('INVALID_SCHOOL', 'Invalid school')], default='OK', max_length=300), + ), + migrations.AddField( + model_name='hackerapplication', + name='dubioused_by', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='dubioused_by', to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/applications/models/constants.py b/applications/models/constants.py index dded778c..592e94cd 100644 --- a/applications/models/constants.py +++ b/applications/models/constants.py @@ -99,3 +99,17 @@ DEFAULT_YEAR = datetime.now().year + 1 ENGLISH_LEVEL = [(i, str(i)) for i in range(1, 5 + 1)] + +DUBIOUS_NONE = 'OK' +DUBIOUS_CV = 'INVALID_CV' +DUBIOUS_GRADUATION_YEAR = 'LATE_GRAD' +DUBIOUS_NOT_STUDENT = 'NOT_STUDENT' +DUBIOUS_SCHOOL = 'INVALID_SCHOOL' + +DUBIOUS_TYPES = [ + (DUBIOUS_NONE, 'Not dubious'), + (DUBIOUS_CV, 'Invalid CV'), + (DUBIOUS_GRADUATION_YEAR, 'Invalid graduation year'), + (DUBIOUS_NOT_STUDENT, 'Not a student'), + (DUBIOUS_SCHOOL, 'Invalid school') +] diff --git a/applications/models/hacker.py b/applications/models/hacker.py index 6592ef63..06b9b994 100644 --- a/applications/models/hacker.py +++ b/applications/models/hacker.py @@ -36,6 +36,9 @@ class HackerApplication( projects = models.TextField(max_length=500, blank=True, null=True) # META + dubious_type = models.CharField(max_length=300, choices=DUBIOUS_TYPES, default=DUBIOUS_NONE) # Type of dubious application + dubioused_by = models.ForeignKey(User, related_name='dubioused_by', blank=True, null=True, + on_delete=models.SET_NULL) # User who marked this application as dubious contacted = models.BooleanField(default=False) # If a dubious application has been contacted yet contacted_by = models.ForeignKey(User, related_name='contacted_by', blank=True, null=True, on_delete=models.SET_NULL) @@ -75,10 +78,11 @@ def invalidate(self): self.status = APP_INVALID self.save() - def set_dubious(self): + def set_dubious(self, user): self.status = APP_DUBIOUS self.contacted = False self.status_update_date = timezone.now() + self.dubioused_by = user self.vote_set.all().delete() if hasattr(self, 'acceptedresume'): self.acceptedresume.delete() diff --git a/organizers/templates/application_detail.html b/organizers/templates/application_detail.html index baf2a4b3..284088ee 100644 --- a/organizers/templates/application_detail.html +++ b/organizers/templates/application_detail.html @@ -70,6 +70,21 @@

Background

Dubious info

+ {% include 'include/field.html' with desc='Sent to dubious by' value=app.dubioused_by %} + + {% if app.dubious_type == 'OK' %} + {% include 'include/field.html' with desc='Dubious reason' value='No reason selected' %} + {% elif app.dubious_type == 'INVALID_CV' %} + {% include 'include/field.html' with desc='Dubious reason' value='Invalid CV' %} + {% elif app.dubious_type == 'LATE_GRAD' %} + {% include 'include/field.html' with desc='Dubious reason' value='Late Graduation Date' %} + {% elif app.dubious_type == 'NOT_STUDENT' %} + {% include 'include/field.html' with desc='Dubious reason' value='Not a Student' %} + {% elif app.dubious_type == 'INVALID_SCHOOL' %} + {% include 'include/field.html' with desc='Dubious reason' value='Invalid School' %} + {% endif %} + +
{% include 'include/field.html' with desc='Contacted' value=app.contacted|yesno:'Yes,No,Maybe' %} {% include 'include/field.html' with desc='Contacted by' value=app.contacted_by %} {% endif %} diff --git a/organizers/views.py b/organizers/views.py index 44f8aa06..65373d05 100644 --- a/organizers/views.py +++ b/organizers/views.py @@ -237,7 +237,7 @@ def post(self, request, *args, **kwargs): elif request.POST.get('slack') and request.user.is_organizer: self.slack_invite(application) elif request.POST.get('set_dubious') and request.user.is_organizer: - application.set_dubious() + application.set_dubious(request.user) elif request.POST.get('contact_user') and request.user.has_dubious_access: application.set_contacted(request.user) elif request.POST.get('unset_dubious') and request.user.has_dubious_access: @@ -344,7 +344,7 @@ def post(self, request, *args, **kwargs): elif request.POST.get('add_comment'): add_comment(application, request.user, comment_text) elif request.POST.get('set_dubious'): - application.set_dubious() + application.set_dubious(request.user) elif request.POST.get('unset_dubious'): application.unset_dubious() elif request.POST.get('set_blacklist') and request.user.is_organizer: From 531787b7dafde0a16813052f8c68f4dd72c2493d Mon Sep 17 00:00:00 2001 From: Gerard Madrid Date: Sun, 11 May 2025 17:40:15 +0200 Subject: [PATCH 2/9] comment and dubious type working and showing --- .../migrations/0059_auto_20250511_1520.py | 19 ++++ applications/models/hacker.py | 8 +- organizers/templates/application_detail.html | 93 +++++++++++++++++-- organizers/views.py | 9 +- 4 files changed, 120 insertions(+), 9 deletions(-) create mode 100644 applications/migrations/0059_auto_20250511_1520.py diff --git a/applications/migrations/0059_auto_20250511_1520.py b/applications/migrations/0059_auto_20250511_1520.py new file mode 100644 index 00000000..743bcf52 --- /dev/null +++ b/applications/migrations/0059_auto_20250511_1520.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.23 on 2025-05-11 15:20 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('applications', '0058_auto_20250511_1425'), + ] + + operations = [ + migrations.AddField( + model_name='hackerapplication', + name='dubious_comment', + field=models.TextField(blank=True, max_length=500, null=True), + ), + ] diff --git a/applications/models/hacker.py b/applications/models/hacker.py index 06b9b994..4fa6812f 100644 --- a/applications/models/hacker.py +++ b/applications/models/hacker.py @@ -39,6 +39,7 @@ class HackerApplication( dubious_type = models.CharField(max_length=300, choices=DUBIOUS_TYPES, default=DUBIOUS_NONE) # Type of dubious application dubioused_by = models.ForeignKey(User, related_name='dubioused_by', blank=True, null=True, on_delete=models.SET_NULL) # User who marked this application as dubious + dubious_comment = models.TextField(max_length=500, blank=True, null=True) # Comment for dubious application contacted = models.BooleanField(default=False) # If a dubious application has been contacted yet contacted_by = models.ForeignKey(User, related_name='contacted_by', blank=True, null=True, on_delete=models.SET_NULL) @@ -78,11 +79,13 @@ def invalidate(self): self.status = APP_INVALID self.save() - def set_dubious(self, user): + def set_dubious(self, user, dubious_type, dubious_comment_text): self.status = APP_DUBIOUS self.contacted = False self.status_update_date = timezone.now() self.dubioused_by = user + self.dubious_type = dubious_type + self.dubious_comment = dubious_comment_text self.vote_set.all().delete() if hasattr(self, 'acceptedresume'): self.acceptedresume.delete() @@ -91,6 +94,9 @@ def set_dubious(self, user): def unset_dubious(self): self.status = APP_PENDING self.status_update_date = timezone.now() + self.dubioused_by = None + self.dubious_type = DUBIOUS_NONE + self.dubious_comment = None self.save() def set_contacted(self, user): diff --git a/organizers/templates/application_detail.html b/organizers/templates/application_detail.html index 284088ee..9f9dea87 100644 --- a/organizers/templates/application_detail.html +++ b/organizers/templates/application_detail.html @@ -84,6 +84,10 @@

Dubious info

{% include 'include/field.html' with desc='Dubious reason' value='Invalid School' %} {% endif %} + {% if app.dubious_comment %} + {% include 'include/field.html' with desc='Dubious Comment' value=app.dubious_comment %} + {% endif %} +
{% include 'include/field.html' with desc='Contacted' value=app.contacted|yesno:'Yes,No,Maybe' %} {% include 'include/field.html' with desc='Contacted by' value=app.contacted_by %} @@ -166,6 +170,21 @@

{{ comment.text }}

} }); + @@ -210,10 +229,41 @@

Score

application {% if h_dubious_enabled %} - + + + + + {% endif %} {% if h_blacklist_enabled %} {% if h_dubious_enabled %} - + + + + + + + + + + {% endif %} {% if h_blacklist_enabled %} {% if h_dubious_enabled %} @@ -383,30 +391,36 @@
-
+
- +
Invalid CV
-
+
- +
Wrong Graduation
-
+
- +
Not a Student
-
+
- +
Invalid School
+
+
+ +
Other
+
+
From c8d298ab6164bf7511b624e7691ddd40924aa666 Mon Sep 17 00:00:00 2001 From: "enrique.andujar" Date: Wed, 3 Sep 2025 13:22:55 +0200 Subject: [PATCH 8/9] Added spacing between buttons and dubious button for HX when seeing a detail application --- app/static/css/custom-bootstrap.css | 2 +- applications/templates/application.html | 14 ++-- organizers/templates/application_detail.html | 87 ++++++++++++++++++-- 3 files changed, 89 insertions(+), 14 deletions(-) diff --git a/app/static/css/custom-bootstrap.css b/app/static/css/custom-bootstrap.css index 3b84de3c..c68890f4 100644 --- a/app/static/css/custom-bootstrap.css +++ b/app/static/css/custom-bootstrap.css @@ -817,7 +817,7 @@ a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none} .btn-group-lg>.btn,.btn-lg{line-height:1.3333333;border-radius:8px} .btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:8px} .btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:8px} -.btn-block{display:block;width:100%} +.btn-block{display:block;width:100%;margin-top:5px} .btn-block+.btn-block{margin-top:5px} input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%} .fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear} diff --git a/applications/templates/application.html b/applications/templates/application.html index 31ca5a8f..e08d4978 100644 --- a/applications/templates/application.html +++ b/applications/templates/application.html @@ -24,16 +24,16 @@ {% endif %}
- {% if application.can_be_edit %} - - -

- Be careful, you can only edit the application until 2 hours after {{application.submission_date}}

+ {% if application.can_be_edit %} + + +

+ Be careful, you can only edit the application until 2 hours after {{application.submission_date}}

{% else %} -

Your application has been reviewed already. Editing has been disabled to make sure all reviewers get the +

Your application has been reviewed already. Editing has been disabled to make sure all reviewers get the same data. If you would like to change something important, please email us at {{ h_contact_email|urlize }}.

- {% endif %} + {% endif %}
{% include 'include/application_form.html' %} diff --git a/organizers/templates/application_detail.html b/organizers/templates/application_detail.html index 35266126..c73e3763 100644 --- a/organizers/templates/application_detail.html +++ b/organizers/templates/application_detail.html @@ -38,13 +38,13 @@

{% if vote %}Review applications{% else %}{{ app.user.name }}'s application{% endif %} {% if vote %} - + ({{ apps_left_to_vote }} left) {% endif %}

+ href="{% url 'app_detail' app.uuid_str %}">
@@ -62,7 +62,7 @@

Personal

{% include 'include/field.html' with desc='Email' value=app.user.email %} {% include 'include/field.html' with desc='Travel reimbursement?' value=app.reimb|yesno:'Yes,No,Maybe' %} {% include 'include/field.html' with desc='Money needed' value=app.reimb_amount %} - {% include 'include/field.html' with desc='Origin' value=app.origin %} + {% include 'include/field.html' with desc='Origin' value=app.origin %} {% endif %} {% include 'include/field.html' with desc='Under age (-18)' value=app.under_age|yesno:'Yes,No,Maybe' %} {% if app.resume %} @@ -176,7 +176,7 @@

{{ comment.text }}

-