Skip to content

Commit

Permalink
Fixes (#74)
Browse files Browse the repository at this point in the history
* update ssl certs docker ignore

* few fixes

* quick fix

---------

Co-authored-by: Ishaan Mittal <[email protected]>
  • Loading branch information
mittal-ishaan and ishaan-tf authored Aug 24, 2024
1 parent dac0dd5 commit 24da410
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
1 change: 1 addition & 0 deletions home/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,7 @@ class about_Admin(ImportExportModelAdmin, admin.ModelAdmin):
"start_time",
"end_time",
"active",
"show_allocated",
)
},
),
Expand Down
17 changes: 17 additions & 0 deletions home/migrations/0003_allocationform_show_allocated.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 5.0.3 on 2024-08-24 05:37

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("home", "0002_remove_allocationautumn22_month_and_more"),
]

operations = [
migrations.AddField(
model_name="allocationform",
name="show_allocated",
field=models.BooleanField(default=False, verbose_name="show_allocated"),
),
]
1 change: 1 addition & 0 deletions home/models/students.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ class AllocationForm(models.Model):
_("Start Time"), default=now, null=True, blank=True
)
end_time = models.DateTimeField(_("End Time"), null=True, blank=True)
show_allocated = models.BooleanField(_("show_allocated"), default=False)

def __str__(self):
return str(self.heading)
Expand Down
16 changes: 9 additions & 7 deletions home/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,19 +467,21 @@ def profile(request):
provider="google", user_id=request.user.id
)
picture = "not available"
allocation = Allocation.objects.filter(email=student).last()
allocation: Allocation | None = Allocation.objects.filter(email=student).last()
show_allocated_enabled = AllocationForm.objects.filter(
show_allocated=True, period=allocation.period
).exists()
allocation_info = {}
# improve this alignment of text to be shown on the profile section
if allocation:
if allocation and show_allocated_enabled:
allocation_info = {
"Allocation ID": allocation.student_id,
"start date": allocation.period.start_date,
"end date": allocation.period.end_date,
# "Allocation ID": allocation.student_id,
"Caterer": allocation.caterer.name,
"High Tea": "Yes" if allocation.high_tea else "No",
# "High Tea": "Yes" if allocation.high_tea else "No",
"Jain": "Yes" if allocation.jain else "No",
}
# allocation_info = "Allocation ID: " + allocation.student_id + " Caterer: " + allocation.caterer.name + " High Tea: " + str(allocation.high_tea) + " Jain: " + str(allocation.jain)
# else:
# allocation_info = "Not allocated for this period"
try:
if socialaccount_obj:
picture = socialaccount_obj[0].extra_data["picture"]
Expand Down
2 changes: 1 addition & 1 deletion templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ <h6>{{ key }}</h6>
</div>
{% endfor %}
{% else %}
<h6>Your view your allocated caterer once the allocation for this period is completed. </h6>
<h6>You will be able to see your allocated caterer after the allocation process is completed </h6>
{% endif %}
<hr>
</div>
Expand Down

0 comments on commit 24da410

Please sign in to comment.