Harshal Vhatkar
commited on
Commit
·
abaedf3
1
Parent(s):
459b8b0
fix minor bugs
Browse files- session_page.py +13 -4
session_page.py
CHANGED
|
@@ -620,7 +620,7 @@ def upload_preclass_materials(session_id, course_id):
|
|
| 620 |
st.subheader("Pre-class Materials Management")
|
| 621 |
|
| 622 |
# Create tabs for different functionalities
|
| 623 |
-
upload_tab, external_tab
|
| 624 |
|
| 625 |
with upload_tab:
|
| 626 |
# Original file upload functionality
|
|
@@ -634,6 +634,15 @@ def upload_preclass_materials(session_id, course_id):
|
|
| 634 |
if st.button("Upload Material"):
|
| 635 |
upload_resource(course_id, session_id, file_name, uploaded_file, material_type)
|
| 636 |
st.success("Material uploaded successfully!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 637 |
|
| 638 |
with external_tab:
|
| 639 |
# Fetch and display external resources
|
|
@@ -1822,7 +1831,7 @@ def display_preclass_analytics2(session, course_id):
|
|
| 1822 |
# Initialize or get analytics data from session state
|
| 1823 |
if 'analytics_data' not in st.session_state:
|
| 1824 |
# Add debug prints
|
| 1825 |
-
analytics_data = get_preclass_analytics(session,
|
| 1826 |
if analytics_data is None:
|
| 1827 |
st.info("Fetching new analytics data...")
|
| 1828 |
if analytics_data is None:
|
|
@@ -2383,7 +2392,7 @@ def display_session_content(student_id, course_id, session, username, user_type)
|
|
| 2383 |
with tabs[0]:
|
| 2384 |
display_preclass_content(session, student_id, course_id)
|
| 2385 |
with tabs[1]:
|
| 2386 |
-
display_in_class_content(session, user_type)
|
| 2387 |
with tabs[2]:
|
| 2388 |
display_post_class_content(session, student_id, course_id)
|
| 2389 |
with tabs[3]:
|
|
@@ -2413,7 +2422,7 @@ def display_session_content(student_id, course_id, session, username, user_type)
|
|
| 2413 |
with tabs[0]:
|
| 2414 |
upload_preclass_materials(session['session_id'], course_id)
|
| 2415 |
with tabs[1]:
|
| 2416 |
-
display_in_class_content(session, user_type)
|
| 2417 |
with tabs[2]:
|
| 2418 |
display_post_class_content(session, student_id, course_id)
|
| 2419 |
with tabs[3]:
|
|
|
|
| 620 |
st.subheader("Pre-class Materials Management")
|
| 621 |
|
| 622 |
# Create tabs for different functionalities
|
| 623 |
+
upload_tab, videos_tab, external_tab= st.tabs(["Upload Materials","Upload Video Sources","External Resources"])
|
| 624 |
|
| 625 |
with upload_tab:
|
| 626 |
# Original file upload functionality
|
|
|
|
| 634 |
if st.button("Upload Material"):
|
| 635 |
upload_resource(course_id, session_id, file_name, uploaded_file, material_type)
|
| 636 |
st.success("Material uploaded successfully!")
|
| 637 |
+
with videos_tab:
|
| 638 |
+
# Upload video sources
|
| 639 |
+
st.info("Upload video sources for this session.")
|
| 640 |
+
video_url = st.text_input("Enter a Youtube Video URL")
|
| 641 |
+
if st.button("Upload Video"):
|
| 642 |
+
with st.spinner("Processing video source..."):
|
| 643 |
+
video_resource_id = upload_video_source(course_id, session_id, video_url)
|
| 644 |
+
if video_resource_id:
|
| 645 |
+
st.success("Video source uploaded successfully!")
|
| 646 |
|
| 647 |
with external_tab:
|
| 648 |
# Fetch and display external resources
|
|
|
|
| 1831 |
# Initialize or get analytics data from session state
|
| 1832 |
if 'analytics_data' not in st.session_state:
|
| 1833 |
# Add debug prints
|
| 1834 |
+
analytics_data = get_preclass_analytics(session, course_id)
|
| 1835 |
if analytics_data is None:
|
| 1836 |
st.info("Fetching new analytics data...")
|
| 1837 |
if analytics_data is None:
|
|
|
|
| 2392 |
with tabs[0]:
|
| 2393 |
display_preclass_content(session, student_id, course_id)
|
| 2394 |
with tabs[1]:
|
| 2395 |
+
display_in_class_content(session, user_type, course_id, user_type)
|
| 2396 |
with tabs[2]:
|
| 2397 |
display_post_class_content(session, student_id, course_id)
|
| 2398 |
with tabs[3]:
|
|
|
|
| 2422 |
with tabs[0]:
|
| 2423 |
upload_preclass_materials(session['session_id'], course_id)
|
| 2424 |
with tabs[1]:
|
| 2425 |
+
display_in_class_content(session, user_type, course_id, user_type)
|
| 2426 |
with tabs[2]:
|
| 2427 |
display_post_class_content(session, student_id, course_id)
|
| 2428 |
with tabs[3]:
|