@@ -335,15 +335,18 @@ defmodule DatabaseMigration do
335
335
336
336
amount = if reward , do: Money . from_integer ( String . to_integer ( reward [ "amount" ] ) , reward [ "currency" ] )
337
337
338
- % {
339
- "id" => row [ "id" ] ,
340
- "amount" => amount ,
341
- "ticket_id" => row [ "task_id" ] ,
342
- "owner_id" => row [ "org_id" ] ,
343
- "creator_id" => row [ "poster_id" ] ,
344
- "inserted_at" => row [ "created_at" ] ,
345
- "updated_at" => row [ "updated_at" ]
346
- }
338
+ if row [ "type" ] != "tip" do
339
+ % {
340
+ "id" => row [ "id" ] ,
341
+ "amount" => amount ,
342
+ "ticket_id" => row [ "task_id" ] ,
343
+ "owner_id" => row [ "org_id" ] ,
344
+ "creator_id" => row [ "poster_id" ] ,
345
+ "inserted_at" => row [ "created_at" ] ,
346
+ "updated_at" => row [ "updated_at" ] ,
347
+ "number" => row [ "number" ]
348
+ }
349
+ end
347
350
end
348
351
349
352
defp transform ( { "Bounty" , CommandResponse } , row , _db ) do
@@ -547,20 +550,23 @@ defmodule DatabaseMigration do
547
550
bounty_transfer: row ,
548
551
bounty: bounty ,
549
552
claim: claim ,
550
- user_id: org [ "id" ]
553
+ org: org ,
554
+ user_id: user_id
551
555
} ) ,
552
556
maybe_create_transaction ( "credit" , % {
553
557
bounty_charge: bounty_charge ,
554
558
bounty_transfer: row ,
555
559
bounty: bounty ,
556
560
claim: claim ,
561
+ org: org ,
557
562
user_id: user_id
558
563
} ) ,
559
564
maybe_create_transaction ( "transfer" , % {
560
565
bounty_charge: bounty_charge ,
561
566
bounty_transfer: row ,
562
567
bounty: bounty ,
563
568
claim: claim ,
569
+ org: org ,
564
570
user_id: user_id
565
571
} )
566
572
] ,
@@ -647,6 +653,7 @@ defmodule DatabaseMigration do
647
653
bounty_transfer: bounty_transfer ,
648
654
bounty: bounty ,
649
655
claim: claim ,
656
+ org: org ,
650
657
user_id: user_id
651
658
} ) do
652
659
amount = Money . from_integer ( String . to_integer ( bounty_transfer [ "amount" ] ) , bounty_transfer [ "currency" ] )
@@ -671,7 +678,7 @@ defmodule DatabaseMigration do
671
678
"succeeded_at" => nil ,
672
679
"reversed_at" => nil ,
673
680
"group_id" => bounty_charge [ "id" ] ,
674
- "user_id" => user_id ,
681
+ "user_id" => nil ,
675
682
"contract_id" => nil ,
676
683
"original_contract_id" => nil ,
677
684
"timesheet_id" => nil ,
@@ -695,13 +702,22 @@ defmodule DatabaseMigration do
695
702
res =
696
703
case type do
697
704
"transfer" ->
698
- Map . put ( res , "provider_id" , bounty_transfer [ "transfer_id" ] )
705
+ Map . merge ( res , % {
706
+ "user_id" => user_id ,
707
+ "provider_id" => bounty_transfer [ "transfer_id" ]
708
+ } )
699
709
700
710
"debit" ->
701
- Map . put ( res , "linked_transaction_id" , "cr_" <> bounty_transfer [ "id" ] )
711
+ Map . merge ( res , % {
712
+ "user_id" => org [ "id" ] ,
713
+ "linked_transaction_id" => "cr_" <> bounty_transfer [ "id" ]
714
+ } )
702
715
703
716
"credit" ->
704
- Map . put ( res , "linked_transaction_id" , "de_" <> bounty_transfer [ "id" ] )
717
+ Map . merge ( res , % {
718
+ "user_id" => user_id ,
719
+ "linked_transaction_id" => "de_" <> bounty_transfer [ "id" ]
720
+ } )
705
721
706
722
_ ->
707
723
res
0 commit comments