Skip to content

Commit

Permalink
update variable names for instruction minimum length environment vari…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
CollinBeczak committed Jan 11, 2024
1 parent a9d7aef commit 3a2aa57
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,4 @@ REACT_APP_DISABLE_TASK_CLUSTERS=''
REACT_APP_DISABLE_USER_LEADERBOARD_CONFIGS=''

# For setting the minimum character count for challenge instructions
REACT_APP_CHALLENGE_INSTRUCTIONS_LENGTH=150
REACT_APP_CHALLENGE_INSTRUCTIONS_MIN_LENGTH=150
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import messages from '../Messages'

export const jsSchema = (intl) => {
const instructionsLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_LENGTH || 150
const instructionsMinLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_MIN_LENGTH || 150
const schemaFields = {
"$schema": "http://json-schema.org/draft-07/schema#",
type: "object",
properties: {
instruction: {
title: intl.formatMessage(messages.instructionLabel),
type: "string",
minLength: instructionsLength,
description: intl.formatMessage(messages.instructionsDescription, {details: `${instructionsLength}`})
minLength: instructionsMinLength,
description: intl.formatMessage(messages.instructionsDescription, {minLength: `${instructionsMinLength}`})
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ will not be able to make sense of it.

instructionsDescription: {
id: "Admin.EditChallenge.form.instructionsDescription",
defaultMessage: "Instructions must be longer than {details} characters.",
defaultMessage: "Instructions must be longer than {minLength} characters.",
},

nameDescription: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import messages from '../Messages'
* @author [Neil Rotstan](https://github.com/nrotstan)
*/
export const jsSchema = (intl) => {
const instructionsLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_LENGTH || 150
const instructionsMinLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_MIN_LENGTH || 150
const schemaFields = {
"$schema": "http://json-schema.org/draft-07/schema#",
type: "object",
Expand All @@ -26,7 +26,7 @@ export const jsSchema = (intl) => {
title: intl.formatMessage(messages.instructionLabel),
type: "string",
minLength: instructionsLength,
description: intl.formatMessage(messages.instructionsDescription, {details: `${instructionsLength}`})
description: intl.formatMessage(messages.instructionsDescription, {minLength: `${instructionsMinLength}`})
},
difficulty: {
title: intl.formatMessage(messages.difficultyLabel),
Expand Down
4 changes: 2 additions & 2 deletions src/services/Challenge/Challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ export const fetchChallenges = function (
name
} = challengeData;

const instructionsLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_LENGTH || 150
const instructionsMinLength = process.env.REACT_APP_CHALLENGE_INSTRUCTIONS_MIN_LENGTH || 150
if (
challengeData.parent != undefined &&
(
Expand All @@ -1066,7 +1066,7 @@ export const fetchChallenges = function (
instruction.length < 150
) {
errorMessage = AppErrors.challengeSaveFailure.saveInstructionsFailure;
errorMessage.values = { details: `${instructionsLength}` };
errorMessage.values = { minLength: `${instructionsMinLength}` };
} else {
errorMessage = AppErrors.challengeSaveFailure.saveDetailsFailure;
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/Error/Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export default defineMessages({
},
challengeSaveInstructionFailure: {
id: "Errors.challengeSaveFailure.challengeSaveInstructionFailure",
defaultMessage: "The 'DETAILED INSTRUCTIONS FOR MAPPERS' field must have more than {details} characters.",
defaultMessage: "The 'DETAILED INSTRUCTIONS FOR MAPPERS' field must have more than {minLength} characters.",
},
challengeSaveEditPolicyAgreementFailure: {
id: "Errors.challengeSaveFailure.challengeSaveEditPolicyAgreementFailure",
Expand Down

0 comments on commit 3a2aa57

Please sign in to comment.