Skip to content

Commit

Permalink
Clean up Seeder Branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ks0m1c_dharma committed Mar 8, 2024
1 parent 6380915 commit c611eac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 36 deletions.
29 changes: 1 addition & 28 deletions lib/vyasa/written.ex
Original file line number Diff line number Diff line change
Expand Up @@ -142,33 +142,7 @@ defmodule Vyasa.Written do
|> Repo.one()
end

# def get_verses_by_chapter(no, source_title, lang) do
# (from v in Verses,
# where: v.chapter_no == ^no and v.source =)




# # (from c in Chapter,
# # inner_join: src in assoc(c, :source),
# # where: src.title == ^source_title and c.no == ^no,
# # preload: [verses: ^(from v in Verse, preload: [translations: ^target_lang]) , translations: ^target_lang])
# # # left_join: v in assoc(c, :verses),
# # # on: c.source_id == v.source_id,
# # # where: c.no == ^no,
# # # left_join: t in assoc(v, :translations),
# # # on: t.source_id == v.source_id,
# # # where: t.lang == ^lang
# # )
# # |> Repo.all()
# # # |> select_merge([src, c, v, t], %{
# # # c | verses: [%{v | translations: [t]}]
# # # })
# # # |> Repo.all()

# end

def get_chapter(no, source_title, lang) do
def get_chapter(no, source_title, lang) do
%Source{id: id} = _src = get_source_by_title(source_title)

target_lang = (from ts in Translation,
Expand All @@ -189,7 +163,6 @@ defmodule Vyasa.Written do
preload: [:chapter]

Repo.all(query_verse)
|> dbg()
end

@doc """
Expand Down
14 changes: 7 additions & 7 deletions lib/vyasa_web/live/source_live/chapter/index.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</:subtitle>
</.header>

<.verse_display id={dom_id} :for={{dom_id, verse} <- @streams.verses}>
<.verse_display id={dom_id} :for={{dom_id, %Written.Verse{} = verse} <- @streams.verses}>
<:item
title={"#{verse.chapter_no}.#{verse.no}"}
verse_id={verse.id}
Expand All @@ -24,18 +24,18 @@
</p>
</:item>
<:item title={"Transliteration"}>
<p class="font-dn text-lg">
<%= verse && Enum.any?(verse.translations) && hd(verse.translations).target.body_translit %>
<p :if={Enum.any?(verse.translations)} class="font-dn text-lg">
<%= hd(verse.translations).target.body_translit %>
</p>
</:item>
<:item title={"Transliteration Meaning"}>
<p class="font-dn text-m">
<%= verse && Enum.any?(verse.translations) && hd(verse.translations).target.body_translit_meant %>
<p :if={Enum.any?(verse.translations)} class="font-dn text-m">
<%= hd(verse.translations).target.body_translit_meant %>
</p>
</:item>
<:item title={"Translation"}>
<p class="font-dn text-lg">
<%= verse && Enum.any?(verse.translations) && hd(verse.translations).target.body %>
<p :if={Enum.any?(verse.translations)} class="font-dn text-lg">
<%= hd(verse.translations).target.body %>
</p>
</:item>
</.verse_display>
Expand Down
1 change: 0 additions & 1 deletion lib/vyasa_web/live/source_live/show.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ defmodule VyasaWeb.SourceLive.Show do
|> assign(:page_title, title)
# |> stream(:verses, verses)
|> stream(:chapters, chapters |> Enum.sort_by(fn chap -> chap.no end))
|> dbg()
|> assign_meta()
}

Expand Down

0 comments on commit c611eac

Please sign in to comment.