This repository was archived by the owner on May 4, 2021. It is now read-only.
File tree 3 files changed +11
-4
lines changed
3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1
1
from logging import getLogger
2
- from json import dumps
3
2
from requests import Session
4
3
5
4
from .. import __version__
Original file line number Diff line number Diff line change @@ -148,16 +148,19 @@ def calculate_exercises():
148
148
)
149
149
150
150
response_dicts_by_calculation_uuid = defaultdict (list )
151
+ # Beware that uuid columns return UUID objects (not strings) when using from_statement()
151
152
for result in session .query ('calculation_uuid' , Response ).from_statement (text (dedent ("""
152
153
SELECT "values"."calculation_uuid", "responses".*
153
154
FROM "responses" INNER JOIN (VALUES {}) AS "values"
154
155
("calculation_uuid", "ecosystem_uuid", "student_uuid")
155
156
ON "responses"."student_uuid" = "values"."student_uuid"
156
157
AND "responses"."ecosystem_uuid" = "values"."ecosystem_uuid"
157
158
""" .format (', ' .join (calculation_values ))).strip ())).all ():
158
- calc_uuid = result .calculation_uuid
159
+ calc_uuid = str ( result .calculation_uuid )
159
160
response = result .Response
160
- if response .exercise_uuid in known_exercise_uuids_by_calculation_uuid [calc_uuid ]:
161
+ if str (
162
+ response .exercise_uuid
163
+ ) in known_exercise_uuids_by_calculation_uuid [calc_uuid ]:
161
164
response_dicts_by_calculation_uuid [calc_uuid ].append (response .dict_for_algs )
162
165
163
166
exercise_calculation_requests = []
Original file line number Diff line number Diff line change 10
10
11
11
12
12
def test_calculate_ecosystem_matrices (transaction ):
13
- ecosystem_1 = Ecosystem (uuid = str (uuid4 ()), metadata_sequence_number = 0 , sequence_number = 1 )
13
+ ecosystem_1 = Ecosystem (
14
+ uuid = str (uuid4 ()),
15
+ metadata_sequence_number = 0 ,
16
+ sequence_number = 1 ,
17
+ last_ecosystem_matrix_update_calculation_uuid = str (uuid4 ())
18
+ )
14
19
15
20
calculation_uuid = str (uuid4 ())
16
21
ecosystem_matrix_updates = [{
You can’t perform that action at this time.
0 commit comments