Update functions.py
Browse files- functions.py +22 -15
functions.py
CHANGED
|
@@ -109,27 +109,34 @@ def generate_all_sections_0(data):
|
|
| 109 |
return sections_content # Return the content dictionary
|
| 110 |
|
| 111 |
|
| 112 |
-
def
|
| 113 |
"""
|
| 114 |
-
Generate
|
| 115 |
"""
|
| 116 |
-
|
|
|
|
|
|
|
| 117 |
report_type = data.get("report_type")
|
|
|
|
|
|
|
| 118 |
report_sections = get_report_sections(report_type)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
# Call the corresponding section generation function
|
| 127 |
-
if section_function_name:
|
| 128 |
section_content = call_dynamic_function(section_function_name, data)
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
|
|
|
| 133 |
|
| 134 |
|
| 135 |
# Define the actual generation functions, like:
|
|
|
|
| 109 |
return sections_content # Return the content dictionary
|
| 110 |
|
| 111 |
|
| 112 |
+
def generate_all_sections(data):
|
| 113 |
"""
|
| 114 |
+
Generate all sections for the specified report type and update the session tracker.
|
| 115 |
"""
|
| 116 |
+
sections_content = {}
|
| 117 |
+
|
| 118 |
+
# Get the report type from data
|
| 119 |
report_type = data.get("report_type")
|
| 120 |
+
|
| 121 |
+
# Retrieve sections based on report type
|
| 122 |
report_sections = get_report_sections(report_type)
|
| 123 |
+
|
| 124 |
+
# Loop through each section and generate content
|
| 125 |
+
for section_name, function_name in report_sections:
|
| 126 |
+
if function_name == "generate_all_sections":
|
| 127 |
+
continue # Skip "All Sections" itself
|
| 128 |
|
| 129 |
+
# Update the session tracker for each section
|
| 130 |
+
update_session_tracker(section_name)
|
| 131 |
+
|
| 132 |
+
# Dynamically call the function to generate the content
|
| 133 |
+
section_function_name = dict(report_sections)[section_name]
|
|
|
|
|
|
|
|
|
|
| 134 |
section_content = call_dynamic_function(section_function_name, data)
|
| 135 |
+
|
| 136 |
+
# Store the generated content
|
| 137 |
+
sections_content[section_name] = section_content
|
| 138 |
+
|
| 139 |
+
return sections_content
|
| 140 |
|
| 141 |
|
| 142 |
# Define the actual generation functions, like:
|