From 173e5f71d0828ac413676a1b27ad04d016c9b4f4 Mon Sep 17 00:00:00 2001 From: GabrielCWT <77312579+GabrielCWT@users.noreply.github.com> Date: Mon, 19 Aug 2024 17:12:07 +0800 Subject: [PATCH 1/2] feat: Include hoursBeforeEarlyXpDecay in response --- lib/cadet_web/views/assessments_view.ex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cadet_web/views/assessments_view.ex b/lib/cadet_web/views/assessments_view.ex index 0b967397b..700f13019 100644 --- a/lib/cadet_web/views/assessments_view.ex +++ b/lib/cadet_web/views/assessments_view.ex @@ -37,7 +37,8 @@ defmodule CadetWeb.AssessmentsView do maxTeamSize: :max_team_size, hasVotingFeatures: :has_voting_features, hasTokenCounter: :has_token_counter, - isVotingPublished: &is_voting_assigned(&1.id) + isVotingPublished: &is_voting_assigned(&1.id), + hoursBeforeEarlyXpDecay: & &1.config.hours_before_early_xp_decay }) end From 214ba8524b87746e80510a8f20170d96b9dd0715 Mon Sep 17 00:00:00 2001 From: GabrielCWT <77312579+GabrielCWT@users.noreply.github.com> Date: Wed, 21 Aug 2024 17:42:46 +0800 Subject: [PATCH 2/2] fix: Fix tests --- test/cadet_web/controllers/assessments_controller_test.exs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/cadet_web/controllers/assessments_controller_test.exs b/test/cadet_web/controllers/assessments_controller_test.exs index c78bd12ae..f1cc9beb0 100644 --- a/test/cadet_web/controllers/assessments_controller_test.exs +++ b/test/cadet_web/controllers/assessments_controller_test.exs @@ -83,7 +83,8 @@ defmodule CadetWeb.AssessmentsControllerTest do "earlySubmissionXp" => &1.config.early_submission_xp, "hasVotingFeatures" => &1.has_voting_features, "hasTokenCounter" => &1.has_token_counter, - "isVotingPublished" => Assessments.is_voting_published(&1.id) + "isVotingPublished" => Assessments.is_voting_published(&1.id), + "hoursBeforeEarlyXpDecay" => &1.config.hours_before_early_xp_decay } ) @@ -173,7 +174,8 @@ defmodule CadetWeb.AssessmentsControllerTest do "earlySubmissionXp" => &1.config.early_submission_xp, "hasVotingFeatures" => &1.has_voting_features, "hasTokenCounter" => &1.has_token_counter, - "isVotingPublished" => Assessments.is_voting_published(&1.id) + "isVotingPublished" => Assessments.is_voting_published(&1.id), + "hoursBeforeEarlyXpDecay" => &1.config.hours_before_early_xp_decay } ) @@ -289,6 +291,7 @@ defmodule CadetWeb.AssessmentsControllerTest do "isVotingPublished" => Assessments.is_voting_published(&1.id), "earlySubmissionXp" => &1.config.early_submission_xp, "isGradingPublished" => nil, + "hoursBeforeEarlyXpDecay" => &1.config.hours_before_early_xp_decay, "isPublished" => if &1.config.type == hd(configs).type do false