Merge pull request #434 from pateljannat/student-class-view
This commit is contained in:
@@ -242,6 +242,10 @@ jinja = {
|
|||||||
# "lms.plugins.LiveCodeExtension"
|
# "lms.plugins.LiveCodeExtension"
|
||||||
# ]
|
# ]
|
||||||
|
|
||||||
|
has_website_permission = {
|
||||||
|
"LMS Certificate Evaluation": "lms.lms.doctype.lms_certificate_evaluation.lms_certificate_evaluation.has_website_permission"
|
||||||
|
}
|
||||||
|
|
||||||
profile_mandatory_fields = [
|
profile_mandatory_fields = [
|
||||||
"first_name",
|
"first_name",
|
||||||
"last_name",
|
"last_name",
|
||||||
|
|||||||
@@ -100,9 +100,10 @@ def delete_custom_fields():
|
|||||||
def add_pages_to_nav():
|
def add_pages_to_nav():
|
||||||
pages = [
|
pages = [
|
||||||
{"label": "Courses", "url": "/courses", "parent": "Explore", "idx": 2},
|
{"label": "Courses", "url": "/courses", "parent": "Explore", "idx": 2},
|
||||||
{"label": "Statistics", "url": "/statistics", "parent": "Explore", "idx": 3},
|
{"label": "Classes", "url": "/classes", "parent": "Explore", "idx": 3},
|
||||||
{"label": "Jobs", "url": "/jobs", "parent": "Explore", "idx": 4},
|
{"label": "Statistics", "url": "/statistics", "parent": "Explore", "idx": 4},
|
||||||
{"label": "People", "url": "/community", "parent": "Explore", "idx": 5},
|
{"label": "Jobs", "url": "/jobs", "parent": "Explore", "idx": 5},
|
||||||
|
{"label": "People", "url": "/community", "parent": "Explore", "idx": 6},
|
||||||
]
|
]
|
||||||
|
|
||||||
if not frappe.db.exists("Top Bar Item", {"label": "Explore"}):
|
if not frappe.db.exists("Top Bar Item", {"label": "Explore"}):
|
||||||
|
|||||||
@@ -4,12 +4,19 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
|
from lms.lms.utils import has_course_moderator_role
|
||||||
|
|
||||||
|
|
||||||
class LMSCertificateEvaluation(Document):
|
class LMSCertificateEvaluation(Document):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def has_website_permission(doc, ptype, user, verbose=False):
|
||||||
|
if has_course_moderator_role() or doc.member == frappe.session.user:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def create_lms_certificate(source_name, target_doc=None):
|
def create_lms_certificate(source_name, target_doc=None):
|
||||||
doc = get_mapped_doc(
|
doc = get_mapped_doc(
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
"description",
|
"description",
|
||||||
"section_break_6",
|
"section_break_6",
|
||||||
"students",
|
"students",
|
||||||
"courses"
|
"courses",
|
||||||
|
"custom_component"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@@ -61,11 +62,18 @@
|
|||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"label": "Start Date",
|
"label": "Start Date",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "The HTML code entered here will be displayed on the class details page.",
|
||||||
|
"fieldname": "custom_component",
|
||||||
|
"fieldtype": "Code",
|
||||||
|
"label": "Custom Component",
|
||||||
|
"options": "HTML"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2022-11-21 10:55:50.067225",
|
"modified": "2022-11-25 10:37:24.250557",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Class",
|
"name": "LMS Class",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
"list_columns": [],
|
"list_columns": [],
|
||||||
"login_required": 1,
|
"login_required": 1,
|
||||||
"max_attachment_size": 0,
|
"max_attachment_size": 0,
|
||||||
"modified": "2022-11-23 14:57:47.700695",
|
"modified": "2022-11-25 17:05:30.851109",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "evaluation",
|
"name": "evaluation",
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
"published": 1,
|
"published": 1,
|
||||||
"route": "evaluation",
|
"route": "evaluation",
|
||||||
"show_attachments": 0,
|
"show_attachments": 0,
|
||||||
"show_list": 1,
|
"show_list": 0,
|
||||||
"show_sidebar": 0,
|
"show_sidebar": 0,
|
||||||
"title": "Evaluation",
|
"title": "Evaluation",
|
||||||
"web_form_fields": [
|
"web_form_fields": [
|
||||||
@@ -146,4 +146,4 @@
|
|||||||
"show_in_filter": 0
|
"show_in_filter": 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from lms.lms.utils import has_course_moderator_role
|
|
||||||
|
|
||||||
|
|
||||||
def get_context(context):
|
def get_context(context):
|
||||||
|
pass
|
||||||
if not has_course_moderator_role():
|
|
||||||
message = "Only Moderators have access to this page."
|
|
||||||
if frappe.session.user == "Guest":
|
|
||||||
message = "Please login to access this page."
|
|
||||||
|
|
||||||
raise frappe.PermissionError(_(message))
|
|
||||||
|
|||||||
@@ -36,6 +36,6 @@ lms.patches.v0_0.set_dashboard #11-10-2022
|
|||||||
lms.patches.v0_0.set_courses_page_as_home
|
lms.patches.v0_0.set_courses_page_as_home
|
||||||
lms.patches.v0_0.set_member_in_progress #09-11-2022
|
lms.patches.v0_0.set_member_in_progress #09-11-2022
|
||||||
lms.patches.v0_0.convert_progress_to_float
|
lms.patches.v0_0.convert_progress_to_float
|
||||||
lms.patches.v0_0.add_pages_to_nav #11-11-2022
|
lms.patches.v0_0.add_pages_to_nav #25-11-2022
|
||||||
lms.patches.v0_0.change_role_names
|
lms.patches.v0_0.change_role_names
|
||||||
lms.patches.v0_0.quiz_submission_result
|
lms.patches.v0_0.quiz_submission_result
|
||||||
|
|||||||
@@ -45,7 +45,8 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label> {{ _("Result") }} </label>
|
<label> {{ _("Result") }} </label>
|
||||||
<div class="control-input flex align-center form-control">
|
<div class="control-input flex align-center form-control">
|
||||||
<select class="input-with-feedback form-control pl-0" id="result" data-type="{{ assignment.status }}">
|
<select class="input-with-feedback form-control pl-0" id="result"
|
||||||
|
{% if not is_moderator %} disabled {% endif %} data-type="{{ assignment.status }}">
|
||||||
<option selected> {{ _("Not Graded") }} </option>
|
<option selected> {{ _("Not Graded") }} </option>
|
||||||
<option value="Pass"> {{ _("Pass") }} </option>
|
<option value="Pass"> {{ _("Pass") }} </option>
|
||||||
<option value="Fail"> {{ _("Fail") }} </option>
|
<option value="Fail"> {{ _("Fail") }} </option>
|
||||||
@@ -61,7 +62,8 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label>{{ _("Comments") }}</label>
|
<label>{{ _("Comments") }}</label>
|
||||||
<textarea class="form-control" id="comments">{% if assignment.comments %}{{ assignment.comments }}{% endif %}</textarea>
|
<textarea class="form-control" id="comments" {% if not is_moderator %} disabled readonly {% endif %}
|
||||||
|
>{% if assignment.comments %}{{ assignment.comments }}{% endif %}</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,16 +7,29 @@ def get_context(context):
|
|||||||
context.no_cache = 1
|
context.no_cache = 1
|
||||||
assignment = frappe.form_dict["assignment"]
|
assignment = frappe.form_dict["assignment"]
|
||||||
|
|
||||||
if not has_course_moderator_role():
|
context.assignment = frappe.db.get_value(
|
||||||
message = "Only Moderators have access to this page."
|
"Lesson Assignment",
|
||||||
|
assignment,
|
||||||
|
[
|
||||||
|
"assignment",
|
||||||
|
"comments",
|
||||||
|
"status",
|
||||||
|
"name",
|
||||||
|
"member",
|
||||||
|
"member_name",
|
||||||
|
"course",
|
||||||
|
"lesson",
|
||||||
|
],
|
||||||
|
as_dict=True,
|
||||||
|
)
|
||||||
|
context.is_moderator = has_course_moderator_role()
|
||||||
|
|
||||||
|
if (
|
||||||
|
not has_course_moderator_role()
|
||||||
|
and not frappe.session.user == context.assignment.member
|
||||||
|
):
|
||||||
|
message = "You don't have the permissions to access this page."
|
||||||
if frappe.session.user == "Guest":
|
if frappe.session.user == "Guest":
|
||||||
message = "Please login to access this page."
|
message = "Please login to access this page."
|
||||||
|
|
||||||
raise frappe.PermissionError(_(message))
|
raise frappe.PermissionError(_(message))
|
||||||
|
|
||||||
context.assignment = frappe.db.get_value(
|
|
||||||
"Lesson Assignment",
|
|
||||||
assignment,
|
|
||||||
["assignment", "comments", "status", "name", "member_name", "course", "lesson"],
|
|
||||||
as_dict=True,
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -50,6 +50,9 @@
|
|||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
{% if class_info.custom_component %}
|
||||||
|
{{ class_info.custom_component }}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
@@ -94,7 +97,8 @@
|
|||||||
{% for course in published_courses %}
|
{% for course in published_courses %}
|
||||||
{% set checked = course.name in class_courses %}
|
{% set checked = course.name in class_courses %}
|
||||||
<label class="class-course" data-course="{{ course.name }}">
|
<label class="class-course" data-course="{{ course.name }}">
|
||||||
<input type="checkbox" {% if checked %} checked {% endif %}>
|
<input type="checkbox" {% if checked %} checked {% endif %}
|
||||||
|
{% if not is_moderator %} disabled {% endif %}>
|
||||||
{{ course.title }}
|
{{ course.title }}
|
||||||
</label>
|
</label>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -105,10 +109,12 @@
|
|||||||
|
|
||||||
{% macro StudentsSection(class_info, class_students) %}
|
{% macro StudentsSection(class_info, class_students) %}
|
||||||
<div class="medium">
|
<div class="medium">
|
||||||
|
{% if is_moderator %}
|
||||||
{{ AddStudents() }}
|
{{ AddStudents() }}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if class_students | length %}
|
{% if class_students | length %}
|
||||||
<table class="table mt-10">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 70%">
|
<th style="width: 70%">
|
||||||
{{ _("Student") }}
|
{{ _("Student") }}
|
||||||
@@ -116,7 +122,9 @@
|
|||||||
<th style="width: 20%">
|
<th style="width: 20%">
|
||||||
{{ _("Last Active") }}
|
{{ _("Last Active") }}
|
||||||
</th>
|
</th>
|
||||||
|
{% if is_moderator %}
|
||||||
<th style="width: 10%"></th>
|
<th style="width: 10%"></th>
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% for student in class_students %}
|
{% for student in class_students %}
|
||||||
{% set last_active = frappe.db.get_value("User", student.student, "last_active") %}
|
{% set last_active = frappe.db.get_value("User", student.student, "last_active") %}
|
||||||
@@ -129,11 +137,13 @@
|
|||||||
<td>
|
<td>
|
||||||
{{ frappe.utils.format_datetime(last_active, "medium") }}
|
{{ frappe.utils.format_datetime(last_active, "medium") }}
|
||||||
</td>
|
</td>
|
||||||
|
{% if is_moderator %}
|
||||||
<td>
|
<td>
|
||||||
<svg class="icon icon-md pull-right remove-student" data-student="{{ student.student }}">
|
<svg class="icon icon-md pull-right remove-student" data-student="{{ student.student }}">
|
||||||
<use href="#icon-delete"></use>
|
<use href="#icon-delete"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</td>
|
</td>
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
@@ -147,7 +157,7 @@
|
|||||||
|
|
||||||
|
|
||||||
{% macro AddStudents() %}
|
{% macro AddStudents() %}
|
||||||
<div>
|
<div class="mb-10">
|
||||||
<div class="mb-2">
|
<div class="mb-2">
|
||||||
{{ _("Add Student") }}
|
{{ _("Add Student") }}
|
||||||
</div>
|
</div>
|
||||||
@@ -158,7 +168,9 @@
|
|||||||
spellcheck="false">
|
spellcheck="false">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-primary btn-sm" id="submit-student"> {{ _("Add") }} </button>
|
<button class="btn btn-primary btn-sm" id="submit-student">
|
||||||
|
{{ _("Add") }}
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|||||||
@@ -5,20 +5,12 @@ from frappe import _
|
|||||||
|
|
||||||
def get_context(context):
|
def get_context(context):
|
||||||
context.no_cache = 1
|
context.no_cache = 1
|
||||||
|
|
||||||
if not has_course_moderator_role():
|
|
||||||
message = "Only Moderators have access to this page."
|
|
||||||
if frappe.session.user == "Guest":
|
|
||||||
message = "Please login to access this page."
|
|
||||||
|
|
||||||
raise frappe.PermissionError(_(message))
|
|
||||||
|
|
||||||
class_name = frappe.form_dict["classname"]
|
class_name = frappe.form_dict["classname"]
|
||||||
|
|
||||||
context.class_info = frappe.db.get_value(
|
context.class_info = frappe.db.get_value(
|
||||||
"LMS Class",
|
"LMS Class",
|
||||||
class_name,
|
class_name,
|
||||||
["name", "title", "start_date", "end_date", "description"],
|
["name", "title", "start_date", "end_date", "description", "custom_component"],
|
||||||
as_dict=True,
|
as_dict=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -33,3 +25,5 @@ def get_context(context):
|
|||||||
context.class_students = frappe.get_all(
|
context.class_students = frappe.get_all(
|
||||||
"Class Student", {"parent": class_name}, ["student", "student_name", "username"]
|
"Class Student", {"parent": class_name}, ["student", "student_name", "username"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
context.is_moderator = has_course_moderator_role()
|
||||||
|
|||||||
@@ -6,9 +6,11 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="common-page-style">
|
<div class="common-page-style">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
{% if has_course_moderator_role() %}
|
||||||
<a class="btn btn-default btn-sm pull-right" href="/class/new">
|
<a class="btn btn-default btn-sm pull-right" href="/class/new">
|
||||||
{{ _("Create Class") }}
|
{{ _("Create Class") }}
|
||||||
</a>
|
</a>
|
||||||
|
{% endif %}
|
||||||
<div class="course-home-headings"> {{ _("All Classes") }} </div>
|
<div class="course-home-headings"> {{ _("All Classes") }} </div>
|
||||||
{% if classes %}
|
{% if classes %}
|
||||||
{{ ClassCards(classes) }}
|
{{ ClassCards(classes) }}
|
||||||
@@ -63,4 +65,4 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|||||||
@@ -1,18 +1,10 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from lms.lms.utils import has_course_moderator_role
|
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
|
||||||
|
|
||||||
def get_context(context):
|
def get_context(context):
|
||||||
context.no_cache = 1
|
context.no_cache = 1
|
||||||
|
|
||||||
if not has_course_moderator_role():
|
|
||||||
message = "Only Moderators have access to this page."
|
|
||||||
if frappe.session.user == "Guest":
|
|
||||||
message = "Please login to access this page."
|
|
||||||
|
|
||||||
raise frappe.PermissionError(_(message))
|
|
||||||
|
|
||||||
context.classes = frappe.get_all(
|
context.classes = frappe.get_all(
|
||||||
"LMS Class", fields=["name", "title", "start_date", "end_date"]
|
"LMS Class", fields=["name", "title", "start_date", "end_date"]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -19,9 +19,11 @@
|
|||||||
<span>
|
<span>
|
||||||
{{ frappe.utils.format_datetime(student.last_active, "medium") }}
|
{{ frappe.utils.format_datetime(student.last_active, "medium") }}
|
||||||
</span>
|
</span>
|
||||||
|
{% if is_moderator %}
|
||||||
<a class="btn btn-secondary btn-sm ml-3" href="/evaluation/new?member={{student.name}}&date={{frappe.utils.getdate()}}">
|
<a class="btn btn-secondary btn-sm ml-3" href="/evaluation/new?member={{student.name}}&date={{frappe.utils.getdate()}}">
|
||||||
{{ _("Evaluate") }}
|
{{ _("Evaluate") }}
|
||||||
</a>
|
</a>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="course-home-headings">
|
<div class="course-home-headings">
|
||||||
{{ student.full_name }}
|
{{ student.full_name }}
|
||||||
@@ -55,7 +57,7 @@
|
|||||||
<div class="ml-3"> {{ frappe.utils.cint(course.membership.progress) }}% </div>
|
<div class="ml-3"> {{ frappe.utils.cint(course.membership.progress) }}% </div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if course.quizzes | length or course.assignments | length %}
|
{% if course.quizzes | length or course.assignments | length or course.evaluations | length %}
|
||||||
<div class="my-5">
|
<div class="my-5">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
@@ -73,90 +75,10 @@
|
|||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% for quiz in course.quizzes %}
|
{{ Quiz(course, student) }}
|
||||||
{% set filters = { "member": student.name, "course": course.course } %}
|
{{ Assignment(course, student, is_moderator) }}
|
||||||
{% set has_submitted = frappe.db.exists("LMS Quiz Submission", filters) %}
|
{{ Evaluation(course, student, is_moderator) }}
|
||||||
{% set submission = frappe.db.get_value("LMS Quiz Submission", filters, ["score", "creation"], as_dict=True) %}
|
|
||||||
{% set total_questions = frappe.db.count("LMS Quiz Question", {"parent": quiz.name}) %}
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="vertically-center">
|
|
||||||
<svg class="icon icon-sm">
|
|
||||||
<use href="#icon-quiz"></use>
|
|
||||||
</svg>
|
|
||||||
{{ _("Quiz") }}
|
|
||||||
</td>
|
|
||||||
<td>{{ quiz.title }}</td>
|
|
||||||
{% if has_submitted %}
|
|
||||||
<td>{{ submission.score }}/{{ total_questions }}</td>
|
|
||||||
<td>{{ frappe.utils.format_date(submission.creation, "medium") }}</td>
|
|
||||||
{% else %}
|
|
||||||
<td>-</td>
|
|
||||||
<td>
|
|
||||||
<div class="indicator-pill red">
|
|
||||||
{{ _("Not Attempted") }}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% for assignment in course.assignments %}
|
|
||||||
{% set filters = { "member": student.name, "course": course.course, "lesson": assignment.name } %}
|
|
||||||
{% set has_submitted = frappe.db.exists("Lesson Assignment", filters) %}
|
|
||||||
{% set submission = frappe.db.get_value("Lesson Assignment", filters, ["assignment", "creation", "status"], as_dict=True) %}
|
|
||||||
{% set status = submission.status %}
|
|
||||||
{% set color = "green" if status == "Pass" else "red" if status == "Fail" else "orange" %}
|
|
||||||
|
|
||||||
<tr {% if has_submitted %} class="clickable-row" data-href="/assignments/{{ has_submitted }}" {% endif %}>
|
|
||||||
<td class="{% if has_submitted %} subheading {% endif %} vertically-center">
|
|
||||||
<svg class="icon icon-md">
|
|
||||||
<use href="#icon-file"></use>
|
|
||||||
</svg>
|
|
||||||
{{ _("Assignment") }}
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>{{ assignment.title }}</td>
|
|
||||||
|
|
||||||
{% if has_submitted %}
|
|
||||||
<td>
|
|
||||||
<div class="indicator-pill {{ color }}">
|
|
||||||
{{ status }}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>{{ frappe.utils.format_date(submission.creation, "medium") }}</td>
|
|
||||||
|
|
||||||
{% else %}
|
|
||||||
<td>-</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
<div class="indicator-pill red">
|
|
||||||
{{ _("Not Attempted") }}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% for evaluation in course.evaluations %}
|
|
||||||
{% set color = "green" if evaluation.status == "Pass" else "red" %}
|
|
||||||
<tr class="clickable-row" data-href="/evaluation/{{evaluation.name}}">
|
|
||||||
<td class="subheading vertically-center">
|
|
||||||
<svg class="icon icon-md">
|
|
||||||
<use href="#icon-quality"></use>
|
|
||||||
</svg>
|
|
||||||
{{ _("Evaluation") }}
|
|
||||||
</td>
|
|
||||||
<td> - </td>
|
|
||||||
<td>
|
|
||||||
<div class="indicator-pill {{ color }}">
|
|
||||||
{{ evaluation.status }}
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td>{{ frappe.utils.format_date(evaluation.creation, "medium") }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
@@ -168,3 +90,100 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
{% macro Quiz(course, student) %}
|
||||||
|
{% for quiz in course.quizzes %}
|
||||||
|
{% set filters = { "member": student.name, "course": course.course } %}
|
||||||
|
{% set has_submitted = frappe.db.exists("LMS Quiz Submission", filters) %}
|
||||||
|
{% set submission = frappe.db.get_value("LMS Quiz Submission", filters, ["score", "creation"], as_dict=True) %}
|
||||||
|
{% set total_questions = frappe.db.count("LMS Quiz Question", {"parent": quiz.name}) %}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="vertically-center">
|
||||||
|
<svg class="icon icon-sm">
|
||||||
|
<use href="#icon-quiz"></use>
|
||||||
|
</svg>
|
||||||
|
{{ _("Quiz") }}
|
||||||
|
</td>
|
||||||
|
<td>{{ quiz.title }}</td>
|
||||||
|
{% if has_submitted %}
|
||||||
|
<td>{{ submission.score }}/{{ total_questions }}</td>
|
||||||
|
<td>{{ frappe.utils.format_date(submission.creation, "medium") }}</td>
|
||||||
|
{% else %}
|
||||||
|
<td>-</td>
|
||||||
|
<td>
|
||||||
|
<div class="indicator-pill red">
|
||||||
|
{{ _("Not Attempted") }}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
{% macro Assignment(course, student, is_moderator) %}
|
||||||
|
{% for assignment in course.assignments %}
|
||||||
|
{% set filters = { "member": student.name, "course": course.course, "lesson": assignment.name } %}
|
||||||
|
{% set has_submitted = frappe.db.exists("Lesson Assignment", filters) %}
|
||||||
|
{% set submission = frappe.db.get_value("Lesson Assignment", filters, ["assignment", "creation", "status"], as_dict=True) %}
|
||||||
|
{% set status = submission.status %}
|
||||||
|
{% set color = "green" if status == "Pass" else "red" if status == "Fail" else "orange" %}
|
||||||
|
{% set can_see_details = has_submitted and (is_moderator or frappe.session.user == student.name) %}
|
||||||
|
|
||||||
|
<tr {% if can_see_details %} class="clickable-row" data-href="/assignments/{{ has_submitted }}" {% endif %}>
|
||||||
|
<td class="{% if can_see_details %} subheading {% endif %} vertically-center">
|
||||||
|
<svg class="icon icon-md">
|
||||||
|
<use href="#icon-file"></use>
|
||||||
|
</svg>
|
||||||
|
{{ _("Assignment") }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>{{ assignment.title }}</td>
|
||||||
|
|
||||||
|
{% if has_submitted %}
|
||||||
|
<td>
|
||||||
|
<div class="indicator-pill {{ color }}">
|
||||||
|
{{ status }}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>{{ frappe.utils.format_date(submission.creation, "medium") }}</td>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
<td>-</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<div class="indicator-pill red">
|
||||||
|
{{ _("Not Attempted") }}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
{% macro Evaluation(course, student, is_moderator) %}
|
||||||
|
{% for evaluation in course.evaluations %}
|
||||||
|
{% set color = "green" if evaluation.status == "Pass" else "red" %}
|
||||||
|
{% set can_see_details = is_moderator or frappe.session.user == student.name %}
|
||||||
|
|
||||||
|
<tr {% if can_see_details %} class="clickable-row" data-href="/evaluation/{{evaluation.name}}" {% endif %}>
|
||||||
|
<td class="{% if can_see_details %} subheading {% endif %} vertically-center">
|
||||||
|
<svg class="icon icon-md">
|
||||||
|
<use href="#icon-quality"></use>
|
||||||
|
</svg>
|
||||||
|
{{ _("Evaluation") }}
|
||||||
|
</td>
|
||||||
|
<td> - </td>
|
||||||
|
<td>
|
||||||
|
<div class="indicator-pill {{ color }}">
|
||||||
|
{{ evaluation.status }}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>{{ frappe.utils.format_date(evaluation.creation, "medium") }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% endmacro %}
|
||||||
|
|||||||
@@ -6,15 +6,9 @@ from frappe import _
|
|||||||
def get_context(context):
|
def get_context(context):
|
||||||
context.no_cache = 1
|
context.no_cache = 1
|
||||||
|
|
||||||
if not has_course_moderator_role():
|
|
||||||
message = "Only Moderators have access to this page."
|
|
||||||
if frappe.session.user == "Guest":
|
|
||||||
message = "Please login to access this page."
|
|
||||||
|
|
||||||
raise frappe.PermissionError(_(message))
|
|
||||||
|
|
||||||
student = frappe.form_dict["username"]
|
student = frappe.form_dict["username"]
|
||||||
classname = frappe.form_dict["classname"]
|
classname = frappe.form_dict["classname"]
|
||||||
|
context.is_moderator = has_course_moderator_role()
|
||||||
|
|
||||||
context.student = frappe.db.get_value(
|
context.student = frappe.db.get_value(
|
||||||
"User",
|
"User",
|
||||||
|
|||||||
0
lms/www/quiz_result/__init__.py
Normal file
0
lms/www/quiz_result/__init__.py
Normal file
Reference in New Issue
Block a user