diff --git a/api/controllers/inner_tools/answers_summary_analysis.py b/api/controllers/inner_tools/answers_summary_analysis.py index b779304f3d..d058dff42a 100644 --- a/api/controllers/inner_tools/answers_summary_analysis.py +++ b/api/controllers/inner_tools/answers_summary_analysis.py @@ -297,96 +297,106 @@ class GenerateAnalysisReportApi(Resource): data = request.get_json() summary_analysis = data.get('summary_analysis') school_name = data.get('school_name', '山东单县一中') # Default value if not provided + html_template = data.get('html_template') if not summary_analysis: return {"error": "summary_analysis is required"}, 400 - # HTML template for the report - html_template = """ - - - - - - - -

模拟考分析报告

-
Analysis of Examination
- -

{{ school_name }}

- -
-
-
总参考人数:
-
总平均分:
-
省内排名:
-
-
-
省内总人数:
-
省内平均分:
-
全国排名:
+ if not html_template: # default template + html_template = """ + + + + + + + +

模拟考分析报告

+
Analysis of Examination
+ +

{{ school_name }}

+ +
+
+
总参考人数:
+
总平均分:
+
省内排名:
+
+
+
省内总人数:
+
省内平均分:
+
全国排名:
+
-
-
-

题目分析:

- - {% for category in summary_analysis %} -
-
{{ category.category }}
-
-
- - 错误数{{ category.error_count }} / 总数{{ category.total_count }} - 失分比{{ (1 - category.correct_rate) * 100 }}% - +
+

题目分析:

+ + {% for category in summary_analysis %} +
+
{{ category.category }}
+
+
+
+ 做错{{ category.error_count }} +
+
+ 总考生数{{ category.total_count }} +
+
+ 失分比{{ ((1 - category.correct_rate) * 100)|round }}% +
+
+
+ {% endfor %}
- {% endfor %} -
- - - """ + + + """ # Create the HTML with the template template = Template(html_template)