Skip to content

Commit

Permalink
Merge branch 'Simon-Initiative:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
dtiwarATS authored Dec 11, 2024
2 parents af57342 + 44683f0 commit d04ed7a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/oli/delivery/sections/section.ex
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ defmodule Oli.Delivery.Sections.Section do

field(:encouraging_subtitle, :string)

field(:agenda, :boolean, default: false)
field(:agenda, :boolean, default: true)

timestamps(type: :utc_datetime)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule Oli.Repo.Migrations.UpdateAgendaDefaultToTrue do
use Ecto.Migration

def change do
alter table(:sections) do
modify(:agenda, :boolean, default: true)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,30 @@ defmodule OliWeb.Delivery.InstructorDashboard.ManageTabTest do
}
)

refute has_element?(view, "input[name=\"toggle_agenda\"][checked]")
assert has_element?(view, "input[name=\"toggle_agenda\"][checked]")

element(view, "form[phx-change=\"toggle_agenda\"]")
|> render_change(%{})

assert has_element?(view, "input[name=\"toggle_agenda\"][checked]")
refute has_element?(view, "input[name=\"toggle_agenda\"][checked]")

element(view, "form[phx-change=\"toggle_agenda\"]")
|> render_change(%{})

refute has_element?(view, "input[name=\"toggle_agenda\"][checked]")
assert has_element?(view, "input[name=\"toggle_agenda\"][checked]")
end

test "agenda is enabled by default when creating a course section", %{
instructor: instructor,
section: section,
conn: conn
} do
Sections.enroll(instructor.id, section.id, [ContextRoles.get_role(:context_instructor)])

{:ok, view, _html} = live(conn, live_view_manage_route(section.slug))

assert section.agenda
assert has_element?(view, "input[name=\"toggle_agenda\"][checked]")
end
end
end
8 changes: 4 additions & 4 deletions test/oli_web/live/delivery/student/index_live_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1115,10 +1115,6 @@ defmodule OliWeb.Delivery.Student.IndexLiveTest do
page_3: page_3,
page_4: page_4
} do
Sections.update_section(section, %{
agenda: true
})

stub_current_time(~U[2023-11-03 21:00:00Z])
{:ok, view, _html} = live(conn, ~p"/sections/#{section.slug}")

Expand All @@ -1135,6 +1131,10 @@ defmodule OliWeb.Delivery.Student.IndexLiveTest do
section: section,
page_1: page_1
} do
Sections.update_section(section, %{
agenda: false
})

stub_current_time(~U[2023-11-03 21:00:00Z])
{:ok, view, _html} = live(conn, ~p"/sections/#{section.slug}")

Expand Down

0 comments on commit d04ed7a

Please sign in to comment.