@@ -51,7 +51,8 @@ defmodule Algora.Bounties do
5151          amount:  Money . t ( ) , 
5252          ticket:  Ticket . t ( ) , 
5353          visibility:  Bounty . visibility ( ) , 
54-           shared_with:  [ String . t ( ) ] 
54+           shared_with:  [ String . t ( ) ] , 
55+           hours_per_week:  integer ( )  |  nil 
5556        } )  :: 
5657          { :ok ,  Bounty . t ( ) }  |  { :error ,  atom ( ) } 
5758  defp  do_create_bounty ( % { creator:  creator ,  owner:  owner ,  amount:  amount ,  ticket:  ticket }  =  params )  do 
@@ -62,7 +63,8 @@ defmodule Algora.Bounties do
6263        owner_id:  owner . id , 
6364        creator_id:  creator . id , 
6465        visibility:  params [ :visibility ]  ||  owner . bounty_mode , 
65-         shared_with:  params [ :shared_with ]  ||  [ ] 
66+         shared_with:  params [ :shared_with ]  ||  [ ] , 
67+         hours_per_week:  params [ :hours_per_week ] 
6668      } ) 
6769
6870    changeset 
@@ -109,7 +111,8 @@ defmodule Algora.Bounties do
109111            command_id:  integer ( ) , 
110112            command_source:  :ticket  |  :comment , 
111113            visibility:  Bounty . visibility ( )  |  nil , 
112-             shared_with:  [ String . t ( ) ]  |  nil 
114+             shared_with:  [ String . t ( ) ]  |  nil , 
115+             hours_per_week:  integer ( )  |  nil 
113116          ] 
114117        )  :: 
115118          { :ok ,  Bounty . t ( ) }  |  { :error ,  atom ( ) } 
@@ -140,7 +143,8 @@ defmodule Algora.Bounties do
140143                    amount:  amount , 
141144                    ticket:  ticket , 
142145                    visibility:  opts [ :visibility ] , 
143-                     shared_with:  shared_with 
146+                     shared_with:  shared_with , 
147+                     hours_per_week:  opts [ :hours_per_week ] 
144148                  } ) 
145149
146150                :set  -> 
@@ -190,7 +194,8 @@ defmodule Algora.Bounties do
190194          opts  ::  [ 
191195            strategy:  strategy ( ) , 
192196            visibility:  Bounty . visibility ( )  |  nil , 
193-             shared_with:  [ String . t ( ) ]  |  nil 
197+             shared_with:  [ String . t ( ) ]  |  nil , 
198+             hours_per_week:  integer ( )  |  nil 
194199          ] 
195200        )  :: 
196201          { :ok ,  Bounty . t ( ) }  |  { :error ,  atom ( ) } 
@@ -209,7 +214,8 @@ defmodule Algora.Bounties do
209214               amount:  amount , 
210215               ticket:  ticket , 
211216               visibility:  opts [ :visibility ] , 
212-                shared_with:  shared_with 
217+                shared_with:  shared_with , 
218+                hours_per_week:  opts [ :hours_per_week ] 
213219             } ) , 
214220           { :ok ,  _job }  <-  notify_bounty ( % { owner:  owner ,  bounty:  bounty } )  do 
215221        broadcast ( ) 
@@ -862,6 +868,7 @@ defmodule Algora.Bounties do
862868             initialize_charge ( % { 
863869               id:  Nanoid . generate ( ) , 
864870               user_id:  owner . id , 
871+                bounty_id:  opts [ :bounty_id ] , 
865872               gross_amount:  gross_amount , 
866873               net_amount:  amount , 
867874               total_fee:  Money . sub! ( gross_amount ,  amount ) , 
@@ -961,23 +968,26 @@ defmodule Algora.Bounties do
961968    end ) 
962969  end 
963970
964-   defp  initialize_charge ( % { 
965-          id:  id , 
966-          user_id:  user_id , 
967-          gross_amount:  gross_amount , 
968-          net_amount:  net_amount , 
969-          total_fee:  total_fee , 
970-          line_items:  line_items , 
971-          group_id:  group_id , 
972-          idempotency_key:  idempotency_key 
973-        } )  do 
971+   defp  initialize_charge ( 
972+          % { 
973+            id:  id , 
974+            user_id:  user_id , 
975+            gross_amount:  gross_amount , 
976+            net_amount:  net_amount , 
977+            total_fee:  total_fee , 
978+            line_items:  line_items , 
979+            group_id:  group_id , 
980+            idempotency_key:  idempotency_key 
981+          }  =  params 
982+        )  do 
974983    % Transaction { } 
975984    |>  change ( % { 
976985      id:  id , 
977986      provider:  "stripe" , 
978987      type:  :charge , 
979988      status:  :initialized , 
980989      user_id:  user_id , 
990+       bounty_id:  params [ :bounty_id ] , 
981991      gross_amount:  gross_amount , 
982992      net_amount:  net_amount , 
983993      total_fee:  total_fee , 
0 commit comments