Skip to content

Commit

Permalink
Add AidCategory
Browse files Browse the repository at this point in the history
  • Loading branch information
estyxx committed Sep 15, 2024
1 parent 4817a6f commit b613840
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
15 changes: 15 additions & 0 deletions backend/conferences/migrations/0046_merge_20240912_1003.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Generated by Django 5.0.8 on 2024-09-12 10:03

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("conferences", "0045_conference_logo"),
(
"conferences",
"0045_remove_conference_grants_default_accommodation_amount_and_more",
),
]

operations = []
4 changes: 4 additions & 0 deletions backend/grants/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class AidType(models.TextChoices):
help_text="Automatically include this category in grants by default",
)

objects = GrantQuerySet().as_manager()

def __str__(self):
return f"{self.name} ({self.conference.name})"

Expand All @@ -55,6 +57,8 @@ class CountryAidAmount(models.Model):
max_digits=6, decimal_places=0, help_text=_("Maximum amount for this category")
)

objects = GrantQuerySet().as_manager()

def __str__(self):
return f"{self.country} ({self.conference.name}) - {self.max_amount}€"

Expand Down
8 changes: 7 additions & 1 deletion backend/reviews/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from django.urls import path, reverse
from django.utils.safestring import mark_safe

from grants.models import Grant
from grants.models import Grant, AidCategory
from participants.models import Participant
from reviews.models import AvailableScoreOption, ReviewSession, UserReview
from submissions.models import Submission, SubmissionTag
Expand Down Expand Up @@ -376,6 +376,12 @@ def _review_grants_recap_view(self, request, review_session):
for choice in Grant.Status.choices
if choice[0] in Grant.REVIEW_SESSION_STATUSES_OPTIONS
],
all_approved_category=[
category
for category in AidCategory.objects.filter(
conference_id=review_session.conference_id
)
],
all_statuses=Grant.Status.choices,
review_session=review_session,
title="Recap",
Expand Down
12 changes: 6 additions & 6 deletions backend/reviews/templates/grants-recap.html
Original file line number Diff line number Diff line change
Expand Up @@ -623,15 +623,15 @@ <h3>
<td>
{% if perms.reviews.decision_reviewsession %}
<ul
data-item-id="{{ item.id }}"
class="approved-type-choices {% if item.status != 'approved' %}hidden{% endif %}"
data-item-id="{{ item.id }}"
class="approved-type-choices {% if item.status != 'approved' %}hidden{% endif %}"
>
{% for approved_type in all_approved_types %}
{% for category in all_approved_category %}
<li>
<label>
<input {% if item.approved_type == approved_type.0 %}checked{% endif %}
type="radio" name="approvedtype-{{item.id}}" value="{{approved_type.0}}" />
{{approved_type.1}}
<input {% if item.approved_type == category.id %}checked{% endif %}
type="radio" name="approvedaidcategory-{{item.id}}" value="{{category.id}}" />
{{category.name}}
</label>
</li>
{% endfor %}
Expand Down

0 comments on commit b613840

Please sign in to comment.