diff --git a/src/components/Solutions/SolutionDetail/SolutionDetail.js b/src/components/Solutions/SolutionDetail/SolutionDetail.js
index b87f06c7c..51489b6d1 100644
--- a/src/components/Solutions/SolutionDetail/SolutionDetail.js
+++ b/src/components/Solutions/SolutionDetail/SolutionDetail.js
@@ -239,6 +239,7 @@ class SolutionDetail extends Component {
const SolutionFiles = ({
solutionId,
+ attemptIndex,
files,
authorId,
isReference = false,
@@ -181,6 +182,7 @@ const SolutionFiles = ({
{
- const name = toPlainAscii(`${user.name.lastName}-${user.name.firstName}`);
- return `${name}_${solutionId}.zip`;
+const solutionArchiveFileName = (solutionId, user, index = null) => {
+ const components = [user.name.lastName, user.name.firstName];
+ if (index) {
+ components.push(String(index).padStart(3, '0'));
+ }
+ components.push(solutionId);
+ const name = toPlainAscii(components.join('_').replaceAll(' ', '-'));
+ return `${name}.zip`;
};
const DownloadSolutionArchiveContainer = ({
@@ -50,6 +55,8 @@ const DownloadSolutionArchiveContainer = ({
);
DownloadSolutionArchiveContainer.propTypes = {
+ solutionId: PropTypes.string.isRequired,
+ attemptIndex: PropTypes.number,
authorId: PropTypes.string.isRequired,
isReference: PropTypes.bool,
iconOnly: PropTypes.bool,
@@ -64,10 +71,10 @@ export default connect(
(state, { authorId }) => ({
authorUser: getUser(authorId)(state),
}),
- (dispatch, { solutionId }) => ({
+ (dispatch, { solutionId, attemptIndex }) => ({
downloadSolutionArchive: user => e => {
e.preventDefault();
- dispatch(downloadSolutionArchive(solutionId, solutionArchiveFileName(solutionId, user)));
+ dispatch(downloadSolutionArchive(solutionId, solutionArchiveFileName(solutionId, user, attemptIndex)));
},
downloadRefSolutionArchive: user => e => {
e.preventDefault();
|