Skip to content

Commit

Permalink
Fix getting started list
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Knuchel committed Nov 26, 2023
1 parent 622af44 commit 59fdf07
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions backend/lib/azimutt/services/onboarding_srv.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ defmodule Azimutt.Services.OnboardingSrv do

def on_event(%Event{created_by: nil}), do: :ok

def add_item(%User{} = user, item) do
if user && !Enum.member?(user.data.start_checklist, item) do
user |> Accounts.set_start_checklist(user.data.start_checklist ++ [item])
else
def add_item(%User{} = user, item) when not is_nil(user) do
start_checklist = if(user.data, do: user.data.start_checklist, else: [])

if Enum.member?(start_checklist, item) do
:ok
else
user |> Accounts.set_start_checklist(start_checklist ++ [item])
end
end

def add_item(user, item) when is_nil(user), do: :ok

def items do
[
%{id: "new_project", label: "Create a project and save it", help: "When saving your project, local mode keep all your data on your browser."},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="min-h-full pr-4 bg-gray-50 sm:pr-6 lg:pr-8 lg:flex-shrink-0 lg:border-l lg:border-gray-200 xl:pr-0 divide-y">
<%= render AzimuttWeb.PartialsView, "_blackfriday_card.html", conn: @conn, organization: @organization, plan: @plan.id %>
<%= render AzimuttWeb.PartialsView, "_streak.html", value: @plan.streak %>
<%= render AzimuttWeb.PartialsView, "_start_checklist.html", conn: @conn, organization: @organization, completed: @current_user.data.start_checklist %>
<%= render AzimuttWeb.PartialsView, "_start_checklist.html", conn: @conn, organization: @organization, completed: if(@current_user.data, do: @current_user.data.start_checklist, else: []) %>
<%= render AzimuttWeb.PartialsView, "_activity_feed.html", events: @organization_events %>
</div>

0 comments on commit 59fdf07

Please sign in to comment.