Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -79,11 +79,11 @@ def get_topics_within_timeframe(subject, allowed_time, start_subtopic):
|
|
| 79 |
continue
|
| 80 |
|
| 81 |
for subtopic in chapter["subtopics"]:
|
| 82 |
-
if
|
|
|
|
| 83 |
start_collecting = True
|
| 84 |
-
continue
|
| 85 |
|
| 86 |
-
if start_collecting and subtopic
|
| 87 |
time_spent += float(subtopic["subtopic_hours"])
|
| 88 |
if time_spent <= allowed_time:
|
| 89 |
collected_subtopics.append({
|
|
@@ -98,6 +98,7 @@ def get_topics_within_timeframe(subject, allowed_time, start_subtopic):
|
|
| 98 |
|
| 99 |
return collected_subtopics
|
| 100 |
|
|
|
|
| 101 |
@app.post("/generate_roadmap")
|
| 102 |
async def generate_roadmap(input_data: RoadmapInput):
|
| 103 |
try:
|
|
|
|
| 79 |
continue
|
| 80 |
|
| 81 |
for subtopic in chapter["subtopics"]:
|
| 82 |
+
# Start collecting immediately if start_subtopic is empty
|
| 83 |
+
if start_subtopic == "" or subtopic["subtopic"] == start_subtopic:
|
| 84 |
start_collecting = True
|
|
|
|
| 85 |
|
| 86 |
+
if start_collecting and subtopic.get("subtopic_hours"):
|
| 87 |
time_spent += float(subtopic["subtopic_hours"])
|
| 88 |
if time_spent <= allowed_time:
|
| 89 |
collected_subtopics.append({
|
|
|
|
| 98 |
|
| 99 |
return collected_subtopics
|
| 100 |
|
| 101 |
+
|
| 102 |
@app.post("/generate_roadmap")
|
| 103 |
async def generate_roadmap(input_data: RoadmapInput):
|
| 104 |
try:
|