Commit 1e102883 authored by jmAmador's avatar jmAmador

fixed passing score function in the Assignments model

parent 9ce131b5
......@@ -19,11 +19,12 @@ class Assignment(models.Model):
name = models.CharField(max_length=100)
description = models.CharField(max_length=10000)
course = models.CharField(max_length=10000)
perfect_score = models.FloatField()
perfect_score = models.IntegerField()
course_stuff = models.ForeignKey(Course, on_delete=models.CASCADE)
def passing_score(self, perfect_score):
return perfect_score * 0.6
def passing_score(self):
return '{}'.format(int(self.perfect_score*0.6))
def __str__(self):
return '{}: {}'.format(self.name, self.course)
......
......@@ -3,10 +3,10 @@
{% block title %} {{object.title}} {% endblock %}
{% block content %}
<h1>{{ object.name }}</h1>
<p>{{ object.course_stuff }}</p>
<p>Description: {{ object.description }}</p>
<p>Perfect Score: {{ object.perfect_score }}</p>
<p>Passing Score: {{ object.passing_score }}</p>
<p><b>{{ object.course_stuff }}</b></p>
<p><b>Description:</b> {{ object.description }}</p>
<p><b>Perfect Score:</b> {{ object.perfect_score }}</p>
<p><b>Passing Score:</b> {{ object.passing_score }}</p>
<form action='edit' method="get" enctype="multipart/form-data">
{% csrf_token %}
......
......@@ -9,6 +9,7 @@
{%endfor%}
<br>
<form action="/assignments/add" method="get" enctype="multipart/form-data">
{% csrf_token %}
<input type="submit" value="New Assignment">
</form>
<a href="/dashboard">Dashboard</a>
......
from django.urls import path
from .views import index, assignments_view, AssignmentDetailView, AssignmentCreateView, AssignmentUpdateView
from .views import assignments_view, AssignmentDetailView, AssignmentCreateView, AssignmentUpdateView
urlpatterns = [
path('', assignments_view, name='assignments_page'),
......
No preview for this file type
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