@@ -21,38 +21,42 @@ defmodule AlgoraWeb.ClaimLive do
21
21
target: [ repository: [ :user ] , bounties: [ :owner ] ]
22
22
] )
23
23
24
- [ primary_claim | _ ] = claims
24
+ case claims do
25
+ [ ] ->
26
+ raise ( AlgoraWeb.NotFoundError )
25
27
26
- prize_pool =
27
- primary_claim . target . bounties
28
- |> Enum . map ( & & 1 . amount )
29
- |> Enum . reduce ( Money . zero ( :USD , no_fraction_if_integer: true ) , & Money . add! ( & 1 , & 2 ) )
28
+ [ primary_claim | _ ] ->
29
+ prize_pool =
30
+ primary_claim . target . bounties
31
+ |> Enum . map ( & & 1 . amount )
32
+ |> Enum . reduce ( Money . zero ( :USD , no_fraction_if_integer: true ) , & Money . add! ( & 1 , & 2 ) )
30
33
31
- total_paid =
32
- primary_claim . transactions
33
- |> Enum . filter ( & ( & 1 . type == :debit and & 1 . status == :succeeded ) )
34
- |> Enum . map ( & & 1 . net_amount )
35
- |> Enum . reduce ( Money . zero ( :USD , no_fraction_if_integer: true ) , & Money . add! ( & 1 , & 2 ) )
34
+ total_paid =
35
+ primary_claim . transactions
36
+ |> Enum . filter ( & ( & 1 . type == :debit and & 1 . status == :succeeded ) )
37
+ |> Enum . map ( & & 1 . net_amount )
38
+ |> Enum . reduce ( Money . zero ( :USD , no_fraction_if_integer: true ) , & Money . add! ( & 1 , & 2 ) )
36
39
37
- source_body_html =
38
- with token when is_binary ( token ) <- Github.TokenPool . get_token ( ) ,
39
- { :ok , source_body_html } <- Github . render_markdown ( token , primary_claim . source . description ) do
40
- source_body_html
41
- else
42
- _ -> primary_claim . source . description
43
- end
40
+ source_body_html =
41
+ with token when is_binary ( token ) <- Github.TokenPool . get_token ( ) ,
42
+ { :ok , source_body_html } <- Github . render_markdown ( token , primary_claim . source . description ) do
43
+ source_body_html
44
+ else
45
+ _ -> primary_claim . source . description
46
+ end
44
47
45
- { :ok ,
46
- socket
47
- |> assign ( :page_title , primary_claim . source . title )
48
- |> assign ( :claims , claims )
49
- |> assign ( :primary_claim , primary_claim )
50
- |> assign ( :target , primary_claim . target )
51
- |> assign ( :source , primary_claim . source )
52
- |> assign ( :bounties , primary_claim . target . bounties )
53
- |> assign ( :prize_pool , prize_pool )
54
- |> assign ( :total_paid , total_paid )
55
- |> assign ( :source_body_html , source_body_html ) }
48
+ { :ok ,
49
+ socket
50
+ |> assign ( :page_title , primary_claim . source . title )
51
+ |> assign ( :claims , claims )
52
+ |> assign ( :primary_claim , primary_claim )
53
+ |> assign ( :target , primary_claim . target )
54
+ |> assign ( :source , primary_claim . source )
55
+ |> assign ( :bounties , primary_claim . target . bounties )
56
+ |> assign ( :prize_pool , prize_pool )
57
+ |> assign ( :total_paid , total_paid )
58
+ |> assign ( :source_body_html , source_body_html ) }
59
+ end
56
60
end
57
61
58
62
@ impl true
0 commit comments