Commit 8bdb1dc7 authored by Joan Denise Nocos's avatar Joan Denise Nocos

feat: modified passing_score to be able to automatically calculate 60% of...

feat: modified passing_score to be able to automatically calculate 60% of max_score in Assignment model
parent 0adf94a8
...@@ -11,8 +11,6 @@ class Assignment(models.Model): ...@@ -11,8 +11,6 @@ class Assignment(models.Model):
name = models.CharField(max_length=50) name = models.CharField(max_length=50)
description = models.CharField(max_length=500) description = models.CharField(max_length=500)
max_points = models.IntegerField(default=0) max_points = models.IntegerField(default=0)
#def set_passing_score():
# return (max_points * 60) / 100
passing_score = models.IntegerField(default=0) passing_score = models.IntegerField(default=0)
def _str_(self): def _str_(self):
......
...@@ -6,6 +6,8 @@ def index(request): ...@@ -6,6 +6,8 @@ def index(request):
assignments_view = "ASSIGNMENTS: <br>" assignments_view = "ASSIGNMENTS: <br>"
schoolwork = Assignment.objects.all() schoolwork = Assignment.objects.all()
for assignment in schoolwork: for assignment in schoolwork:
score = assignment.max_points
assignment.passing_score = (score*60) // 100
assignments_view += "Assignment Name: {}<br>Description: {}<br>Perfect Score: {}<br>Passing Score: {}<br>Course/Section: {} {} {}<br><br>".\ assignments_view += "Assignment Name: {}<br>Description: {}<br>Perfect Score: {}<br>Passing Score: {}<br>Course/Section: {} {} {}<br><br>".\
format(assignment.name, format(assignment.name,
assignment.description, assignment.description,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment