added virtual doctype Auto Exam Group

This commit is contained in:
Pranav Jerry 2023-04-04 18:57:15 +05:30
parent 9c05f0b91d
commit b047559820
Signed by: pranav
GPG Key ID: F1DCDC4FED0A0C5B
5 changed files with 122 additions and 0 deletions

View File

@ -0,0 +1,8 @@
// Copyright (c) 2023, CSE 2020 Batch and contributors
// For license information, please see license.txt
// frappe.ui.form.on("Auto Exam Group", {
// refresh(frm) {
// },
// });

View File

@ -0,0 +1,57 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "format:{date} {session}",
"creation": "2023-04-04 17:55:32.735126",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"date",
"session"
],
"fields": [
{
"fieldname": "date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Date",
"reqd": 1
},
{
"fieldname": "session",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Session",
"options": "Forenoon\nAfternoon",
"reqd": 1
}
],
"index_web_pages_for_search": 1,
"is_virtual": 1,
"links": [],
"modified": "2023-04-04 17:55:32.735126",
"modified_by": "Administrator",
"module": "Exam Helper",
"name": "Auto Exam Group",
"naming_rule": "Expression (old style)",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}

View File

@ -0,0 +1,48 @@
# Copyright (c) 2023, CSE 2020 Batch and contributors
# For license information, please see license.txt
import frappe
from frappe.model.document import Document
class AutoExamGroup(Document):
def db_insert(self, *args, **kwargs):
pass
def load_from_db(self):
s = self.name.split()
print(s)
super(Document, self).__init__(
{"name": self.name, "date": s[0], "session": s[1]}
)
def db_update(self):
pass
@staticmethod
def get_list(args):
list_of_dates_and_session = []
exams = frappe.get_all("Exam")
for exam in exams:
exam = frappe.get_doc("Exam", exam["name"])
print(exam.date, exam.session)
list_of_dates_and_session.append(
{
"date": exam.date,
"session": exam.session,
"name": str(exam.date) + " " + exam.session,
}
)
list_of_dates_and_session = [
dict(t) for t in {tuple(d.items()) for d in list_of_dates_and_session}
]
print(list_of_dates_and_session)
return list_of_dates_and_session
@staticmethod
def get_count(args):
pass
@staticmethod
def get_stats(args):
pass

View File

@ -0,0 +1,9 @@
# Copyright (c) 2023, CSE 2020 Batch and Contributors
# See license.txt
# import frappe
from frappe.tests.utils import FrappeTestCase
class TestAutoExamGroup(FrappeTestCase):
pass