Skip to content

Commit

Permalink
Solution list data schema updated
Browse files Browse the repository at this point in the history
  • Loading branch information
SemaiCZE committed Nov 13, 2017
1 parent 49046f0 commit 11647ef
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,21 @@ import { FormattedDate, FormattedTime, FormattedMessage } from 'react-intl';
import { Link } from 'react-router';
import AssignmentStatusIcon from '../Assignment/AssignmentStatusIcon';

const EvaluationFailedTableRow = ({ link, note, submittedAt }) => (
const EvaluationFailedTableRow = ({ link, note, solution: { createdAt } }) =>
<tr>
<td><AssignmentStatusIcon id={link} status="evaluation-failed" /></td>
<td>
<FormattedDate value={submittedAt * 1000} />
<AssignmentStatusIcon id={link} status="evaluation-failed" />
</td>
<td>
<FormattedDate value={createdAt * 1000} />
&nbsp;
<FormattedTime value={submittedAt * 1000} />
<FormattedTime value={createdAt * 1000} />
</td>
<td className="text-center">
<span className="text-danger">
-
</span>
<span className="text-danger">-</span>
</td>
<td className="text-center">
<span className="text-danger">
-
</span>
<span className="text-danger">-</span>
</td>
<td>
{note}
Expand All @@ -33,13 +31,14 @@ const EvaluationFailedTableRow = ({ link, note, submittedAt }) => (
/>
</Link>
</td>
</tr>
);
</tr>;

EvaluationFailedTableRow.propTypes = {
link: PropTypes.string.isRequired,
submittedAt: PropTypes.number.isRequired,
note: PropTypes.string.isRequired
note: PropTypes.string.isRequired,
solution: PropTypes.shape({
createdAt: PropTypes.number.isRequired
}).isRequired
};

export default EvaluationFailedTableRow;
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ import Points from './Points';
const FailedSubmissionTableRow = ({
link,
note,
submittedAt,
lastSubmission: { evaluation: { score, points } },
maxPoints,
evaluation: { score, points, bonusPoints },
bonusPoints,
solution: { createdAt },
accepted
}) =>
<tr>
<td>
<AssignmentStatusIcon id={link} status="failed" accepted={accepted} />
</td>
<td>
<FormattedDate value={submittedAt * 1000} />
<FormattedDate value={createdAt * 1000} />
&nbsp;
<FormattedTime value={submittedAt * 1000} />
<FormattedTime value={createdAt * 1000} />
</td>
<td className="text-center">
<span className="text-danger">
Expand Down Expand Up @@ -56,12 +57,17 @@ const FailedSubmissionTableRow = ({

FailedSubmissionTableRow.propTypes = {
link: PropTypes.string.isRequired,
submittedAt: PropTypes.number.isRequired,
note: PropTypes.string.isRequired,
maxPoints: PropTypes.number.isRequired,
evaluation: PropTypes.shape({
score: PropTypes.number.isRequired,
points: PropTypes.number.isRequired
bonusPoints: PropTypes.number.isRequired,
lastSubmission: PropTypes.shape({
evaluation: PropTypes.shape({
score: PropTypes.number.isRequired,
points: PropTypes.number.isRequired
})
}).isRequired,
solution: PropTypes.shape({
createdAt: PropTypes.number.isRequired
}).isRequired,
accepted: PropTypes.bool
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@ import { FormattedDate, FormattedTime, FormattedMessage } from 'react-intl';
import { Link } from 'react-router';
import AssignmentStatusIcon from '../Assignment/AssignmentStatusIcon';

const NotEvaluatedSubmissionTableRow = ({ link, note, submittedAt }) => (
const NotEvaluatedSubmissionTableRow = ({
link,
note,
solution: { createdAt }
}) =>
<tr>
<td><AssignmentStatusIcon id={link} status="work-in-progress" /></td>
<td>
<FormattedDate value={submittedAt * 1000} />
<AssignmentStatusIcon id={link} status="work-in-progress" />
</td>
<td>
<FormattedDate value={createdAt * 1000} />
&nbsp;
<FormattedTime value={submittedAt * 1000} />
<FormattedTime value={createdAt * 1000} />
</td>
<td className="text-center">-</td>
<td className="text-center">- / -</td>
Expand All @@ -25,13 +31,14 @@ const NotEvaluatedSubmissionTableRow = ({ link, note, submittedAt }) => (
/>
</Link>
</td>
</tr>
);
</tr>;

NotEvaluatedSubmissionTableRow.propTypes = {
link: PropTypes.string.isRequired,
submittedAt: PropTypes.number.isRequired,
note: PropTypes.string.isRequired
note: PropTypes.string.isRequired,
solution: PropTypes.shape({
createdAt: PropTypes.number.isRequired
}).isRequired
};

export default NotEvaluatedSubmissionTableRow;
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const SubmissionsTable = ({
const id = data.id;
const link = SUBMISSION_DETAIL_URI_FACTORY(assignmentId, id);

switch (data.evaluationStatus) {
switch (data.lastSubmission.evaluationStatus) {
case 'done':
return (
<SuccessfulSubmissionTableRow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ import Points from './Points';
const SuccessfulSubmissionTableRow = ({
link,
note,
submittedAt,
lastSubmission: { evaluation: { score, points } },
maxPoints,
evaluation: { score, bonusPoints, points },
bonusPoints,
solution: { createdAt },
accepted
}) => (
}) =>
<tr>
<td>
<AssignmentStatusIcon id={link} status="done" accepted={accepted} />
</td>
<td>
<FormattedDate value={submittedAt * 1000} />
<FormattedDate value={createdAt * 1000} />
&nbsp;
<FormattedTime value={submittedAt * 1000} />
<FormattedTime value={createdAt * 1000} />
</td>
<td className="text-center">
<strong className="text-success">
Expand All @@ -53,17 +54,21 @@ const SuccessfulSubmissionTableRow = ({
/>
</Link>
</td>
</tr>
);
</tr>;

SuccessfulSubmissionTableRow.propTypes = {
link: PropTypes.string.isRequired,
submittedAt: PropTypes.number.isRequired,
note: PropTypes.string.isRequired,
maxPoints: PropTypes.number.isRequired,
evaluation: PropTypes.shape({
score: PropTypes.number.isRequired,
points: PropTypes.number.isRequired
bonusPoints: PropTypes.number.isRequired,
lastSubmission: PropTypes.shape({
evaluation: PropTypes.shape({
score: PropTypes.number.isRequired,
points: PropTypes.number.isRequired
})
}).isRequired,
solution: PropTypes.shape({
createdAt: PropTypes.number.isRequired
}).isRequired,
accepted: PropTypes.bool
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class SubmissionsTableContainer extends Component {

sortSubmissions(submissions) {
return submissions.sort((a, b) => {
var aTimestamp = a.get('data').get('submittedAt');
var bTimestamp = b.get('data').get('submittedAt');
var aTimestamp = a.getIn(['data', 'solution', 'createdAt']);
var bTimestamp = b.getIn(['data', 'solution', 'createdAt']);
return bTimestamp - aTimestamp;
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/redux/modules/groupResults.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export const additionalActionTypes = {
export const fetchBestSubmission = (userId, assignmentId) =>
createApiAction({
type: additionalActionTypes.BEST_SUBMISSION,
endpoint: `/exercise-assignments/${assignmentId}/users/${userId}/best-submission`,
endpoint: `/exercise-assignments/${assignmentId}/users/${userId}/best-solution`,
method: 'GET',
meta: { userId, assignmentId }
});

export const fetchBestSubmissions = assignmentId =>
createApiAction({
type: additionalActionTypes.BEST_SUBMISSION,
endpoint: `/exercise-assignments/${assignmentId}/best-submissions`,
endpoint: `/exercise-assignments/${assignmentId}/best-solutions`,
method: 'GET',
meta: { assignmentId }
});
Expand Down
4 changes: 2 additions & 2 deletions src/redux/modules/submissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ export const resubmitAllSubmissions = assignmentId =>
export const fetchUsersSubmissions = (userId, assignmentId) =>
actions.fetchMany({
type: additionalActionTypes.LOAD_USERS_SUBMISSIONS,
endpoint: `/exercise-assignments/${assignmentId}/users/${userId}/submissions`,
endpoint: `/exercise-assignments/${assignmentId}/users/${userId}/solutions`,
meta: {
assignmentId,
userId
}
});

export const downloadResultArchive = downloadHelper({
endpoint: id => `/submissions/${id}/download-result`,
endpoint: id => `/submissions/evaluation/${id}/download-result`,
fetch: fetchSubmissionIfNeeded,
actionType: additionalActionTypes.DOWNLOAD_RESULT_ARCHIVE,
fileNameSelector: (id, state) => `${id}.zip`,
Expand Down

0 comments on commit 11647ef

Please sign in to comment.