joeni

Disable course result page until completion

Author
Maarten Vangeneugden
Date
July 27, 2018, 3:19 a.m.
Hash
d8827efa136fb1429a4723dd22b147bafd938311
Parent
46dd1497708d659163b75112f2529d92aac762d6
Modified files
courses/templates/courses/course.djhtml
courses/templates/courses/course_results.djhtml

courses/templates/courses/course.djhtml

5 additions and 2 deletions.

View changes Hide changes
1
1
{% load static %}
2
2
{% load i18n %}
3
3
{% load humanize %}
4
4
{% load joeni_org %}
5
5
6
6
{% block title %}
7
7
    {{ course.name }} | {{ block.super }}
8
8
{% endblock %}
9
9
10
10
{% block main %}
11
11
    <h1>{{ course.name }}</h1>
12
12
13
13
    <h2 id="{% trans "announcements" %}">{% trans "Announcements" %}</h2>
14
14
    <div class="flex-container">
15
15
    {% for announcement in announcements %}
16
16
        <div style="border-color: #{{ course.color }};" class="flex-item">
17
17
            <h3 id="{{ announcement.title|slugify }}">{{ announcement.title }}</h3>
18
18
            <time datetime="{{ announcement.posted|date:'c' }}">
19
19
                {% trans "Posted" %} {{ announcement.posted|naturaltime }}
20
20
            </time>
21
21
            <p>{{ announcement.text|org }}</p>
22
22
        </div>
23
23
    {% empty %}
24
24
        {% trans "No announcements have been made for this course." %}
25
25
    {% endfor %}
26
26
    </div>
27
27
28
28
    <h2 id="{% trans "assignments" %}">{% trans "Assignments" %}</h2>
29
29
    <div class="flex-container">
30
30
    {% for assignment in assignments %}
31
31
        <div style="border-color: #{{ course.color }};" class="flex-item">
32
32
            <h3 id="{{ assignment.title|slugify }}">{{ assignment.title }}</h3>
33
33
            <time datetime="{{ assignment.posted|date:'c' }}">
34
34
                {% trans "Posted" %} {{ assignment.posted|date:"DATE_FORMAT" }} {# {{ assignment.posted|naturaltime }}#}
35
35
            </time>
36
36
            {% if assignment.information %}
37
37
                <p>{{ assignment.information|org }}</p>
38
38
            {% endif %}
39
39
            {#{% trans "Posted" %}: {{ assignment.posted|date:"DATE_FORMAT" }}#}
40
40
            {% if assignment.digital_task %}
41
41
                <h4>{% trans "Your uploads" %}</h4>
42
42
                {% for upload in uploads %}
43
43
                    {% if upload.assignment ==  assignment %}
44
44
                        {% trans "Uploaded:"%} {{ upload.upload_time|date:"SHORT_DATETIME_FORMAT" }}<br />
45
45
                        {% if upload.comment %}
46
46
                            <p>{{ upload.comment }}</p>
47
47
                        {% endif %}
48
48
                        {% if upload.upload_time > assignment.deadline %}
49
49
                            <strong>{% trans "This upload is overdue." %}</strong>
50
50
                        {% endif %}
51
51
                    {% endif %}
52
52
                {% empty %}
53
53
                    {% with now as current_time %}
54
54
                    {% if current_time > assignment.deadline %}
55
55
                        <p>
56
56
                            <strong>
57
57
                                {% blocktrans %}
58
58
                                    You have failed to provide an upload for this
59
59
                                    assignment. Any future uploads will be automatically
60
60
                                    overdue.
61
61
                                {% endblocktrans %}
62
62
                            </strong>
63
63
                        </p>
64
64
                    {% else %}
65
65
                        <p>
66
66
                            {% blocktrans %}
67
67
                                You haven't uploaded anything for this assignment
68
68
                                yet.
69
69
                            {% endblocktrans %}
70
70
                        </p>
71
71
                    {% endif %}
72
72
                    {% endwith %}
73
73
                {% endfor %}
74
74
                <h5>{% trans "Upload a task" %}</h5>
75
75
                <form action="{% url "courses-course-index" course.slug_name %}" method="post">
76
76
                    {% csrf_token %} {# todo i don't think that's necessary here #}
77
77
                    {% include "joeni/form.djhtml" with form=upload_form %}
78
78
                    <input type="submit" value="{% trans "Submit" %}" />
79
79
                </form>
80
80
            {% endif %}
81
81
        </div>
82
82
    {% endfor %}
83
83
    </div>
84
84
    <h1 id="{% trans "management" %}">{% trans "Course management" %}</h1>
85
85
    <style>
86
86
        a.btn {
87
87
        color: #{{ course.color }};
88
88
        border-color: #{{ course.color }};
89
89
        }
90
90
        a.btn:hover {
91
91
        color: white;
92
92
        background-color: #{{ course.color }};
93
93
        }
94
94
    </style>
95
95
    <a class="btn" href="{% url "courses-eci" course_slug=course.slug_name %}">
96
96
        {% trans "Edit course page" %}
97
97
    </a>
98
98
    <a class="btn" href="{% url "courses-results" course_slug=course.slug_name %}">
+
99
    <a class="btn" href="{% url "courses-results" course_slug=course.slug_name %}">
99
100
        {% trans "Student results" %}
100
101
    </a>
101
102
    <h2 id="{% trans "students" %}">{% trans "Students" %}</h2>
+
103
    {% endcomment %}
+
104
    <h2 id="{% trans "students" %}">{% trans "Students" %}</h2>
102
105
    <table>
103
106
        <tr>
104
107
            <th>{% trans "Student name" %}</th>
105
108
            <th>{% trans "Student number" %}</th>
106
109
            <th>{% trans "First result" %}</th>
107
110
            <th>{% trans "Second result" %}</th>
108
111
            <th>{% trans "Decision" %}</th>
109
112
        </tr>
110
113
            {% for student in student_list %}
111
114
                <tr>
112
115
                <td>{{ student.student }}</td>
113
116
                <td>{{ student.student.number }}</td>
114
117
                <td>{{ student.first_score|default:"-" }}</td>
115
-
                <td>{{ student.second_score|default:"-" }}</td>
116
-
                <td>{% with result=student.result %}
+
118
                <td>{{ student.second_score|default_if_none:"-" }}</td>
+
119
                <td>{% with result=student.result %}
117
120
                    {% if result == "CRED" or result == "VRST" or result == "TLRD" or result == "ITLR"%}
118
121
                        <span style="color:green;">
119
122
                    {% elif result == "FAIL" %}
120
123
                        <span style="color:red;">
121
124
                    {% elif result == "BDRG" %}
122
125
                        <span style="background-color:red; color:white;">
123
126
                    {% elif result == "STOP" %}
124
127
                        <span style="color:black;">
125
128
                    {% endif %}
126
129
                    {{ student.get_result_display }}</span>
127
130
                {% endwith %}</td>
128
131
        </tr>
129
132
        {% endfor %}
130
133
        </table>
131
134
{% endblock main %}
132
135

courses/templates/courses/course_results.djhtml

9 additions and 0 deletions.

View changes Hide changes
1
1
{% load static %}
2
2
{% load i18n %}
3
3
{% load joeni_org %}
4
4
5
5
{% block title %}
6
6
    {{ course.name }} | {{ block.super }}
7
7
{% endblock %}
8
8
9
9
{% block main %}
10
10
<!--
+
11
    div.display {
+
12
         }
+
13
    div.print {
+
14
        }
+
15
    </style>
+
16
+
17
    <h1>{% trans "Student result management" %}</h1>
+
18
<!--
11
19
    <form action="" method="POST">
12
20
        {% csrf_token %}
13
21
        <h2 id="{% trans "announcements" %}">{% trans "Announcements" %}</h2>
14
22
            <table>
15
23
                {{ announcements }}
16
24
            </table>
17
25
        <h2 id="{% trans "assignments" %}">{% trans "Assignments" %}</h2>
18
26
            <table>
19
27
            {{ assignments }}
20
28
            </table>
21
29
        <h2 id="{% trans "course-items" %}">{% trans "Course items" %}</h2>
22
30
            <table>
23
31
                {{ course_items }}
24
32
            </table>
25
33
        <h2 id="{% trans "students" %}">{% trans "Students" %}</h2>
26
34
            <table>
27
35
                {{ course_results }}
28
36
            </table>
29
37
        <hr />
30
38
        <input type="submit" value="{% trans "Save everything" %}" />
31
39
    </form>-->
32
40
{% endblock main %}
+
41
{% endblock main %}
33
42