SoDa12321 commited on
Commit
d9dfcfd
·
verified ·
1 Parent(s): ef8f2b7

Update functions.py

Browse files
Files changed (1) hide show
  1. 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 generate_report_section(section_to_generate, data):
113
  """
114
- Generate content for a selected report section.
115
  """
116
- # Get report sections based on the report type
 
 
117
  report_type = data.get("report_type")
 
 
118
  report_sections = get_report_sections(report_type)
 
 
 
 
 
119
 
120
- # Dynamically call the function based on the selected section
121
- section_function_name = dict(report_sections).get(section_to_generate)
122
-
123
- # Update session tracker to log the generated section (optional if session tracking is needed)
124
- update_session_tracker(section_to_generate)
125
-
126
- # Call the corresponding section generation function
127
- if section_function_name:
128
  section_content = call_dynamic_function(section_function_name, data)
129
- return section_content
130
- else:
131
- return "Error: Section function not found."
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: