Skip to content

Commit

Permalink
Merge branch 'master' into archive-previous-releases
Browse files Browse the repository at this point in the history
  • Loading branch information
RichDom2185 authored Feb 13, 2024
2 parents 8a794bb + 18a71d3 commit abe896a
Show file tree
Hide file tree
Showing 20 changed files with 110 additions and 28 deletions.
5 changes: 3 additions & 2 deletions lib/cadet/courses/assessment_config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ defmodule Cadet.Courses.AssessmentConfig do
field(:type, :string)
field(:show_grading_summary, :boolean, default: true)
field(:is_manually_graded, :boolean, default: true)
# used by fronend to determine display styles
field(:has_token_counter, :boolean, default: false)
# used by frontend to determine display styles
field(:early_submission_xp, :integer, default: 0)
field(:hours_before_early_xp_decay, :integer, default: 0)

Expand All @@ -23,7 +24,7 @@ defmodule Cadet.Courses.AssessmentConfig do

@required_fields ~w(course_id)a
@optional_fields ~w(order type early_submission_xp
hours_before_early_xp_decay show_grading_summary is_manually_graded)a
hours_before_early_xp_decay show_grading_summary is_manually_graded has_token_counter)a

def changeset(assessment_config, params) do
assessment_config
Expand Down
4 changes: 3 additions & 1 deletion lib/cadet/courses/course.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ defmodule Cadet.Courses.Course do
enable_game: boolean(),
enable_achievements: boolean(),
enable_sourcecast: boolean(),
enable_stories: boolean(),
source_chapter: integer(),
source_variant: String.t(),
module_help_text: String.t(),
Expand All @@ -26,6 +27,7 @@ defmodule Cadet.Courses.Course do
field(:enable_game, :boolean, default: true)
field(:enable_achievements, :boolean, default: true)
field(:enable_sourcecast, :boolean, default: true)
field(:enable_stories, :boolean, default: false)
field(:source_chapter, :integer)
field(:source_variant, :string)
field(:module_help_text, :string)
Expand All @@ -39,7 +41,7 @@ defmodule Cadet.Courses.Course do
end

@required_fields ~w(course_name viewable enable_game
enable_achievements enable_sourcecast source_chapter source_variant)a
enable_achievements enable_sourcecast enable_stories source_chapter source_variant)a
@optional_fields ~w(course_short_name module_help_text)a

def changeset(course, params) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ defmodule CadetWeb.AdminCoursesController do
enable_game(:body, :boolean, "Enable game")
enable_achievements(:body, :boolean, "Enable achievements")
enable_sourcecast(:body, :boolean, "Enable sourcecast")
enable_stories(:body, :boolean, "Enable stories")
sublanguage(:body, Schema.ref(:AdminSublanguage), "sublanguage object")
module_help_text(:body, :string, "Module help text")
end
Expand Down
1 change: 1 addition & 0 deletions lib/cadet_web/admin_views/admin_courses_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ defmodule CadetWeb.AdminCoursesView do
displayInDashboard: :show_grading_summary,
isManuallyGraded: :is_manually_graded,
earlySubmissionXp: :early_submission_xp,
hasTokenCounter: :has_token_counter,
hoursBeforeEarlyXpDecay: :hours_before_early_xp_decay
})
end
Expand Down
3 changes: 3 additions & 0 deletions lib/cadet_web/controllers/courses_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ defmodule CadetWeb.CoursesController do
enable_game(:body, :boolean, "Enable game", required: true)
enable_achievements(:body, :boolean, "Enable achievements", required: true)
enable_sourcecast(:body, :boolean, "Enable sourcecast", required: true)
enable_stories(:body, :boolean, "Enable stories", required: true)
source_chapter(:body, :number, "Default source chapter", required: true)

source_variant(:body, Schema.ref(:SourceVariant), "Default source variant name",
Expand Down Expand Up @@ -95,6 +96,7 @@ defmodule CadetWeb.CoursesController do
enable_game(:boolean, "Enable game", required: true)
enable_achievements(:boolean, "Enable achievements", required: true)
enable_sourcecast(:boolean, "Enable sourcecast", required: true)
enable_stories(:boolean, "Enable stories", required: true)
source_chapter(:integer, "Source Chapter number from 1 to 4", required: true)
source_variant(Schema.ref(:SourceVariant), "Source Variant name", required: true)
module_help_text(:string, "Module help text", required: true)
Expand All @@ -108,6 +110,7 @@ defmodule CadetWeb.CoursesController do
enable_game: true,
enable_achievements: true,
enable_sourcecast: true,
enable_stories: false,
source_chapter: 1,
source_variant: "default",
module_help_text: "Help text",
Expand Down
2 changes: 2 additions & 0 deletions lib/cadet_web/controllers/user_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ defmodule CadetWeb.UserController do
enable_game(:boolean, "Enable game", required: true)
enable_achievements(:boolean, "Enable achievements", required: true)
enable_sourcecast(:boolean, "Enable sourcecast", required: true)
enable_stories(:boolean, "Enable stories", required: true)
source_chapter(:integer, "Source Chapter number from 1 to 4", required: true)
source_variant(Schema.ref(:SourceVariant), "Source Variant name", required: true)
module_help_text(:string, "Module help text", required: true)
Expand All @@ -330,6 +331,7 @@ defmodule CadetWeb.UserController do
enable_game: true,
enable_achievements: true,
enable_sourcecast: true,
enable_stories: false,
source_chapter: 1,
source_variant: "default",
module_help_text: "Help text",
Expand Down
2 changes: 1 addition & 1 deletion lib/cadet_web/helpers/assessments_helpers.ex
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ defmodule CadetWeb.AssessmentsHelpers do
solutionTemplate: "template",
contestEntries:
&Enum.map(&1[:contest_entries], fn entry -> build_contest_entry(entry) end),
contestLeaderboard:
scoreLeaderboard:
&Enum.map(&1[:contest_leaderboard], fn entry ->
build_contest_leaderboard_entry(entry)
end)
Expand Down
1 change: 1 addition & 0 deletions lib/cadet_web/views/courses_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule CadetWeb.CoursesView do
enableGame: :enable_game,
enableAchievements: :enable_achievements,
enableSourcecast: :enable_sourcecast,
enableStories: :enable_stories,
sourceChapter: :source_chapter,
sourceVariant: :source_variant,
moduleHelpText: :module_help_text,
Expand Down
2 changes: 2 additions & 0 deletions lib/cadet_web/views/user_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ defmodule CadetWeb.UserView do
enableGame: :enable_game,
enableAchievements: :enable_achievements,
enableSourcecast: :enable_sourcecast,
enableStories: :enable_stories,
sourceChapter: :source_chapter,
sourceVariant: :source_variant,
moduleHelpText: :module_help_text,
Expand All @@ -124,6 +125,7 @@ defmodule CadetWeb.UserView do
type: :type,
displayInDashboard: :show_grading_summary,
isManuallyGraded: :is_manually_graded,
hasTokenCounter: :has_token_counter,
earlySubmissionXp: :early_submission_xp,
hoursBeforeEarlyXpDecay: :hours_before_early_xp_decay
})
Expand Down
Loading

0 comments on commit abe896a

Please sign in to comment.