Skip to content

Commit 544d1a3

Browse files
Update the current processing gain if one exists (#675)
Update both the Session and SessionProcessingParameters gain references after a new one is uploaded. When first done, the SessionProcessingParameters entry will not exist so this must be checked before trying to update.
1 parent c6c286e commit 544d1a3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/murfey/server/api/session_info.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
ProcessingJob,
4444
RsyncInstance,
4545
Session,
46+
SessionProcessingParameters,
4647
SPAFeedbackParameters,
4748
SPARelionParameters,
4849
Tilt,
@@ -257,6 +258,16 @@ def update_current_gain_ref(
257258
session = db.exec(select(Session).where(Session.id == session_id)).one()
258259
session.current_gain_ref = new_gain_ref.path
259260
db.add(session)
261+
262+
session_processing_parameters = db.exec(
263+
select(SessionProcessingParameters).where(
264+
SessionProcessingParameters.session_id == session_id
265+
)
266+
).all()
267+
if session_processing_parameters:
268+
session_processing_parameters[0].gain_ref = new_gain_ref.path
269+
db.add(session_processing_parameters[0])
270+
260271
db.commit()
261272

262273

0 commit comments

Comments
 (0)