Skip to content

Commit

Permalink
#834 Clicking on a leaderboard results in Internal Server Error 500
Browse files Browse the repository at this point in the history
  • Loading branch information
mellelieuwes committed Jun 7, 2024
1 parent 75fc5c5 commit 8caa8b8
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 118 deletions.
3 changes: 1 addition & 2 deletions core/systems/advert/content_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ defmodule Systems.Advert.ContentPage do
~H"""
<.management_page
title={@vm.title}
show_errors={@vm.show_errors}
tabs={@vm.tabs}
show_errors={@vm.show_errors}
menus={@menus}
modal={@modal}
popup={@popup}
dialog={@dialog}
tabbar_id={@tabbar_id}
initial_tab={@initial_tab}
tabbar_size={@tabbar_size}
Expand Down
6 changes: 3 additions & 3 deletions core/systems/alliance/content_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ defmodule Systems.Alliance.ContentPage do
~H"""
<.management_page
title={@vm.title}
tabs={@vm.tabs}
show_errors={@vm.show_errors}
menus={@menus}
modal={@modal}
popup={@popup}
dialog={@dialog}
tabs={@vm.tabs}
tabbar_id={@tabbar_id}
initial_tab={@initial_tab}
tabbar_size={@tabbar_size}
show_errors={@show_errors}
actions={@vm.actions}
actions={@actions}
/>
"""
end
Expand Down
2 changes: 1 addition & 1 deletion core/systems/assignment/content_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ defmodule Systems.Assignment.ContentPage do
~H"""
<.management_page
title={@vm.title}
show_errors={@vm.show_errors}
tabs={@vm.tabs}
show_errors={@vm.show_errors}
actions={@actions}
tabbar_id={@tabbar_id}
initial_tab={@initial_tab}
Expand Down
12 changes: 6 additions & 6 deletions core/systems/document/content_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ defmodule Systems.Document.ContentPage do
~H"""
<.management_page
title={@vm.title}
menus={@menus}
modal={@modal}
popup={@popup}
dialog={@dialog}
tabs={@vm.tabs}
show_errors={@vm.show_errors}
actions={@actions}
tabbar_id={@tabbar_id}
initial_tab={@initial_tab}
tabbar_size={@tabbar_size}
show_errors={@show_errors}
actions={@vm.actions}
menus={@menus}
modal={@modal}
popup={@popup}
dialog={@dialog}
/>
"""
end
Expand Down
12 changes: 6 additions & 6 deletions core/systems/feldspar/content_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ defmodule Systems.Feldspar.ContentPage do
~H"""
<.management_page
title={@vm.title}
menus={@menus}
modal={@modal}
popup={@popup}
dialog={@dialog}
tabs={@vm.tabs}
show_errors={@vm.show_errors}
actions={@actions}
tabbar_id={@tabbar_id}
initial_tab={@initial_tab}
tabbar_size={@tabbar_size}
show_errors={@show_errors}
actions={@vm.actions}
menus={@menus}
modal={@modal}
popup={@popup}
dialog={@dialog}
/>
"""
end
Expand Down
12 changes: 6 additions & 6 deletions core/systems/graphite/leaderboard_content_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ defmodule Systems.Graphite.LeaderboardContentPage do
~H"""
<.management_page
title={@vm.title}
menus={@menus}
modal={@modal}
popup={@popup}
dialog={@dialog}
tabs={@vm.tabs}
show_errors={@vm.show_errors}
actions={@actions}
tabbar_id={@tabbar_id}
initial_tab={@initial_tab}
tabbar_size={@tabbar_size}
show_errors={@show_errors}
actions={@vm.actions}
menus={@menus}
modal={@modal}
popup={@popup}
dialog={@dialog}
/>
"""
end
Expand Down
37 changes: 13 additions & 24 deletions core/systems/graphite/leaderboard_content_page_builder.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ defmodule Systems.Graphite.LeaderboardContentPageBuilder do

tabs = create_tabs(leaderboard, false, assigns)

title =
if title do
title
else
""
end

%{
id: id,
title: title,
Expand Down Expand Up @@ -133,16 +140,10 @@ defmodule Systems.Graphite.LeaderboardContentPageBuilder do
[:settings, :submissions, :scores]
end

defp create_tab(:settings, leaderboard, show_errors, assigns) do
%{fabric: fabric, uri_origin: uri_origin, viewport: viewport, breakpoint: breakpoint} =
assigns

defp create_tab(:settings, leaderboard, show_errors, %{fabric: fabric}) do
child =
Fabric.prepare_child(fabric, :settings_form, Graphite.LeaderboardSettingsView, %{
entity: leaderboard,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
entity: leaderboard
})

%{
Expand All @@ -156,17 +157,11 @@ defmodule Systems.Graphite.LeaderboardContentPageBuilder do
}
end

defp create_tab(:submissions, leaderboard, show_errors, assigns) do
%{fabric: fabric, uri_origin: uri_origin, viewport: viewport, breakpoint: breakpoint} =
assigns

defp create_tab(:submissions, leaderboard, show_errors, %{fabric: fabric}) do
child =
Fabric.prepare_child(fabric, :submissions_form, Graphite.LeaderboardSubmissionsView, %{
entity: leaderboard,
submissions: Graphite.Public.list_submissions(leaderboard),
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
submissions: Graphite.Public.list_submissions(leaderboard)
})

%{
Expand All @@ -180,16 +175,10 @@ defmodule Systems.Graphite.LeaderboardContentPageBuilder do
}
end

defp create_tab(:scores, leaderboard, show_errors, assigns) do
%{fabric: fabric, uri_origin: uri_origin, viewport: viewport, breakpoint: breakpoint} =
assigns

defp create_tab(:scores, leaderboard, show_errors, %{fabric: fabric}) do
child =
Fabric.prepare_child(fabric, :scores_form, Graphite.LeaderboardScoresView, %{
entity: leaderboard,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
entity: leaderboard
})

%{
Expand Down
8 changes: 1 addition & 7 deletions core/systems/graphite/leaderboard_scores_form.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ defmodule Systems.Graphite.LeaderboardScoresForm do
def update(
%{
id: id,
leaderboard: leaderboard,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
leaderboard: leaderboard
},
socket
) do
Expand All @@ -28,9 +25,6 @@ defmodule Systems.Graphite.LeaderboardScoresForm do
id: id,
headers: headers,
leaderboard: leaderboard,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint,
placeholder: dgettext("eyra-graphite", "label.upload_file"),
select_button: dgettext("eyra-graphite", "label.select"),
replace_button: dgettext("eyra-graphite", "label.replace_file"),
Expand Down
18 changes: 3 additions & 15 deletions core/systems/graphite/leaderboard_scores_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ defmodule Systems.Graphite.LeaderboardScoresView do
def update(
%{
id: id,
entity: leaderboard,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
entity: leaderboard
},
socket
) do
Expand All @@ -21,29 +18,20 @@ defmodule Systems.Graphite.LeaderboardScoresView do
socket
|> assign(
id: id,
leaderboard: leaderboard,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
leaderboard: leaderboard
)
|> compose_child(:upload)
}
end

@impl true
def compose(:upload, %{
leaderboard: leaderboard,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
leaderboard: leaderboard
}) do
%{
module: Graphite.LeaderboardScoresForm,
params: %{
leaderboard: leaderboard,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint,
page_key: :upload,
opt_in?: false,
on_text: "upload view on text",
Expand Down
17 changes: 3 additions & 14 deletions core/systems/graphite/leaderboard_settings_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ defmodule Systems.Graphite.LeaderboardSettingsView do
def update(
%{
id: id,
entity: leaderboard,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
entity: leaderboard
},
socket
) do
Expand All @@ -21,10 +18,7 @@ defmodule Systems.Graphite.LeaderboardSettingsView do
socket
|> assign(
id: id,
entity: leaderboard,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
entity: leaderboard
)
|> compose_child(:settings)
}
Expand All @@ -49,12 +43,7 @@ defmodule Systems.Graphite.LeaderboardSettingsView do
~H"""
<div>
<Area.content>
<.child name={:settings} fabric={@fabric} >
<:header>
</:header>
<:footer>
</:footer>
</.child>
<.child name={:settings} fabric={@fabric} />
</Area.content>
</div>
"""
Expand Down
10 changes: 2 additions & 8 deletions core/systems/graphite/leaderboard_submissions_form.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ defmodule Systems.Graphite.LeaderboardSubmissionsForm do
%{
id: id,
leaderboard: leaderboard,
submissions: submissions,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
submissions: submissions
},
socket
) do
Expand All @@ -21,10 +18,7 @@ defmodule Systems.Graphite.LeaderboardSubmissionsForm do
|> assign(
id: id,
leaderboard: leaderboard,
submissions: submissions,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
submissions: submissions
)
|> prepare_download_button()
}
Expand Down
16 changes: 2 additions & 14 deletions core/systems/graphite/leaderboard_submissions_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ defmodule Systems.Graphite.LeaderboardSubmissionsView do
%{
id: id,
entity: leaderboard,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint,
submissions: submissions
},
socket
Expand All @@ -21,10 +18,7 @@ defmodule Systems.Graphite.LeaderboardSubmissionsView do
|> assign(
id: id,
leaderboard: leaderboard,
submissions: submissions,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
submissions: submissions
)
|> compose_child(:download)
}
Expand All @@ -33,19 +27,13 @@ defmodule Systems.Graphite.LeaderboardSubmissionsView do
@impl true
def compose(:download, %{
leaderboard: leaderboard,
submissions: submissions,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint
submissions: submissions
}) do
%{
module: Graphite.LeaderboardSubmissionsForm,
params: %{
leaderboard: leaderboard,
submissions: submissions,
uri_origin: uri_origin,
viewport: viewport,
breakpoint: breakpoint,
page_key: :upload,
opt_in?: false,
on_text: "download view on text",
Expand Down
12 changes: 6 additions & 6 deletions core/systems/lab/content_page.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ defmodule Systems.Lab.ContentPage do
~H"""
<.management_page
title={@vm.title}
menus={@menus}
modal={@modal}
popup={@popup}
dialog={@dialog}
tabs={@vm.tabs}
show_errors={@vm.show_errors}
actions={@actions}
tabbar_id={@tabbar_id}
initial_tab={@initial_tab}
tabbar_size={@tabbar_size}
show_errors={@show_errors}
actions={@vm.actions}
menus={@menus}
modal={@modal}
popup={@popup}
dialog={@dialog}
/>
"""
end
Expand Down
Loading

0 comments on commit 8caa8b8

Please sign in to comment.