added basic seat arrangement
This commit is contained in:
parent
cd8d0e7230
commit
ac43488c4a
|
@ -7,20 +7,10 @@
|
|||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"exam_group",
|
||||
"hall_allocation",
|
||||
"seating_order",
|
||||
"amended_from"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "exam_group",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Exam Group",
|
||||
"options": "Exam Group",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
|
@ -33,21 +23,16 @@
|
|||
{
|
||||
"fieldname": "hall_allocation",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Hall Allocation",
|
||||
"options": "Hall Allocation",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "seating_order",
|
||||
"fieldtype": "Table",
|
||||
"label": "Seating Order",
|
||||
"options": "Seats And Exams"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-04-22 08:59:16.524150",
|
||||
"modified": "2023-04-22 21:05:40.236278",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Exam Helper",
|
||||
"name": "Seat Arrangement",
|
||||
|
|
|
@ -1,9 +1,28 @@
|
|||
# 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 SeatArrangement(Document):
|
||||
pass
|
||||
def before_insert(self):
|
||||
print("loading hall allocation")
|
||||
hall_allocation = frappe.get_doc("Hall Allocation", self.hall_allocation)
|
||||
print("randomizing students")
|
||||
students = hall_allocation.get_students_randomized()
|
||||
for exam_hall in hall_allocation.allocated_rooms:
|
||||
print("exam hall", exam_hall.id)
|
||||
for i in range(exam_hall.number_of_students):
|
||||
if not students:
|
||||
print("no more students")
|
||||
break
|
||||
seat = frappe.new_doc("Seats And Exams")
|
||||
seat.exam_hall = exam_hall.id
|
||||
seat.seat_number = i + 1
|
||||
seat.candidate = students.pop(0)
|
||||
# seat.parent = self.name
|
||||
# seat.parentfield = "seating_order"
|
||||
# seat.parenttype = self.doctype
|
||||
print("adding", seat.candidate, "to seat", seat.seat_number)
|
||||
seat.insert()
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// Copyright (c) 2023, CSE 2020 Batch and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Seats And Exams", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "format:SEAT-{######}-{exam_hall}-{seat_number}",
|
||||
"creation": "2023-04-19 18:35:43.409735",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
|
@ -13,7 +14,7 @@
|
|||
"fields": [
|
||||
{
|
||||
"fieldname": "seat_number",
|
||||
"fieldtype": "Data",
|
||||
"fieldtype": "Int",
|
||||
"in_list_view": 1,
|
||||
"label": "Seat number",
|
||||
"reqd": 1
|
||||
|
@ -35,14 +36,27 @@
|
|||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-04-22 08:57:43.430784",
|
||||
"modified": "2023-04-22 21:09:24.039239",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Exam Helper",
|
||||
"name": "Seats And Exams",
|
||||
"naming_rule": "Expression",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"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": []
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2023, CSE 2020 Batch and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestSeatsAndExams(FrappeTestCase):
|
||||
pass
|
Loading…
Reference in New Issue