Skip to content

Commit

Permalink
fix: assessment validation
Browse files Browse the repository at this point in the history
  • Loading branch information
pateljannat committed Jun 27, 2023
1 parent 0e1b91f commit f3830bf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
25 changes: 12 additions & 13 deletions lms/lms/doctype/lms_class/lms_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
# For license information, please see license.txt

import frappe
from frappe.model.document import Document
from frappe import _
from frappe.utils import cint, format_date, format_datetime
import requests
import base64
import json
from lms.lms.utils import has_course_moderator_role
from frappe import _
from frappe.model.document import Document
from frappe.utils import cint, format_date, format_datetime


class LMSClass(Document):
Expand Down Expand Up @@ -41,16 +40,16 @@ def validate_duplicate_courses(self):

def validate_duplicate_assessments(self):
assessments = [row.assessment_name for row in self.assessment]
duplicates = {
assessment for assessment in assessments if assessments.count(assessment) > 1
}
if len(duplicates):
title = frappe.db.get_value("LMS Assessment", next(iter(duplicates)), "title")
frappe.throw(
_("Assessment {0} has already been added to this class.").format(
frappe.bold(next(iter(duplicates)))
for assessment in self.assessment:
if assessments.count(assessment.assessment_name) > 1:
title = frappe.db.get_value(
assessment.assessment_type, assessment.assessment_name, "title"
)
frappe.throw(
_("Assessment {0} has already been added to this class.").format(
frappe.bold(title)
)
)
)

def validate_membership(self):
for course in self.courses:
Expand Down
6 changes: 6 additions & 0 deletions lms/public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2204,4 +2204,10 @@ select {

.btn-remove-course:hover {
opacity: 1;
}

.rows .grid-row .data-row,
.rows .grid-row .grid-footer-toolbar,
.grid-form-heading {
cursor: none;
}

0 comments on commit f3830bf

Please sign in to comment.