Skip to content

Commit

Permalink
[CHORE] [MER-XXXX] Merge Prerelease v0.29.0 (#5312)
Browse files Browse the repository at this point in the history
* [FEATURE] [MER-4016] add more parameters to assignment launch page (#5279)

* [FEATURE] [MER-3961] Remove Admin `Browse collab spaces` (#5276)

https://eliterate.atlassian.net/browse/MER-3961

* add page termos on prologue page

* fix spacing between elements to match figma desing

* fix warning

* consider default scoring strategy

* add tests

* debug auto deploy

* revert workflow file

* only create activity_attempts_submitted index if it does not already exist (#5283)

* fix sidebar (#5285)

* [FEATURE] [MER-4093] ExtenD term page cases on prologue (#5286)

* extend page submission term to consider new logic

* add tests

* extend page submission logic + tests (#5287)

Co-authored-by: Santiago Simoncelli <[email protected]>

* [MER-4096] Add depot warmer environment variables to the runtime configuration (#5288)

* [MER-4099] Show a time limit message when no due date is set (#5290)

* [MER-4101] Show the Time Limit page term when is configured (#5291)

This PR adds the "Time Limit" page term when its value is different from 0, regardless of other conditions.

https://eliterate.atlassian.net/browse/MER-4101

* [MER-4105] Remove any reference to autosubmit on assessment terms displayed to student (#5294)

---------

Co-authored-by: Nicolás Cirio <[email protected]>
Co-authored-by: Eli Knebel <[email protected]>
Co-authored-by: Santiago Simoncelli <[email protected]>
Co-authored-by: Francisco-Castro <[email protected]>
  • Loading branch information
5 people authored Dec 19, 2024
1 parent 5681512 commit 7fb7fc6
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 241 deletions.
2 changes: 2 additions & 0 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ if config_env() == :prod do

# General OLI app config
config :oli,
depot_warmer_days_lookback: System.get_env("DEPOT_WARMER_DAYS_LOOKBACK", "5"),
depot_warmer_max_number_of_entries: System.get_env("DEPOT_WARMER_MAX_NUMBER_OF_ENTRIES", "0"),
s3_media_bucket_name: s3_media_bucket_name,
s3_xapi_bucket_name: s3_xapi_bucket_name,
media_url: media_url,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ defmodule OliWeb.Delivery.Student.Lesson.Components.OutlineComponent do

attr :item, :map, required: true
attr :is_container?, :boolean, required: true
attr :expanded_items, :list, required: true
attr :target, :any, required: true
attr :section_slug, :string, required: true
attr :selected_view, :atom, required: true
attr :progress, :float, default: nil
attr :expanded_items, :list, required: true

def outline_item(%{item: %{"numbering" => %{"level" => level}}}) when level > 3, do: nil

Expand Down Expand Up @@ -184,20 +184,21 @@ defmodule OliWeb.Delivery.Student.Lesson.Components.OutlineComponent do
]}
>
<div
phx-click={JS.toggle_class("rotate-90", to: "#icon_#{@item["id"]}") |> JS.push("expand_item")}
phx-click="expand_item"
phx-value-item_id={@item["id"]}
phx-target={@target}
data-bs-toggle="collapse"
data-bs-target={"#collapse_#{@item["id"]}"}
aria-expanded={"#{expanded?}"}
class={[
"w-full grow shrink basis-0 p-2 flex-col justify-start items-start gap-1 inline-flex rounded-lg hover:bg-[#f2f8ff] dark:hover:bg-[#2e2b33] hover:cursor-pointer",
if(@progress, do: "bg-[#f3f4f8] dark:bg-[#1b191f]")
]}
>
<div class="text-[#353740] dark:text-[#eeebf5] self-stretch justify-start items-start gap-1 inline-flex">
<div id={"icon_#{@item["id"]}"} class="transition-transform duration-300">
<Icons.chevron_right width="20" height="20" />
<div>
<%= if expanded? do %>
<Icons.chevron_down width="20" height="20" />
<% else %>
<Icons.chevron_right width="20" height="20" />
<% end %>
</div>
<div class="grow shrink basis-0 text-base font-bold leading-normal" role="title">
Expand All @@ -215,18 +216,17 @@ defmodule OliWeb.Delivery.Student.Lesson.Components.OutlineComponent do
/>
</div>
<div
id={"collapse_#{@item["id"]}"}
class="collapse"
:if={expanded?}
class="grow shrink basis-0 py-1 flex-col justify-start items-start gap-1 inline-flex"
>
<.outline_item
:for={node <- @item["children"]}
item={node}
expanded_items={@expanded_items}
is_container?={node["resource_type_id"] == ResourceType.id_for_container()}
target={@target}
section_slug={@section_slug}
selected_view={@selected_view}
expanded_items={@expanded_items}
/>
</div>
</div>
Expand Down
8 changes: 6 additions & 2 deletions lib/oli_web/live/delivery/student/prologue_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule OliWeb.Delivery.Student.PrologueLive do
use OliWeb, :live_view

import OliWeb.Delivery.Student.Utils,
only: [page_header: 1, page_terms: 1]
only: [page_header: 1, page_terms: 1, is_adaptive_page: 1]

alias Oli.Accounts.User
alias Oli.Delivery.Attempts.Core.ResourceAttempt
Expand Down Expand Up @@ -99,7 +99,11 @@ defmodule OliWeb.Delivery.Student.PrologueLive do
/>
<div class="self-stretch h-[0px] opacity-80 dark:opacity-20 bg-white border border-gray-200 mt-3 mb-10">
</div>
<.page_terms effective_settings={@page_context.effective_settings} ctx={@ctx} />
<.page_terms
effective_settings={@page_context.effective_settings}
ctx={@ctx}
is_adaptive={is_adaptive_page(@page_context.page)}
/>
<.attempts_summary
page_context={@page_context}
attempt_message={@attempt_message}
Expand Down
160 changes: 34 additions & 126 deletions lib/oli_web/live/delivery/student/utils.ex
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ defmodule OliWeb.Delivery.Student.Utils do

attr :effective_settings, Oli.Delivery.Settings.Combined
attr :ctx, SessionContext
attr :is_adaptive, :boolean

def page_terms(assigns) do
~H"""
Expand All @@ -189,9 +190,7 @@ defmodule OliWeb.Delivery.Student.Utils do
<li id="page_due_terms">
<.page_due_term effective_settings={@effective_settings} ctx={@ctx} />
</li>
<li :if={@effective_settings.end_date != nil} id="page_submission_terms">
<.page_submission_term effective_settings={@effective_settings} ctx={@ctx} />
</li>
<.maybe_add_time_limit_term effective_settings={@effective_settings} />
<li :if={@effective_settings.end_date != nil} id="page_scoring_terms">
<%= page_scoring_term(@effective_settings.scoring_strategy_id) %>
</li>
Expand All @@ -200,147 +199,53 @@ defmodule OliWeb.Delivery.Student.Utils do
"""
end

attr :effective_settings, Oli.Delivery.Settings.Combined
attr :ctx, SessionContext

defp page_due_term(%{effective_settings: %{end_date: end_date}} = assigns)
when not is_nil(end_date) do
defp maybe_add_time_limit_term(%{effective_settings: %{time_limit: time_limit}} = assigns)
when time_limit > 0 do
~H"""
<div>
<span>
<%= "This assignment is #{scheduling_type(@effective_settings.scheduling_type)}" %>
</span>
<span class="font-bold">
<%= FormatDateTime.to_formatted_datetime(
@effective_settings.end_date,
@ctx,
"{WDshort} {Mshort} {D}, {YYYY} by {h12}:{m}{am}."
) %>
</span>
</div>
<li id="page_time_limit_term">
You have <b><%= parse_minutes(@effective_settings.time_limit) %></b>
to complete the assessment from the time you begin. If you exceed this time, it will be marked as late.
</li>
"""
end

defp page_due_term(%{effective_settings: %{end_date: nil}} = assigns) do
defp maybe_add_time_limit_term(assigns) do
~H"""
<div>
<span>
<%= "This assignment is" %>
</span>
<span class="font-bold">
not yet scheduled.
</span>
</div>
"""
end

defp scheduling_type(:due_by), do: "due on"
defp scheduling_type(_scheduling_type), do: "suggested by"
attr :effective_settings, Oli.Delivery.Settings.Combined
attr :ctx, SessionContext

defp page_submission_term(%{effective_settings: %{time_limit: 0, grace_period: 0}} = assigns) do
defp page_due_term(%{effective_settings: %{end_date: nil}} = assigns) do
~H"""
<div>
<span>
Your work will automatically be submitted at
</span>
<span class="font-bold">
<%= FormatDateTime.to_formatted_datetime(
@effective_settings.end_date,
@ctx,
"{h12}:{m}{am} on {WDshort} {Mshort} {D}, {YYYY}."
) %>
</span>
</div>
This assignment is <b>not yet scheduled.</b>
"""
end

defp page_submission_term(
%{effective_settings: %{time_limit: 0, grace_period: grace_period}} = assigns
)
when grace_period > 0 do
~H"""
<div>
<span>
Your work will automatically be submitted at
</span>
<span class="font-bold">
<%= Timex.shift(@effective_settings.end_date, minutes: @effective_settings.grace_period)
|> FormatDateTime.to_formatted_datetime(
@ctx,
"{h12}:{m}{am} on {WDshort} {Mshort} {D}, {YYYY}."
) %>
</span>
</div>
"""
end
defp page_due_term(%{effective_settings: %{end_date: end_date}} = assigns) do
verb_form =
case DateTime.compare(DateTime.utc_now(), end_date) do
:gt -> "was"
:lt -> "is"
end

assigns = assign(assigns, verb_form: verb_form)

defp page_submission_term(
%{effective_settings: %{time_limit: time_limit, grace_period: 0}} = assigns
)
when time_limit > 0 do
~H"""
<div>
<span>
Your work will automatically be submitted
</span>
<span class="font-bold">
<%= parse_minutes(@effective_settings.time_limit) %>
</span>
<span>
after you click the Begin button
</span>
</div>
<%= "This assignment #{@verb_form} #{scheduling_type(@effective_settings.scheduling_type)}" %>
<b>
<%= FormatDateTime.to_formatted_datetime(
@effective_settings.end_date,
@ctx,
"{WDshort} {Mshort} {D}, {YYYY} by {h12}:{m}{am}."
) %>
</b>
"""
end

defp page_submission_term(
%{
effective_settings: %{
time_limit: time_limit,
grace_period: grace_period,
end_date: end_date
}
} = assigns
)
when time_limit > 0 and grace_period > 0 do
# when we have both time limit and grace period,
# the end date time that comes first is the one that should be considered.
# For calculating the start_date_with_time_limit we assume the student is about to begin the attempt
now = Oli.DateTime.utc_now()
start_date_with_time_limit = Timex.shift(now, minutes: time_limit)
end_date_with_grace_period = Timex.shift(end_date, minutes: grace_period)

if DateTime.compare(start_date_with_time_limit, end_date_with_grace_period) == :lt do
~H"""
<div>
<span>
Your work will automatically be submitted
</span>
<span class="font-bold">
<%= parse_minutes(@effective_settings.time_limit) %>
</span>
<span>
after you click the Begin button
</span>
</div>
"""
else
~H"""
<div>
<span>
Your work will automatically be submitted at
</span>
<span class="font-bold">
<%= Timex.shift(@effective_settings.end_date, minutes: @effective_settings.grace_period)
|> FormatDateTime.to_formatted_datetime(
@ctx,
"{h12}:{m}{am} on {WDshort} {Mshort} {D}, {YYYY}."
) %>
</span>
</div>
"""
end
end
defp scheduling_type(:due_by), do: "due on"
defp scheduling_type(_scheduling_type), do: "suggested by"

@doc """
Parses the minutes into a human-readable format.
Expand Down Expand Up @@ -1007,6 +912,9 @@ defmodule OliWeb.Delivery.Student.Utils do
end
end

def is_adaptive_page(%Oli.Resources.Revision{content: %{"advancedDelivery" => true}}), do: true
def is_adaptive_page(_), do: false

defp build_page_link_params(section_slug, page, request_path, selected_view) do
current_page_path =
lesson_live_path(section_slug, page.slug,
Expand Down
Loading

0 comments on commit 7fb7fc6

Please sign in to comment.