Spaces:
Sleeping
Sleeping
aether-raider commited on
Commit ·
88cf03e
1
Parent(s): 02c7c7b
fix: database issues
Browse files
backend/__pycache__/session_manager.cpython-311.pyc
CHANGED
|
Binary files a/backend/__pycache__/session_manager.cpython-311.pyc and b/backend/__pycache__/session_manager.cpython-311.pyc differ
|
|
|
backend/session_manager.py
CHANGED
|
@@ -298,9 +298,12 @@ class SessionManager:
|
|
| 298 |
print(f"[DEBUG] Already have {len(existing_pairs)} AB comparisons saved for this session")
|
| 299 |
|
| 300 |
# Determine which pairs we're processing based on comparison_type in the data
|
| 301 |
-
#
|
| 302 |
-
|
| 303 |
-
|
|
|
|
|
|
|
|
|
|
| 304 |
|
| 305 |
# Get the appropriate pairs from session
|
| 306 |
if comparison_type == "model_vs_model":
|
|
@@ -310,7 +313,7 @@ class SessionManager:
|
|
| 310 |
presented_pairs = session.get("ab_gender_pairs", [])
|
| 311 |
print(f"[DEBUG] Processing gender-vs-gender pairs: {len(presented_pairs)} pairs presented")
|
| 312 |
else:
|
| 313 |
-
print(f"[WARN]
|
| 314 |
presented_pairs = []
|
| 315 |
|
| 316 |
# Process all presented pairs
|
|
@@ -323,9 +326,13 @@ class SessionManager:
|
|
| 323 |
print(f"[DEBUG] Skipping duplicate comparison: {clip_a_id} vs {clip_b_id}")
|
| 324 |
continue
|
| 325 |
|
| 326 |
-
#
|
| 327 |
-
|
| 328 |
-
comparison =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
|
| 330 |
ab_response = {
|
| 331 |
"session_id": session_id,
|
|
@@ -484,4 +491,4 @@ class SessionManager:
|
|
| 484 |
for r in self.responses.get("feedback", [])
|
| 485 |
if r.get("session_id") == session_id
|
| 486 |
],
|
| 487 |
-
}
|
|
|
|
| 298 |
print(f"[DEBUG] Already have {len(existing_pairs)} AB comparisons saved for this session")
|
| 299 |
|
| 300 |
# Determine which pairs we're processing based on comparison_type in the data
|
| 301 |
+
# Find the first comparison that has a comparison_type (skip incomplete ones)
|
| 302 |
+
comparison_type = None
|
| 303 |
+
for comp_data in comparisons_data.values():
|
| 304 |
+
if comp_data.get("comparison_type"):
|
| 305 |
+
comparison_type = comp_data["comparison_type"]
|
| 306 |
+
break
|
| 307 |
|
| 308 |
# Get the appropriate pairs from session
|
| 309 |
if comparison_type == "model_vs_model":
|
|
|
|
| 313 |
presented_pairs = session.get("ab_gender_pairs", [])
|
| 314 |
print(f"[DEBUG] Processing gender-vs-gender pairs: {len(presented_pairs)} pairs presented")
|
| 315 |
else:
|
| 316 |
+
print(f"[WARN] Could not determine comparison type from data (found: {comparison_type})")
|
| 317 |
presented_pairs = []
|
| 318 |
|
| 319 |
# Process all presented pairs
|
|
|
|
| 326 |
print(f"[DEBUG] Skipping duplicate comparison: {clip_a_id} vs {clip_b_id}")
|
| 327 |
continue
|
| 328 |
|
| 329 |
+
# Find user's rating for this pair from the submitted data
|
| 330 |
+
# JS sends numeric keys ("1", "2", etc.), so search by clip IDs
|
| 331 |
+
comparison = {}
|
| 332 |
+
for comp_data in comparisons_data.values():
|
| 333 |
+
if comp_data.get("clip_a_id") == clip_a_id and comp_data.get("clip_b_id") == clip_b_id:
|
| 334 |
+
comparison = comp_data
|
| 335 |
+
break
|
| 336 |
|
| 337 |
ab_response = {
|
| 338 |
"session_id": session_id,
|
|
|
|
| 491 |
for r in self.responses.get("feedback", [])
|
| 492 |
if r.get("session_id") == session_id
|
| 493 |
],
|
| 494 |
+
}
|