removed old duty list, hall alocation and seat arrangement
This commit is contained in:
parent
dd768f6c79
commit
1756cc97f5
|
@ -1,8 +0,0 @@
|
|||
// Copyright (c) 2023, CSE 2020 Batch and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Duty List", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
|
@ -1,83 +0,0 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"creation": "2023-05-15 19:27:00.610026",
|
||||
"default_view": "List",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"exam_group",
|
||||
"date",
|
||||
"session",
|
||||
"section_break_hlpy",
|
||||
"duties",
|
||||
"amended_from"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "exam_group",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Exam Group",
|
||||
"options": "Exam Group",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Date"
|
||||
},
|
||||
{
|
||||
"fieldname": "session",
|
||||
"fieldtype": "Select",
|
||||
"label": "Session",
|
||||
"options": "Forenoon\nAfternoon"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_hlpy",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Duty List"
|
||||
},
|
||||
{
|
||||
"fieldname": "duties",
|
||||
"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-19 17:43:12.500255",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Exam Helper",
|
||||
"name": "Duty List",
|
||||
"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": []
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
# Copyright (c) 2023, CSE 2020 Batch and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class DutyList(Document):
|
||||
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.name,
|
||||
"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()
|
|
@ -1,9 +0,0 @@
|
|||
# Copyright (c) 2023, CSE 2020 Batch and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestDutyList(FrappeTestCase):
|
||||
pass
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright (c) 2023, CSE 2020 Batch and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
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);
|
||||
// })
|
||||
},
|
||||
});
|
|
@ -1,97 +0,0 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "format:ALLOCATION-{####}-{date}-{session}",
|
||||
"creation": "2023-04-06 10:53:24.067133",
|
||||
"default_view": "List",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"date",
|
||||
"session",
|
||||
"exam_group",
|
||||
"allocated_rooms",
|
||||
"amended_from"
|
||||
],
|
||||
"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
|
||||
},
|
||||
{
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"options": "Hall Allocation",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"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 MultiSelect",
|
||||
"label": "Allocated rooms",
|
||||
"options": "Exam Hall Child"
|
||||
},
|
||||
{
|
||||
"fieldname": "exam_group",
|
||||
"fieldtype": "Link",
|
||||
"label": "Exam Group",
|
||||
"options": "Exam Group",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-05-19 13:55:56.978044",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Exam Helper",
|
||||
"name": "Hall Allocation",
|
||||
"naming_rule": "Expression",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Exam Cell Staff",
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
# Copyright (c) 2023, CSE 2020 Batch and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class HallAllocation(Document):
|
||||
def before_insert(self):
|
||||
"""automatically allocate exam halls to the exam"""
|
||||
exam_halls = frappe.get_list("Exam Hall", pluck="name")
|
||||
exam_group = frappe.get_doc("Exam Group", self.exam_group)
|
||||
remaining_students = exam_group.number_of_students
|
||||
print(vars(self))
|
||||
for exam_hall in exam_halls:
|
||||
# students allocated to the exam hall
|
||||
number_of_students = 0
|
||||
if remaining_students <= 0:
|
||||
break
|
||||
print(exam_hall)
|
||||
exam_hall = frappe.get_doc("Exam Hall", exam_hall)
|
||||
if remaining_students >= exam_hall.seating_capacity:
|
||||
number_of_students = exam_hall.seating_capacity
|
||||
else:
|
||||
number_of_students = remaining_students
|
||||
remaining_students -= number_of_students
|
||||
e = frappe.new_doc("Exam Hall Child")
|
||||
e.update(
|
||||
{
|
||||
"id": exam_hall.name,
|
||||
"parent": self.name,
|
||||
"parentfield": "allocated_rooms",
|
||||
"parenttype": self.doctype,
|
||||
"number_of_students": number_of_students,
|
||||
}
|
||||
)
|
||||
# e.save()
|
||||
print(vars(self))
|
||||
self.allocated_rooms.append(e)
|
||||
|
||||
def get_students_randomized(self):
|
||||
exam_group = frappe.get_doc("Exam Group", self.exam_group)
|
||||
return exam_group.randomize_students_by_exam()
|
|
@ -1,9 +0,0 @@
|
|||
# Copyright (c) 2023, CSE 2020 Batch and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestHallAllocation(FrappeTestCase):
|
||||
pass
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright (c) 2023, CSE 2020 Batch and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
// frappe.ui.form.on("Seat Arrangement", {
|
||||
// refresh(frm) {
|
||||
|
||||
// },
|
||||
// });
|
|
@ -1,84 +0,0 @@
|
|||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"creation": "2023-04-19 18:33:56.264107",
|
||||
"default_view": "List",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"hall_allocation",
|
||||
"date",
|
||||
"session",
|
||||
"amended_from"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"options": "Seat Arrangement",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "hall_allocation",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"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-05-19 16:33:30.748913",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Exam Helper",
|
||||
"name": "Seat Arrangement",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Exam Cell Staff",
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"states": []
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
# Copyright (c) 2023, CSE 2020 Batch and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
|
||||
class SeatArrangement(Document):
|
||||
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.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
|
||||
print("adding", seat.candidate, "to seat", seat.seat_number)
|
||||
seat.insert()
|
|
@ -1,9 +0,0 @@
|
|||
# Copyright (c) 2023, CSE 2020 Batch and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.tests.utils import FrappeTestCase
|
||||
|
||||
|
||||
class TestSeatArrangement(FrappeTestCase):
|
||||
pass
|
Loading…
Reference in New Issue