refactor: duration field in quiz should be in minutes
This commit is contained in:
@@ -132,13 +132,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "duration",
|
"fieldname": "duration",
|
||||||
"fieldtype": "Duration",
|
"fieldtype": "Data",
|
||||||
"label": "Duration"
|
"label": "Duration"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-10-11 22:39:40.381183",
|
"modified": "2025-01-06 10:46:50.564614",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Quiz",
|
"name": "LMS Quiz",
|
||||||
|
|||||||
@@ -95,4 +95,5 @@ lms.patches.v2_0.add_course_statistics #21-10-2024
|
|||||||
lms.patches.v2_0.give_discussions_permissions
|
lms.patches.v2_0.give_discussions_permissions
|
||||||
lms.patches.v2_0.delete_web_forms
|
lms.patches.v2_0.delete_web_forms
|
||||||
lms.patches.v2_0.update_desk_access_for_lms_roles
|
lms.patches.v2_0.update_desk_access_for_lms_roles
|
||||||
lms.patches.v2_0.update_quiz_submission_data
|
lms.patches.v2_0.update_quiz_submission_data
|
||||||
|
lms.patches.v2_0.convert_quiz_duration_to_minutes
|
||||||
10
lms/patches/v2_0/convert_quiz_duration_to_minutes.py
Normal file
10
lms/patches/v2_0/convert_quiz_duration_to_minutes.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import frappe
|
||||||
|
from frappe.utils import ceil, flt
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
quizzes = frappe.get_all(
|
||||||
|
"LMS Quiz", fields=["name", "duration"], filters={"duration": [">", 0]}
|
||||||
|
)
|
||||||
|
for quiz in quizzes:
|
||||||
|
frappe.db.set_value("LMS Quiz", quiz.name, "duration", ceil(flt(quiz.duration) / 60))
|
||||||
Reference in New Issue
Block a user