@@ -244,10 +244,6 @@ defmodule DatabaseMigration do
244
244
end
245
245
246
246
defp transform ( { "GithubUser" , User } , row , _db ) do
247
- if row [ "type" ] != "User" do
248
- Logger . warning ( "GithubUser is not a User: #{ inspect ( row [ "login" ] ) } " )
249
- end
250
-
251
247
if nullish? ( row [ "user_id" ] ) do
252
248
% {
253
249
"id" => row [ "id" ] ,
@@ -335,15 +331,18 @@ defmodule DatabaseMigration do
335
331
336
332
amount = if reward , do: Money . from_integer ( String . to_integer ( reward [ "amount" ] ) , reward [ "currency" ] )
337
333
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
- }
334
+ if row [ "type" ] != "tip" do
335
+ % {
336
+ "id" => row [ "id" ] ,
337
+ "amount" => amount ,
338
+ "ticket_id" => row [ "task_id" ] ,
339
+ "owner_id" => row [ "org_id" ] ,
340
+ "creator_id" => row [ "poster_id" ] ,
341
+ "inserted_at" => row [ "created_at" ] ,
342
+ "updated_at" => row [ "updated_at" ] ,
343
+ "number" => row [ "number" ]
344
+ }
345
+ end
347
346
end
348
347
349
348
defp transform ( { "Bounty" , CommandResponse } , row , _db ) do
@@ -547,20 +546,23 @@ defmodule DatabaseMigration do
547
546
bounty_transfer: row ,
548
547
bounty: bounty ,
549
548
claim: claim ,
550
- user_id: org [ "id" ]
549
+ org: org ,
550
+ user_id: user_id
551
551
} ) ,
552
552
maybe_create_transaction ( "credit" , % {
553
553
bounty_charge: bounty_charge ,
554
554
bounty_transfer: row ,
555
555
bounty: bounty ,
556
556
claim: claim ,
557
+ org: org ,
557
558
user_id: user_id
558
559
} ) ,
559
560
maybe_create_transaction ( "transfer" , % {
560
561
bounty_charge: bounty_charge ,
561
562
bounty_transfer: row ,
562
563
bounty: bounty ,
563
564
claim: claim ,
565
+ org: org ,
564
566
user_id: user_id
565
567
} )
566
568
] ,
@@ -647,6 +649,7 @@ defmodule DatabaseMigration do
647
649
bounty_transfer: bounty_transfer ,
648
650
bounty: bounty ,
649
651
claim: claim ,
652
+ org: org ,
650
653
user_id: user_id
651
654
} ) do
652
655
amount = Money . from_integer ( String . to_integer ( bounty_transfer [ "amount" ] ) , bounty_transfer [ "currency" ] )
@@ -671,7 +674,7 @@ defmodule DatabaseMigration do
671
674
"succeeded_at" => nil ,
672
675
"reversed_at" => nil ,
673
676
"group_id" => bounty_charge [ "id" ] ,
674
- "user_id" => user_id ,
677
+ "user_id" => nil ,
675
678
"contract_id" => nil ,
676
679
"original_contract_id" => nil ,
677
680
"timesheet_id" => nil ,
@@ -695,13 +698,22 @@ defmodule DatabaseMigration do
695
698
res =
696
699
case type do
697
700
"transfer" ->
698
- Map . put ( res , "provider_id" , bounty_transfer [ "transfer_id" ] )
701
+ Map . merge ( res , % {
702
+ "user_id" => user_id ,
703
+ "provider_id" => bounty_transfer [ "transfer_id" ]
704
+ } )
699
705
700
706
"debit" ->
701
- Map . put ( res , "linked_transaction_id" , "cr_" <> bounty_transfer [ "id" ] )
707
+ Map . merge ( res , % {
708
+ "user_id" => org [ "id" ] ,
709
+ "linked_transaction_id" => "cr_" <> bounty_transfer [ "id" ]
710
+ } )
702
711
703
712
"credit" ->
704
- Map . put ( res , "linked_transaction_id" , "de_" <> bounty_transfer [ "id" ] )
713
+ Map . merge ( res , % {
714
+ "user_id" => user_id ,
715
+ "linked_transaction_id" => "de_" <> bounty_transfer [ "id" ]
716
+ } )
705
717
706
718
_ ->
707
719
res
0 commit comments