@@ -215,22 +215,22 @@ def calculate_clues():
215
215
"""Calculate all CLUes"""
216
216
calculations = BLSCHED .fetch_clue_calculations ()
217
217
while calculations :
218
- response_uuids = [ response ['response_uuid ' ]
218
+ trial_uuids = set ( response ['trial_uuid ' ]
219
219
for calculation in calculations
220
- for response in calculation ['responses' ]]
220
+ for response in calculation ['responses' ])
221
221
222
222
with transaction () as session :
223
223
# Skip calculations with unknown responses and responses that we can't lock immediately
224
224
responses = session .query (Response ).filter (
225
- Response .uuid .in_ (response_uuids )
225
+ Response .trial_uuid .in_ (trial_uuids )
226
226
).with_for_update (key_share = True , skip_locked = True ).all ()
227
- responses_by_uuid = {}
227
+ responses_by_trial_uuid = {}
228
228
for response in responses :
229
- responses_by_uuid [response .uuid ] = response
229
+ responses_by_trial_uuid [response .trial_uuid ] = response
230
230
231
231
calculations_by_ecosystem_uuid = defaultdict (list )
232
232
for calc in calculations :
233
- if all (resp ['response_uuid ' ] in responses_by_uuid for resp in calc ['responses' ]):
233
+ if all (resp ['trial_uuid ' ] in responses_by_trial_uuid for resp in calc ['responses' ]):
234
234
calculations_by_ecosystem_uuid [calc ['ecosystem_uuid' ]].append (calc )
235
235
236
236
ecosystem_matrices = session .query (EcosystemMatrix ).filter (
@@ -252,7 +252,7 @@ def calculate_clues():
252
252
for calculation in ecosystem_calculations
253
253
for student_uuid in calculation ['student_uuids' ]
254
254
],
255
- responses = [responses_by_uuid [response ['response_uuid ' ]]
255
+ responses = [responses_by_trial_uuid [response ['trial_uuid ' ]]
256
256
for calculation in ecosystem_calculations
257
257
for response in calculation ['responses' ]]
258
258
)
0 commit comments