Update app.py
Browse files
app.py
CHANGED
|
@@ -85,63 +85,63 @@ def fetch_personalized_data(session_index):
|
|
| 85 |
with conn.cursor() as cursor:
|
| 86 |
# Query to fetch relevant data from both tables based on session_index
|
| 87 |
query = """
|
| 88 |
-
SELECT
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
FROM
|
| 110 |
-
JOIN
|
| 111 |
-
|
| 112 |
-
WHERE
|
| 113 |
UNION ALL
|
| 114 |
-
SELECT
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
FROM
|
| 136 |
-
JOIN
|
| 137 |
-
ON
|
| 138 |
-
WHERE
|
| 139 |
SELECT DISTINCT groupNrStart
|
| 140 |
-
FROM
|
| 141 |
-
JOIN
|
| 142 |
-
ON
|
| 143 |
-
WHERE
|
| 144 |
-
) AND
|
| 145 |
"""
|
| 146 |
cursor.execute(query,(session_index, session_index, session_index))
|
| 147 |
# Fetch data row by row
|
|
|
|
| 85 |
with conn.cursor() as cursor:
|
| 86 |
# Query to fetch relevant data from both tables based on session_index
|
| 87 |
query = """
|
| 88 |
+
SELECT e5390g37504_core.playerNr,
|
| 89 |
+
e5390g37504_core.groupNrStart,
|
| 90 |
+
e5390g37504_core.subjectNr,
|
| 91 |
+
e5390g37504_core.onPage,
|
| 92 |
+
e5390g37504_decisions.session_index,
|
| 93 |
+
e5390g37504_decisions.transfer1,
|
| 94 |
+
e5390g37504_decisions.tripledAmount1,
|
| 95 |
+
e5390g37504_decisions.keptForSelf1,
|
| 96 |
+
e5390g37504_decisions.returned1,
|
| 97 |
+
e5390g37504_decisions.newCreditRound2,
|
| 98 |
+
e5390g37504_decisions.transfer2,
|
| 99 |
+
e5390g37504_decisions.tripledAmount2,
|
| 100 |
+
e5390g37504_decisions.keptForSelf2,
|
| 101 |
+
e5390g37504_decisions.returned2,
|
| 102 |
+
e5390g37504_decisions.results2rounds,
|
| 103 |
+
e5390g37504_decisions.newCreditRound3,
|
| 104 |
+
e5390g37504_decisions.transfer3,
|
| 105 |
+
e5390g37504_decisions.tripledAmount3,
|
| 106 |
+
e5390g37504_decisions.keptForSelf3,
|
| 107 |
+
e5390g37504_decisions.returned3,
|
| 108 |
+
e5390g37504_decisions.results3rounds
|
| 109 |
+
FROM e5390g37504_core
|
| 110 |
+
JOIN e5390g37504_decisions ON
|
| 111 |
+
e5390g37504_core.playerNr = e5390g37504_decisions.playerNr
|
| 112 |
+
WHERE e5390g37504_decisions.session_index = %s
|
| 113 |
UNION ALL
|
| 114 |
+
SELECT e5390g37504_core.playerNr,
|
| 115 |
+
e5390g37504_core.groupNrStart,
|
| 116 |
+
e5390g37504_core.subjectNr,
|
| 117 |
+
e5390g37504_core.onPage,
|
| 118 |
+
e5390g37504_decisions.session_index,
|
| 119 |
+
e5390g37504_decisions.transfer1,
|
| 120 |
+
e5390g37504_decisions.tripledAmount1,
|
| 121 |
+
e5390g37504_decisions.keptForSelf1,
|
| 122 |
+
e5390g37504_decisions.returned1,
|
| 123 |
+
e5390g37504_decisions.newCreditRound2,
|
| 124 |
+
e5390g37504_decisions.transfer2,
|
| 125 |
+
e5390g37504_decisions.tripledAmount2,
|
| 126 |
+
e5390g37504_decisions.keptForSelf2,
|
| 127 |
+
e5390g37504_decisions.returned2,
|
| 128 |
+
e5390g37504_decisions.results2rounds,
|
| 129 |
+
e5390g37504_decisions.newCreditRound3,
|
| 130 |
+
e5390g37504_decisions.transfer3,
|
| 131 |
+
e5390g37504_decisions.tripledAmount3,
|
| 132 |
+
e5390g37504_decisions.keptForSelf3,
|
| 133 |
+
e5390g37504_decisions.returned3,
|
| 134 |
+
e5390g37504_decisions.results3rounds
|
| 135 |
+
FROM e5390g37504_core
|
| 136 |
+
JOIN e5390g37504_decisions
|
| 137 |
+
ON e5390g37504_core.playerNr = e5390g37504_decisions.playerNr
|
| 138 |
+
WHERE e5390g37504_core.groupNrStart IN (
|
| 139 |
SELECT DISTINCT groupNrStart
|
| 140 |
+
FROM e5390g37504_core
|
| 141 |
+
JOIN e5390g37504_decisions
|
| 142 |
+
ON e5390g37504_core.playerNr = e5390g37504_decisions.playerNr
|
| 143 |
+
WHERE e5390g37504_decisions.session_index = %s
|
| 144 |
+
) AND e5390g37504_decisions.session_index != %s
|
| 145 |
"""
|
| 146 |
cursor.execute(query,(session_index, session_index, session_index))
|
| 147 |
# Fetch data row by row
|