diff --git a/changelog.d/20230828_115409_faraz.maqsood_faraz_add_graded_field_to_course_blocks_model.md b/changelog.d/20230828_115409_faraz.maqsood_faraz_add_graded_field_to_course_blocks_model.md new file mode 100644 index 0000000..764031a --- /dev/null +++ b/changelog.d/20230828_115409_faraz.maqsood_faraz_add_graded_field_to_course_blocks_model.md @@ -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) diff --git a/tutorcairn/templates/cairn/apps/clickhouse/migrations.d/0009_add_graded_column_to_course_blocks.sql b/tutorcairn/templates/cairn/apps/clickhouse/migrations.d/0009_add_graded_column_to_course_blocks.sql new file mode 100644 index 0000000..9093a5f --- /dev/null +++ b/tutorcairn/templates/cairn/apps/clickhouse/migrations.d/0009_add_graded_column_to_course_blocks.sql @@ -0,0 +1,2 @@ +ALTER TABLE course_blocks +ADD COLUMN graded String DEFAULT 'false'; \ No newline at end of file diff --git a/tutorcairn/templates/cairn/apps/openedx/scripts/importcoursedata.py b/tutorcairn/templates/cairn/apps/openedx/scripts/importcoursedata.py index a43c2c7..7ef0702 100644 --- a/tutorcairn/templates/cairn/apps/openedx/scripts/importcoursedata.py +++ b/tutorcairn/templates/cairn/apps/openedx/scripts/importcoursedata.py @@ -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)