feat: add graded field to course_blocks table

---------

Co-authored-by: Muhammad Faraz  Maqsood <faraz.maqsood@a006-01130.home>
This commit is contained in:
Muhammad Faraz Maqsood 2023-08-28 12:06:50 +05:00 committed by GitHub
parent 80e8538037
commit 02b29e64d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -0,0 +1 @@
- [Improvement] Users will now have the access to graded field in course_blocks table with this change which indicates if course unit is graded or not. (by @Faraz32123)

View File

@ -0,0 +1,2 @@
ALTER TABLE course_blocks
ADD COLUMN graded String DEFAULT 'false';

View File

@ -42,13 +42,14 @@ def import_course(course_key):
print("======================", course_id, course.display_name)
values = [
sql_format(
"('{}', '{}', '{}', '{}', '{}', '{}')",
"('{}', '{}', '{}', '{}', '{}', '{}', '{}')",
course_id,
str(child.location),
child.location.block_id,
str(position),
child.display_name or "N/A",
full_name,
"true" if child.graded else "false",
)
for position, (child, full_name) in enumerate(iter_course_blocks(course))
]
@ -63,7 +64,7 @@ def import_course(course_key):
),
)
insert_query = sql_format(
"INSERT INTO course_blocks (course_id, block_key, block_id, position, display_name, full_name) VALUES "
"INSERT INTO course_blocks (course_id, block_key, block_id, position, display_name, full_name, graded) VALUES "
)
insert_query += ", ".join(values)
make_query(insert_query)