Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: duration field in quiz should be in minutes #1230

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lms/lms/doctype/lms_quiz/lms_quiz.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@
},
{
"fieldname": "duration",
"fieldtype": "Duration",
"label": "Duration"
"fieldtype": "Data",
"label": "Duration (in minutes)"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-10-11 22:39:40.381183",
"modified": "2025-01-06 11:02:09.749207",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Quiz",
Expand Down
3 changes: 2 additions & 1 deletion lms/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.delete_web_forms
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 changes: 10 additions & 0 deletions lms/patches/v2_0/convert_quiz_duration_to_minutes.py
Original file line number Diff line number Diff line change
@@ -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))
Loading