Skip to content

Commit

Permalink
refactor(assessment): move timed assessment
Browse files Browse the repository at this point in the history
- move the component to just below the Start At
- change the translations to better reflect the effect of force submission
  • Loading branch information
bivanalhar authored and cysjonathan committed Sep 17, 2024
1 parent f041a90 commit 5c809e4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,46 @@ const AssessmentForm = (props: AssessmentFormProps): JSX.Element => {
)}
</Grid>

<Controller
control={control}
name="has_time_limit"
render={({ field, fieldState }): JSX.Element => (
<FormCheckboxField
description={t(translations.hasTimeLimitHint)}
disabled={disabled}
field={field}
fieldState={fieldState}
label={t(translations.hasTimeLimit)}
/>
)}
/>

{hasTimeLimit && (
<Controller
control={control}
name="time_limit"
render={({ field, fieldState }): JSX.Element => (
<FormTextField
disabled={disabled}
disableMargins
field={field}
fieldState={fieldState}
fullWidth
InputProps={{
endAdornment: (
<InputAdornment position="end">
{t(translations.minutes)}
</InputAdornment>
),
}}
label={t(translations.timeLimit)}
type="number"
variant="filled"
/>
)}
/>
)}

<Typography>{t(translations.description)}</Typography>

<Controller
Expand Down Expand Up @@ -355,46 +395,6 @@ const AssessmentForm = (props: AssessmentFormProps): JSX.Element => {
)}
/>

<Controller
control={control}
name="has_time_limit"
render={({ field, fieldState }): JSX.Element => (
<FormCheckboxField
description={t(translations.hasTimeLimitHint)}
disabled={disabled}
field={field}
fieldState={fieldState}
label={t(translations.hasTimeLimit)}
/>
)}
/>

{hasTimeLimit && (
<Controller
control={control}
name="time_limit"
render={({ field, fieldState }): JSX.Element => (
<FormTextField
disabled={disabled}
disableMargins
field={field}
fieldState={fieldState}
fullWidth
InputProps={{
endAdornment: (
<InputAdornment position="end">
{t(translations.minutes)}
</InputAdornment>
),
}}
label={t(translations.timeLimit)}
type="number"
variant="filled"
/>
)}
/>
)}

{editing && folderAttributes && (
<>
<Typography>{t(translations.files)}</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const translations = defineMessages({
},
hasTimeLimit: {
id: 'course.assessment.AssessmentForm.hasTimeLimit',
defaultMessage: 'Enable Timed Assessment',
defaultMessage: 'Automatically submit when timer ends',
},
hasTodoHint: {
id: 'course.assessment.AssessmentForm.hasTodoHint',
Expand All @@ -148,7 +148,7 @@ const translations = defineMessages({
hasTimeLimitHint: {
id: 'course.assessment.AssessmentForm.hasTimeLimitHint',
defaultMessage:
'When enabled, submissions will automatically be finalised when the time limit is reached.',
'When enabled, each submission will have its own timer and will automatically be finalised when its timer ends.',
},
gradingMode: {
id: 'course.assessment.AssessmentForm.gradingMode',
Expand Down

0 comments on commit 5c809e4

Please sign in to comment.