namy changes: read full commit
added duty list generation button in hall allocation to generate seat arrangement
This commit is contained in:
parent
0bf8815854
commit
d9c921c91d
|
@ -11,7 +11,8 @@
|
|||
"date",
|
||||
"session",
|
||||
"section_break_hlpy",
|
||||
"duties"
|
||||
"duties",
|
||||
"amended_from"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
|
@ -42,11 +43,21 @@
|
|||
"fieldtype": "Table",
|
||||
"label": "Duties",
|
||||
"options": "Invigilator And Duty"
|
||||
},
|
||||
{
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"options": "Duty List",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-05-15 19:29:57.812521",
|
||||
"modified": "2023-05-19 17:32:44.020690",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Exam Helper",
|
||||
"name": "Duty List",
|
||||
|
|
|
@ -1,9 +1,55 @@
|
|||
# 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 DutyList(Document):
|
||||
pass
|
||||
def before_insert(self):
|
||||
print(self.exam_group)
|
||||
exam_group = frappe.get_doc("Exam Group", self.exam_group)
|
||||
self.date = exam_group.date
|
||||
self.session = exam_group.session
|
||||
hall = exam_group.get_hall_allocation()
|
||||
total_invigilators_required = 0
|
||||
print(hall.allocated_rooms)
|
||||
all_staff = []
|
||||
for room in hall.allocated_rooms:
|
||||
invigilators_required = room.number_of_students // 30
|
||||
if invigilators_required == 0:
|
||||
invigilators_required += 1
|
||||
total_invigilators_required += invigilators_required
|
||||
print(total_invigilators_required)
|
||||
for i in range(total_invigilators_required):
|
||||
if not all_staff:
|
||||
all_staff = frappe.db.get_list(
|
||||
"Staff", pluck="name", order_by="duty_count asc"
|
||||
)
|
||||
|
||||
staff = all_staff.pop(0)
|
||||
staff = frappe.get_doc("Staff", staff)
|
||||
print(staff)
|
||||
invigilator_child = frappe.new_doc("Invigilator And Duty")
|
||||
invigilator_child.update(
|
||||
{
|
||||
"invigilator": staff,
|
||||
"invigilator_name": staff.full_name,
|
||||
"invigilator_department": staff.department,
|
||||
"parent": self.name,
|
||||
"parentfield": "duties",
|
||||
"parenttype": self.doctype,
|
||||
}
|
||||
)
|
||||
print(invigilator_child)
|
||||
self.duties.append(invigilator_child)
|
||||
|
||||
# def before_submit(self):
|
||||
# print("submit")
|
||||
# print(self.duties)
|
||||
# for inv in self.duties:
|
||||
# print(inv)
|
||||
# staff = frappe.get_doc("Staff", inv.invigilator)
|
||||
# staff.duty_count += 1
|
||||
# print("updating duty count for", staff.full_name)
|
||||
# staff.save()
|
||||
|
|
|
@ -53,3 +53,13 @@ class ExamGroup(Document):
|
|||
break
|
||||
randomized.append(students[i].pop(0))
|
||||
return randomized
|
||||
|
||||
def get_hall_allocation(self):
|
||||
halls = frappe.db.get_list(
|
||||
"Hall Allocation",
|
||||
filters={"date": self.date, "session": self.session},
|
||||
pluck="name",
|
||||
)
|
||||
if not halls:
|
||||
return None
|
||||
return frappe.get_doc("Hall Allocation", halls[0])
|
||||
|
|
|
@ -1,8 +1,22 @@
|
|||
// Copyright (c) 2023, CSE 2020 Batch and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Hall Allocation", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
||||
frappe.ui.form.on("Hall Allocation", {
|
||||
refresh(frm) {
|
||||
frm.add_custom_button("Allocate seats", () => {
|
||||
frm.trigger("allocate_seats");
|
||||
});
|
||||
frm.change_custom_button_type("Allocate seats", null, "primary");
|
||||
},
|
||||
allocate_seats(frm) {
|
||||
frappe.db.insert({
|
||||
doctype: "Seat Arrangement",
|
||||
date: frm.doc.date,
|
||||
session: frm.doc.session,
|
||||
hall_allocation: frm.doc.name,
|
||||
});
|
||||
// .then((doc) => {
|
||||
// frappe.set_route("Form", "Seat Arrangement", doc.name);
|
||||
// })
|
||||
},
|
||||
});
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
{
|
||||
"description": "Exam Halls allocated for the exam. Autogenerated by Exam Helper the first time it is created. Can be manually edited if needed",
|
||||
"fieldname": "allocated_rooms",
|
||||
"fieldtype": "Table",
|
||||
"fieldtype": "Table MultiSelect",
|
||||
"label": "Allocated rooms",
|
||||
"options": "Exam Hall Child"
|
||||
},
|
||||
|
@ -57,7 +57,7 @@
|
|||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-04-19 18:41:22.243548",
|
||||
"modified": "2023-05-19 13:55:56.978044",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Exam Helper",
|
||||
"name": "Hall Allocation",
|
||||
|
|
|
@ -15,24 +15,30 @@
|
|||
{
|
||||
"fieldname": "invigilator",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Invigilator",
|
||||
"options": "Staff"
|
||||
"options": "Staff",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "invigilator_name",
|
||||
"fieldtype": "Data",
|
||||
"label": "Invigilator Name"
|
||||
"in_list_view": 1,
|
||||
"label": "Invigilator Name",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "invigilator_department",
|
||||
"fieldtype": "Data",
|
||||
"label": "Invigilator Department"
|
||||
"in_list_view": 1,
|
||||
"label": "Invigilator Department",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-05-15 19:29:02.090465",
|
||||
"modified": "2023-05-19 17:34:53.289859",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Exam Helper",
|
||||
"name": "Invigilator And Duty",
|
||||
|
|
|
@ -6,4 +6,7 @@ from frappe.model.document import Document
|
|||
|
||||
|
||||
class InvigilatorAndDuty(Document):
|
||||
pass
|
||||
def before_insert(self):
|
||||
self.invigilator_name = self.invigilator.full_name
|
||||
self.invigilator_department = self.invigilator.department
|
||||
print("adding inv child")
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"hall_allocation",
|
||||
"date",
|
||||
"session",
|
||||
"amended_from"
|
||||
],
|
||||
"fields": [
|
||||
|
@ -27,12 +29,23 @@
|
|||
"label": "Hall Allocation",
|
||||
"options": "Hall Allocation",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Date"
|
||||
},
|
||||
{
|
||||
"fieldname": "session",
|
||||
"fieldtype": "Select",
|
||||
"label": "Session",
|
||||
"options": "Forenoon\nAfternoon"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-04-22 21:05:40.236278",
|
||||
"modified": "2023-05-19 16:33:30.748913",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Exam Helper",
|
||||
"name": "Seat Arrangement",
|
||||
|
|
|
@ -21,6 +21,9 @@ class SeatArrangement(Document):
|
|||
seat.exam_hall = exam_hall.id
|
||||
seat.seat_number = i + 1
|
||||
seat.candidate = students.pop(0)
|
||||
seat.hall_allocation = hall_allocation
|
||||
seat.date = hall_allocation.date
|
||||
seat.session = hall_allocation.session
|
||||
# seat.parent = self.name
|
||||
# seat.parentfield = "seating_order"
|
||||
# seat.parenttype = self.doctype
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
"field_order": [
|
||||
"exam_hall",
|
||||
"seat_number",
|
||||
"candidate"
|
||||
"candidate",
|
||||
"hall_allocation",
|
||||
"date",
|
||||
"session"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
|
@ -33,11 +36,28 @@
|
|||
"label": "Exam Hall",
|
||||
"options": "Exam Hall",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "hall_allocation",
|
||||
"fieldtype": "Link",
|
||||
"label": "Hall Allocation",
|
||||
"options": "Hall Allocation"
|
||||
},
|
||||
{
|
||||
"fieldname": "date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Date"
|
||||
},
|
||||
{
|
||||
"fieldname": "session",
|
||||
"fieldtype": "Select",
|
||||
"label": "Session",
|
||||
"options": "Forenoon\nAfternoon"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2023-04-22 21:09:24.039239",
|
||||
"modified": "2023-05-19 16:40:18.933744",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Exam Helper",
|
||||
"name": "Seats And Exams",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"charts": [],
|
||||
"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}}]",
|
||||
"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\":\"bQP8J0Mja6\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Create exam\",\"col\":3}},{\"id\":\"LFtWFqYATl\",\"type\":\"spacer\",\"data\":{\"col\":12}}]",
|
||||
"creation": "2023-03-26 16:03:41.749794",
|
||||
"docstatus": 0,
|
||||
"doctype": "Workspace",
|
||||
|
@ -11,7 +11,7 @@
|
|||
"is_hidden": 0,
|
||||
"label": "Home",
|
||||
"links": [],
|
||||
"modified": "2023-04-05 19:59:57.750130",
|
||||
"modified": "2023-05-19 13:30:04.573380",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Exam Helper",
|
||||
"name": "Home",
|
||||
|
@ -23,6 +23,13 @@
|
|||
"roles": [],
|
||||
"sequence_id": 8.0,
|
||||
"shortcuts": [
|
||||
{
|
||||
"color": "Grey",
|
||||
"doc_view": "New",
|
||||
"label": "Create exam",
|
||||
"link_to": "Exam",
|
||||
"type": "DocType"
|
||||
},
|
||||
{
|
||||
"color": "Grey",
|
||||
"doc_view": "List",
|
||||
|
|
Loading…
Reference in New Issue