Skip to content

Commit

Permalink
Fix mix tasks
Browse files Browse the repository at this point in the history
Minor update
  • Loading branch information
jauggy committed Jun 16, 2024
1 parent a2c5976 commit 2cd66d9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/teiserver/mix_tasks/fake_data.ex
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ defmodule Mix.Tasks.Teiserver.Fakedata do
name: generate_throwaway_name() |> String.replace(" ", ""),
email: UUID.uuid1(),
password: root_user.password,
permissions: ["admin.dev.developer"],
permissions: [],
icon: "fa-solid #{StylingHelper.random_icon()}",
colour: StylingHelper.random_colour(),
trust_score: 10_000,
Expand Down
10 changes: 1 addition & 9 deletions lib/teiserver/mix_tasks/fake_playtime.ex
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,8 @@ defmodule Mix.Tasks.Teiserver.FakePlaytime do
# Now recalculate ranks
# This calc would usually be done in do_login
rank = CacheUser.calculate_rank(user_id)
user = Teiserver.Account.UserCacheLib.get_user_by_id(user_id)

user = %{
user
| rank: rank
}

CacheUser.update_user(user, true)

Account.update_user_stat(user.id, %{
Account.update_user_stat(user_id, %{
rank: rank
})
end
Expand Down
4 changes: 3 additions & 1 deletion lib/teiserver_web/live/battles/match/show.ex
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ defmodule TeiserverWeb.Battle.MatchLive.Show do
end

defp apply_action(%{assigns: %{match_name: match_name}} = socket, :balance, _params) do
# Restrict the balance tab to certain roles.
# Note that Staff roles like "Tester" also contain Contributor role.
socket
|> mount_require_any(["Reviewer"])
|> mount_require_any(["Reviewer", "Contributor"])
|> assign(:page_title, "#{match_name} - Balance")
end

Expand Down
12 changes: 6 additions & 6 deletions lib/teiserver_web/live/battles/match/show.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</.tab_nav>
<% end %>

<%= if @rating_logs != %{} and allow?(@current_user, "Overwatch") do %>
<%= if @rating_logs != %{} and allow_any?(@current_user, ["Overwatch", "Contributor"]) do %>
<.tab_nav url={~p"/battle/#{@match.id}/balance"} selected={@tab == :balance}>
<Fontawesome.icon icon="fa-solid fa-scale-balanced" style="solid" /> Balance
</.tab_nav>
Expand Down Expand Up @@ -282,18 +282,18 @@
</div>
<% end %>

<%= if allow?(@current_user, "Overwatch") do %>
<%= if allow_any?(@current_user, ["Overwatch", "Contributor"]) do %>
<div :if={@tab == :balance} class="p-4">
<form method="post" class="">
<.input
<form method="post" class="">
<.input
type="select"
label="Balancer"
options={@balancer_options}
name="balancer"
value={@balancer}
phx-change="update-balancer"
/>
</form>
/>
</form>
<br />

<h4>Based on data at the time</h4>
Expand Down

0 comments on commit 2cd66d9

Please sign in to comment.