Skip to content

Commit

Permalink
Update logic to get running status
Browse files Browse the repository at this point in the history
See also: #7
  • Loading branch information
BECATRUE committed Nov 21, 2024
1 parent cfec780 commit e5188a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wlm_server/operation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def get_running_status(ch: int) -> tuple[bool, bool]:
latest_operations = (
Operation.objects.order_by('channel', 'user', '-occured_at').distinct('channel', 'user')
) # latest operations for each channel and user
on_operations = latest_operations.filter(on=True)
is_wlm_running = on_operations.exists()
is_channel_running = on_operations.filter(channel__channel=ch).exists()
is_wlm_running = any(op.on for op in latest_operations)
is_channel_running = any(op.channel.channel == ch and op.on for op in latest_operations)
print(is_wlm_running, is_channel_running)
return is_wlm_running, is_channel_running


Expand Down

0 comments on commit e5188a1

Please sign in to comment.