Skip to content

Commit daf8559

Browse files
committed
Reloading can-submit info right after a solution is submitted.
1 parent 0b3b777 commit daf8559

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

src/components/Assignments/Assignment/AssignmentDetails/AssignmentDetails.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,28 @@ const AssignmentDetails = ({
267267
<td>
268268
{isStudent ? (
269269
<>
270-
{lastAttemptIndex || canSubmit.submittedCount}
270+
{lastAttemptIndex || canSubmit.total}
271+
{canSubmit.total > canSubmit.evaluated && (
272+
<span className="text-muted">
273+
{' '}
274+
{canSubmit.evaluated - canSubmit.total}
275+
<Explanation id="submissionsCountDecreased">
276+
<FormattedMessage
277+
id="app.assignment.submissionCounterDecreasedByNotEvaluated"
278+
defaultMessage="Failed and not evaluated submissions are not counted when restricting submission attempts."
279+
values={{ count: lastAttemptIndex - canSubmit.total }}
280+
/>
281+
</Explanation>
282+
</span>
283+
)}
271284
{submissionsCountLimit !== null && ` / ${submissionsCountLimit}`}
272-
{lastAttemptIndex && lastAttemptIndex > canSubmit.submittedCount && (
285+
{lastAttemptIndex && lastAttemptIndex > canSubmit.total && (
273286
<small className="pl-2 text-muted">
274287
(
275288
<FormattedMessage
276289
id="app.assignment.submissionCountLimitIncreasedByDeletion"
277290
defaultMessage="+{count} {count, plural, one {attempt} other {attempts}} added by deleted solutions"
278-
values={{ count: lastAttemptIndex - canSubmit.submittedCount }}
291+
values={{ count: lastAttemptIndex - canSubmit.total }}
279292
/>
280293
)
281294
</small>

src/locales/cs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
"app.assignment.solutionFilesLimitExplanation": "Omezení se uplatňují na počet odevzdaných souborů a jejich celkovou velikost.",
132132
"app.assignment.solutionFilesLimitSize": "{size} KiB {count, plural, one {} other {celkem}}",
133133
"app.assignment.submissionCountLimitIncreasedByDeletion": "+{count} {count, plural, one {pokus vytvořen} =2 {pokusy vytvořeny} =3 {pokusy vytvořeny} =4 {pokusy vytvořeny} other {pokusů vytvořeno}} smazáním řešení",
134+
"app.assignment.submissionCounterDecreasedByNotEvaluated": "Řešení, která nebyla vyhodnocena nebo jejich vyhodnocení selhalo, se nepočítají do limitu odevzdaných řešení.",
134135
"app.assignment.submissionsCountLimit": "Počet pokusů",
135136
"app.assignment.submissionsCountLimitExplanation": "Maximální počet odevzdaných řešení této úlohy od jednoho studenta. Vyučující můž udělit další pokusy tak, že smaže starší odevzdaná řešení.",
136137
"app.assignment.syncAttachmentFiles": "Přiložené soubory",
@@ -1169,7 +1170,6 @@
11691170
"app.passwordStrength.somewhatOk": "Šlo by to i lépe.",
11701171
"app.passwordStrength.unknown": "...",
11711172
"app.passwordStrength.worst": "Nevyhovující",
1172-
"app.pendingReviewsList.by": "od",
11731173
"app.pendingReviewsList.failed": "Načítání otevřených revizí řešení selhalo. Prosíme, zkuste po chvíli občerstvit tuto komponentu.",
11741174
"app.pendingReviewsList.reviewOpenedAt": "revize otevřena",
11751175
"app.pendingReviewsList.submitted": "odevzdáno",

src/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
"app.assignment.solutionFilesLimitExplanation": "The restrictions may limit maximal number of submitted files and their total size.",
132132
"app.assignment.solutionFilesLimitSize": "{size} KiB {count, plural, one {} other {total}}",
133133
"app.assignment.submissionCountLimitIncreasedByDeletion": "+{count} {count, plural, one {attempt} other {attempts}} added by deleted solutions",
134+
"app.assignment.submissionCounterDecreasedByNotEvaluated": "Failed and not evaluated submissions are not counted when restricting submission attempts.",
134135
"app.assignment.submissionsCountLimit": "Submission attempts",
135136
"app.assignment.submissionsCountLimitExplanation": "Maximal number of solutions logged by one student for this assignment. The teacher may choose to grant additional attempts by deleting old solutions.",
136137
"app.assignment.syncAttachmentFiles": "Text attachment files",
@@ -1169,7 +1170,6 @@
11691170
"app.passwordStrength.somewhatOk": "You can do better.",
11701171
"app.passwordStrength.unknown": "...",
11711172
"app.passwordStrength.worst": "Unsatisfactory",
1172-
"app.pendingReviewsList.by": "by",
11731173
"app.pendingReviewsList.failed": "Loading of the open reviews failed. Please try refreshing this component later.",
11741174
"app.pendingReviewsList.reviewOpenedAt": "review opened at",
11751175
"app.pendingReviewsList.submitted": "submitted",

src/pages/Assignment/Assignment.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ class Assignment extends Component {
8383
}
8484
}
8585

86-
reloadSolvers = () =>
87-
this.props.reloadSolvers(this.props.match.params.assignmentId, this.props.userId || this.props.loggedInUserId);
86+
reloadAfterSubmit = () =>
87+
Promise.all([
88+
this.props.reloadSolvers(this.props.match.params.assignmentId, this.props.userId || this.props.loggedInUserId),
89+
this.props.reloadCanSubmit(),
90+
]);
8891

8992
render() {
9093
const {
@@ -190,7 +193,7 @@ class Assignment extends Component {
190193
id={assignment.id}
191194
onSubmit={submitSolution}
192195
presubmitValidation={presubmitSolution}
193-
afterEvaluationStarts={this.reloadSolvers}
196+
afterEvaluationStarts={this.reloadAfterSubmit}
194197
onReset={init}
195198
isOpen={submitting}
196199
solutionFilesLimit={assignment.solutionFilesLimit}
@@ -277,6 +280,7 @@ Assignment.propTypes = {
277280
fetchManyStatus: PropTypes.string,
278281
assignmentSolversLoading: PropTypes.bool,
279282
assignmentSolverSelector: PropTypes.func.isRequired,
283+
reloadCanSubmit: PropTypes.func.isRequired,
280284
reloadSolvers: PropTypes.func.isRequired,
281285
};
282286

@@ -318,6 +322,7 @@ export default connect(
318322
init: userId => () => dispatch(init(userId, assignmentId)),
319323
loadAsync: userId => Assignment.loadAsync({ assignmentId }, dispatch, { userId }),
320324
exerciseSync: () => dispatch(syncWithExercise(assignmentId)),
325+
reloadCanSubmit: () => dispatch(canSubmit(assignmentId)),
321326
reloadSolvers: (assignmentId, userId) => dispatch(fetchAssignmentSolvers({ assignmentId, userId })),
322327
})
323328
)(Assignment);

0 commit comments

Comments
 (0)