File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -791,11 +791,12 @@ defmodule Algora.Bounties do
791791 rewarded_bounties_query = distinct ( rewards_query , :bounty_id )
792792 rewarded_tips_query = distinct ( rewards_query , :tip_id )
793793 rewarded_contracts_query = distinct ( rewards_query , :contract_id )
794- rewarded_users_query = distinct ( rewards_query , :user_id )
794+ rewarded_users_query = rewards_query |> distinct ( true ) |> select ( [ :user_id ] )
795795
796- # TODO: this is not correct, we need to get the users who have received rewards only in the last month
797796 rewarded_users_last_month_query =
798- where ( rewarded_users_query , [ t ] , t . succeeded_at >= fragment ( "NOW() - INTERVAL '1 month'" ) )
797+ from t in rewarded_users_query ,
798+ where: t . succeeded_at >= fragment ( "NOW() - INTERVAL '1 month'" ) ,
799+ except_all: ^ from ( t in rewarded_users_query , where: t . succeeded_at < fragment ( "NOW() - INTERVAL '1 month'" ) )
799800
800801 members_query = Member . filter_by_org_id ( Member , org_id )
801802 open_bounties = Repo . aggregate ( open_bounties_query , :count , :id )
You can’t perform that action at this time.
0 commit comments