@@ -2723,22 +2723,33 @@ def export_ora2_data(request, course_id):
2723
2723
return JsonResponse ({"status" : success_status })
2724
2724
2725
2725
2726
- @transaction .non_atomic_requests
2727
- @require_POST
2728
- @ensure_csrf_cookie
2729
- @cache_control (no_cache = True , no_store = True , must_revalidate = True )
2730
- @require_course_permission (permissions .CAN_RESEARCH )
2731
- @common_exceptions_400
2732
- def export_ora2_summary (request , course_id ):
2726
+ @method_decorator (transaction .non_atomic_requests , name = 'dispatch' )
2727
+ class ExportOra2SummaryView (DeveloperErrorViewMixin , APIView ):
2733
2728
"""
2734
- Pushes a Celery task which will aggregate a summary students' progress in ora2 tasks for a course into a .csv
2729
+ Pushes a Celery task which will aggregate a summary of students' progress in ora2 tasks for a course into a .csv
2735
2730
"""
2736
- course_key = CourseKey .from_string (course_id )
2737
- report_type = _ ('ORA summary' )
2738
- task_api .submit_export_ora2_summary (request , course_key )
2739
- success_status = SUCCESS_MESSAGE_TEMPLATE .format (report_type = report_type )
2731
+ permission_classes = (IsAuthenticated , permissions .InstructorPermission )
2732
+ permission_name = permissions .CAN_RESEARCH
2740
2733
2741
- return JsonResponse ({"status" : success_status })
2734
+ @method_decorator (ensure_csrf_cookie )
2735
+ @method_decorator (cache_control (no_cache = True , no_store = True , must_revalidate = True ))
2736
+ def post (self , request , course_id ):
2737
+ """
2738
+ Initiates a Celery task to generate an ORA summary report for the specified course.
2739
+
2740
+ Args:
2741
+ request: The HTTP request object
2742
+ course_id: The string representation of the course key
2743
+
2744
+ Returns:
2745
+ Response: A JSON response with a status message indicating the report generation has started
2746
+ """
2747
+ course_key = CourseKey .from_string (course_id )
2748
+ report_type = _ ('ORA summary' )
2749
+ task_api .submit_export_ora2_summary (request , course_key )
2750
+ success_status = SUCCESS_MESSAGE_TEMPLATE .format (report_type = report_type )
2751
+
2752
+ return Response ({"status" : success_status })
2742
2753
2743
2754
2744
2755
@transaction .non_atomic_requests
0 commit comments