edited exam group code

This commit is contained in:
Pranav Jerry 2023-03-26 16:40:29 +05:30
parent f10be73e68
commit d37c08c428
Signed by: pranav
GPG Key ID: F1DCDC4FED0A0C5B
3 changed files with 27 additions and 12 deletions

View File

@ -20,15 +20,13 @@
"fieldname": "exams",
"fieldtype": "Table MultiSelect",
"label": "Exams",
"options": "Exam Child",
"read_only": 1
"options": "Exam Child"
},
{
"fieldname": "exam_halls",
"fieldtype": "Table MultiSelect",
"label": "Exam halls",
"options": "Exam Hall Child",
"read_only": 1
"options": "Exam Hall Child"
},
{
"fieldname": "date",
@ -54,7 +52,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-03-26 16:27:34.066446",
"modified": "2023-03-26 16:39:58.804963",
"modified_by": "Administrator",
"module": "Exam Helper",
"name": "Exam Group",
@ -86,6 +84,7 @@
"write": 1
}
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": []

View File

@ -1,9 +1,25 @@
# Copyright (c) 2023, CSE 2020 Batch and contributors
# For license information, please see license.txt
# import frappe
import frappe
from frappe.model.document import Document
class ExamGroup(Document):
pass
def before_save(self):
exams = frappe.db.get_list(
"Exam", filters={"date": self.date, "session": self.session}
)
if not exams:
frappe.throw("No exams found on given date and session")
for i in exams:
exam_child = frappe.new_doc("Exam Child")
exam_child.update(
{
"id": i["name"],
"parent": self.name,
"parentfield": "exams",
"parenttype": "Exam Group",
}
)
self.exams.append(exam_child)

View File

@ -1,6 +1,6 @@
{
"charts": [],
"content": "[{\"id\":\"EpEN4H-bro\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\">Home</span>\",\"col\":12}},{\"id\":\"v61j6hrUCm\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Exam\",\"col\":3}},{\"id\":\"UoB7pAE7LB\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Exam Cell Staff\",\"col\":3}},{\"id\":\"LFtWFqYATl\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"ou7RlM73oj\",\"type\":\"quick_list\",\"data\":{\"quick_list_name\":\"Exam Hall\",\"col\":4}},{\"id\":\"GL0vmECDPt\",\"type\":\"quick_list\",\"data\":{\"quick_list_name\":\"Staff\",\"col\":4}},{\"id\":\"8cD3Hs9JJI\",\"type\":\"quick_list\",\"data\":{\"quick_list_name\":\"Class\",\"col\":4}},{\"id\":\"4kQX3h851L\",\"type\":\"quick_list\",\"data\":{\"quick_list_name\":\"Exam\",\"col\":4}}]",
"content": "[{\"id\":\"EpEN4H-bro\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\">Home</span>\",\"col\":12}},{\"id\":\"3Jsj9VNVYY\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Create exam group\",\"col\":3}},{\"id\":\"UoB7pAE7LB\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Exam Cell Staff\",\"col\":3}},{\"id\":\"LFtWFqYATl\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"ou7RlM73oj\",\"type\":\"quick_list\",\"data\":{\"quick_list_name\":\"Exam Hall\",\"col\":4}},{\"id\":\"GL0vmECDPt\",\"type\":\"quick_list\",\"data\":{\"quick_list_name\":\"Staff\",\"col\":4}},{\"id\":\"8cD3Hs9JJI\",\"type\":\"quick_list\",\"data\":{\"quick_list_name\":\"Class\",\"col\":4}},{\"id\":\"4kQX3h851L\",\"type\":\"quick_list\",\"data\":{\"quick_list_name\":\"Exam\",\"col\":4}}]",
"creation": "2023-03-26 16:03:41.749794",
"docstatus": 0,
"doctype": "Workspace",
@ -11,7 +11,7 @@
"is_hidden": 0,
"label": "Home",
"links": [],
"modified": "2023-03-26 16:23:26.269964",
"modified": "2023-03-26 16:35:34.846406",
"modified_by": "Administrator",
"module": "Exam Helper",
"name": "Home",
@ -42,9 +42,9 @@
"shortcuts": [
{
"color": "Grey",
"doc_view": "List",
"label": "Exam",
"link_to": "Exam",
"doc_view": "New",
"label": "Create exam group",
"link_to": "Exam Group",
"type": "DocType"
},
{