File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -78,15 +78,18 @@ defmodule Algora.Jobs do
7878 |> Repo . insert ( )
7979 end
8080
81- defp maybe_filter_by_user ( query , user_id: user_id , handles: handles ) when is_nil ( user_id ) and is_nil ( handles ) do
82- where ( query , [ j , u ] , j . status in [ :active ] )
83- end
81+ defp maybe_filter_by_user ( query , opts ) do
82+ cond do
83+ opts [ :user_id ] ->
84+ where ( query , [ j ] , j . user_id == ^ opts [ :user_id ] and j . status in [ :active , :processing ] )
8485
85- defp maybe_filter_by_user ( query , user_id: user_id ) do
86- where ( query , [ j ] , j . user_id == ^ user_id and j . status in [ :active , :processing ] )
87- end
86+ is_nil ( opts [ :user_id ] ) and is_nil ( opts [ :handles ] ) and is_nil ( opts [ :handle ] ) ->
87+ where ( query , [ j , u ] , j . status in [ :active ] )
8888
89- defp maybe_filter_by_user ( query , _ ) , do: query
89+ true ->
90+ query
91+ end
92+ end
9093
9194 defp maybe_filter_by_handle ( query , nil ) , do: query
9295
You can’t perform that action at this time.
0 commit comments