Fix minor bugs and improve some model fields

This commit is contained in:
cuom1999 2024-08-21 22:42:42 -05:00
parent f98549e92d
commit a42bae51f7
7 changed files with 56 additions and 14 deletions

View file

@ -33,8 +33,6 @@ class OrganizationAdmin(VersionAdmin):
"short_name",
"is_open",
"about",
"organization_image",
"logo_override_image",
"slots",
"registrant",
"creation_date",

View file

@ -0,0 +1,17 @@
# Generated by Django 3.2.18 on 2024-08-22 03:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("judge", "0190_deprecate_old_notif_fields"),
]
operations = [
migrations.RemoveField(
model_name="organization",
name="logo_override_image",
),
]

View file

@ -111,16 +111,6 @@ class Organization(models.Model):
blank=True,
)
organization_image = models.ImageField(upload_to=organization_image_path, null=True)
logo_override_image = models.CharField(
verbose_name=_("Logo override image"),
default="",
max_length=150,
blank=True,
help_text=_(
"This image will replace the default site logo for users "
"viewing the organization."
),
)
def __contains__(self, item):
if isinstance(item, int):

View file

@ -48,8 +48,9 @@ def calculate_lessons_progress(profile, lessons):
num_problems = len(problems)
percentage = 0
for val in problem_points.values():
score = val["case_points"] / val["case_total"]
percentage += score / num_problems
if val["case_total"] > 0:
score = val["case_points"] / val["case_total"]
percentage += score / num_problems
res[lesson.id] = {
"achieved_points": percentage * lesson.points,
"percentage": percentage * 100,