Spaces:
Sleeping
Sleeping
aether-raider
commited on
Commit
·
464a4c8
1
Parent(s):
88cf03e
fixing db issues
Browse files
frontend/utils/__pycache__/js_collectors.cpython-311.pyc
CHANGED
|
Binary files a/frontend/utils/__pycache__/js_collectors.cpython-311.pyc and b/frontend/utils/__pycache__/js_collectors.cpython-311.pyc differ
|
|
|
frontend/utils/js_collectors.py
CHANGED
|
@@ -84,7 +84,17 @@ COLLECT_AB_DATA_JS = """
|
|
| 84 |
checkboxes.forEach(checkbox => {
|
| 85 |
const compId = checkbox.getAttribute('data-comparison-id');
|
| 86 |
const dimension = checkbox.getAttribute('data-dimension');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
if (!ratings[compId]) ratings[compId] = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
ratings[compId][dimension] = checkbox.checked;
|
| 89 |
console.log('[DEBUG] Checkbox:', compId, dimension, checkbox.checked);
|
| 90 |
});
|
|
@@ -92,7 +102,17 @@ COLLECT_AB_DATA_JS = """
|
|
| 92 |
textareas.forEach(textarea => {
|
| 93 |
const compId = textarea.getAttribute('data-comparison-id');
|
| 94 |
const dimension = textarea.getAttribute('data-dimension');
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
if (!ratings[compId]) ratings[compId] = {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
ratings[compId][dimension] = textarea.value;
|
| 97 |
console.log('[DEBUG] Textarea:', compId, dimension, textarea.value);
|
| 98 |
});
|
|
|
|
| 84 |
checkboxes.forEach(checkbox => {
|
| 85 |
const compId = checkbox.getAttribute('data-comparison-id');
|
| 86 |
const dimension = checkbox.getAttribute('data-dimension');
|
| 87 |
+
const clipAId = checkbox.getAttribute('data-clip-a-id');
|
| 88 |
+
const clipBId = checkbox.getAttribute('data-clip-b-id');
|
| 89 |
+
const compType = checkbox.getAttribute('data-type');
|
| 90 |
+
|
| 91 |
if (!ratings[compId]) ratings[compId] = {};
|
| 92 |
+
|
| 93 |
+
// Set the metadata if not already set (from a radio button)
|
| 94 |
+
if (clipAId && !ratings[compId].clip_a_id) ratings[compId].clip_a_id = clipAId;
|
| 95 |
+
if (clipBId && !ratings[compId].clip_b_id) ratings[compId].clip_b_id = clipBId;
|
| 96 |
+
if (compType && !ratings[compId].comparison_type) ratings[compId].comparison_type = compType;
|
| 97 |
+
|
| 98 |
ratings[compId][dimension] = checkbox.checked;
|
| 99 |
console.log('[DEBUG] Checkbox:', compId, dimension, checkbox.checked);
|
| 100 |
});
|
|
|
|
| 102 |
textareas.forEach(textarea => {
|
| 103 |
const compId = textarea.getAttribute('data-comparison-id');
|
| 104 |
const dimension = textarea.getAttribute('data-dimension');
|
| 105 |
+
const clipAId = textarea.getAttribute('data-clip-a-id');
|
| 106 |
+
const clipBId = textarea.getAttribute('data-clip-b-id');
|
| 107 |
+
const compType = textarea.getAttribute('data-type');
|
| 108 |
+
|
| 109 |
if (!ratings[compId]) ratings[compId] = {};
|
| 110 |
+
|
| 111 |
+
// Set the metadata if not already set (from a radio button)
|
| 112 |
+
if (clipAId && !ratings[compId].clip_a_id) ratings[compId].clip_a_id = clipAId;
|
| 113 |
+
if (clipBId && !ratings[compId].clip_b_id) ratings[compId].clip_b_id = clipBId;
|
| 114 |
+
if (compType && !ratings[compId].comparison_type) ratings[compId].comparison_type = compType;
|
| 115 |
+
|
| 116 |
ratings[compId][dimension] = textarea.value;
|
| 117 |
console.log('[DEBUG] Textarea:', compId, dimension, textarea.value);
|
| 118 |
});
|