From 585e33720b43679cfb336b51e4d984e23088dd12 Mon Sep 17 00:00:00 2001 From: Ben Warzeski Date: Fri, 17 Sep 2021 17:02:55 -0400 Subject: [PATCH] update api to match docs --- src/App.jsx | 6 +- src/components/StatusBadge.jsx | 15 ++- src/containers/ListView/index.jsx | 17 +++- src/containers/ReviewModal/index.jsx | 9 +- src/data/reducers/app.js | 2 +- src/data/reducers/submissions.js | 99 ++++++++++++++----- src/data/services/lms/constants.js | 1 + src/data/services/lms/fakeData/course.js | 2 +- .../services/lms/fakeData/submissionFull.js | 66 ++++++++----- .../services/lms/fakeData/submissionList.js | 25 +++-- 10 files changed, 171 insertions(+), 71 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 5f46ab5..3204cae 100755 --- a/src/App.jsx +++ b/src/App.jsx @@ -29,15 +29,15 @@ const App = ({ courseMetadata }) => ( ); App.defaultProps = { courseMetadata: { - name: '', + title: '', number: null, org: '', }, }; App.propTypes = { courseMetadata: PropTypes.shape({ - name: PropTypes.string, - number: PropTypes.number, + title: PropTypes.string, + number: PropTypes.string, org: PropTypes.string, }), }; diff --git a/src/components/StatusBadge.jsx b/src/components/StatusBadge.jsx index 93171fa..aa252ca 100644 --- a/src/components/StatusBadge.jsx +++ b/src/components/StatusBadge.jsx @@ -9,16 +9,23 @@ import { gradingStatuses as statuses } from 'data/services/lms/constants'; * */ export const StatusBadge = ({ className, status }) => { + let args = { + label: status, + variant: 'light', + }; if (status === statuses.ungraded) { - return (Ungraded); + args = { label: 'Ungraded', variant: 'primary' }; } if (status === statuses.locked) { - return (Grading in progress); + args = { label: 'Grading in progress', variant: 'light' }; } if (status === statuses.graded) { - return (Grading Complete); + args = { label: 'Grading Complete', variant: 'success' }; } - return ({status}); + if (status === statuses.inProgress) { + args = { label: 'Locked by you', variant: 'warning' }; + } + return ({args.label}); }; StatusBadge.defaultProps = { className: '', diff --git a/src/containers/ListView/index.jsx b/src/containers/ListView/index.jsx index 1962cb8..083179b 100644 --- a/src/containers/ListView/index.jsx +++ b/src/containers/ListView/index.jsx @@ -30,9 +30,12 @@ export class ListView extends React.Component { return date.toLocaleString(); } - formatGrade = ({ value }) => ( - value === null ? '-' : value - ); + formatGrade = ({ value: grade }) => { + console.log({ grade }); + return ( + grade === null ? '-' : `${grade.pointsEarned}/${grade.pointsPossible}` + ); + } formatStatus = ({ value }) => (); @@ -49,6 +52,9 @@ export class ListView extends React.Component { render() { console.log({ props: this.props, length: this.props.listData.length }); + if (this.props.listData.length === 0) { + return null; + } return (
: { + * submissionId: '', + * username: '' + * teamName: '' + * dateSubmitted: 0, + * status: '' + * grade: { + * pointsEarned: 0, + * pointsPossible: 0, + * } + * } + */ + }, + selected: [ + /** + * { + * submissionId: '', + * username: '' + * teamName: '' + * dateSubmitted: 0, + * status: '', + * } + */ + ], activeIndex: null, // submissionId current: { - submissionId: null, - response: { - text: '', - files: [], - }, - rubric: { - name: '', - commentRequirement: 'optional', - criteria: [ - { - name: '', - description: '', - points: 0, - commentRequirement: 'optional', - }, - ], - }, - rubricData: { - }, - grade: null, - status: null, + /** + * staticData: { + * submissionId: '', + * username: '' + * teamName: '' + * dateSubmitted: 0, + * status: '' + * rubricConfig: { + * feedback: '', + * criteria: [{ + * name: '', + * orderNum: 0, + * prompt: '', + * feedback: '', + * options: [{ + * orderNum: 0, + * name: '', + * label: '', + * explanation: '', + * points: 0, + * }] + * }], + * }, + * } + * gradeData: { + * score: { + * pointsEarned: 0, + * pointsPossible: 0, + * } + * overallFeedback: '', + * criteria: [{ + * name: '', + * feedback: '', + * score: 0, + * selectedOption: '', + * }], + * } + * response: { + * text: '', + * files: [{ + * download_url: '', + * description: '', + * name: '', + * }], + * }, + */ }, - prev: null, - next: null, + prev: null, // { staticData, response } + next: null, // { staticData, response } }; // eslint-disable-next-line no-unused-vars diff --git a/src/data/services/lms/constants.js b/src/data/services/lms/constants.js index d806f48..2d05fa5 100644 --- a/src/data/services/lms/constants.js +++ b/src/data/services/lms/constants.js @@ -4,4 +4,5 @@ export const gradingStatuses = StrictDict({ ungraded: 'ungraded', graded: 'graded', locked: 'locked', + inProgress: 'in-progress', }); diff --git a/src/data/services/lms/fakeData/course.js b/src/data/services/lms/fakeData/course.js index 55643c0..28b2b00 100644 --- a/src/data/services/lms/fakeData/course.js +++ b/src/data/services/lms/fakeData/course.js @@ -1,5 +1,5 @@ export const org = 'AuroraU'; -export const number = 101; +export const number = '101'; export const title = 'Time Travel 101'; export default { org, number, title }; diff --git a/src/data/services/lms/fakeData/submissionFull.js b/src/data/services/lms/fakeData/submissionFull.js index 6759c56..388bfee 100644 --- a/src/data/services/lms/fakeData/submissionFull.js +++ b/src/data/services/lms/fakeData/submissionFull.js @@ -6,37 +6,53 @@ Phasellus tempor eros aliquam ipsum molestie, vitae varius lectus tempus. Morbi Phasellus porttitor vel magna et auctor. Nulla porttitor convallis aliquam. Donec cursus, ipsum ut egestas bibendum, purus metus dignissim est, ac condimentum leo felis eget diam. In magna mi, tincidunt id sapien id, fermentum vestibulum quam. Quisque et dui sed urna convallis rutrum pellentesque quis sapien. Cras non lectus velit. Praesent semper eros id risus mollis, quis interdum quam imperdiet. Sed nec vulputate tortor, at tristique tortor.
`; -const rubric = { - name: 'Rubric name', +const rubricConfig = { comments: 'rubric-level comments', criteria: [ { - name: 'Poor', - description: 'Includes little information with few or no details or unrelated details. Unsuccessful in attempts to explore any facets of the topic.', - points: 0, - comments: 'criterion 0 comments', - }, - { - name: 'Fair', - description: 'Includes little information and few or no details. Explores only one or two facets of the topic.', - points: 1, - comments: 'criterion 1 comments', - }, - { - name: 'Poor', - description: 'Includes sufficient information and supporting details. (Details may not be fully developed; ideas may be listed.) Explores some facets of the topic.', - points: 2, - comments: 'criterion 2 comments', - }, - { - name: 'Excellent', - description: 'Includes in-depth information and exceptional supportint details that are fully developed. Explores all facets of the topic', - points: 3, - comments: 'criterion 3 comments', + name: 'First Criterion', + orderNum: 0, + prompt: 'A criterion prompt', + feedback: 'optional', + options: [ + { + orderNum: 0, + name: 'poor', + label: 'Poor', + explanation: 'Includes little information with few or no details or unrelated details. Unsuccessful in attempts to explore any facets of the topic.', + points: 0, + feedback: 'optional', + }, + { + orderNum: 1, + name: 'fair', + prompt: 'Fair', + explanation: 'Includes little information and few or no details. Explores only one or two facets of the topic.', + points: 1, + feedback: 'optional', + }, + { + orderNum: 2, + name: 'good', + prompt: 'Good', + explanation: 'Includes sufficient information and supporting details. (Details may not be fully developed; ideas may be listed.) Explores some facets of the topic.', + points: 2, + feedback: 'optional', + }, + { + orderNum: 3, + name: 'excellent', + prompt: 'Excellent', + explanation: 'Includes in-depth information and exceptional supportint details that are fully developed. Explores all facets of the topic', + points: 3, + feedback: 'optional', + }, + ], }, ], }; +// eslint-disable-next-line export const mockSubmission = (submissionId) => ({ response: { text: responseText, @@ -44,5 +60,5 @@ export const mockSubmission = (submissionId) => ({ }, status: submissionList[submissionId].status, grade: submissionList[submissionId].grade, - rubric, + rubricConfig, }); diff --git a/src/data/services/lms/fakeData/submissionList.js b/src/data/services/lms/fakeData/submissionList.js index 7b5e304..7414ee9 100644 --- a/src/data/services/lms/fakeData/submissionList.js +++ b/src/data/services/lms/fakeData/submissionList.js @@ -5,9 +5,13 @@ import { gradingStatuses as statuses } from '../constants'; * Response entries, with identifier. * { * id: {string} - * learnerId: {string} + * submissionId: {string} + * username: {string} (optional) * dateSubmitted: {number} - * grade: {number} + * grade: { + * pointsPossible: {number} + * pointsEarned: {number} + * } * status: {string} * } */ @@ -22,11 +26,10 @@ const createSubmission = (grade, status) => { const index = lastIndex; lastIndex += 1; const submissionId = ids.submissionId(index); - const learnerId = ids.learnerId(index); submissions[submissionId] = { submissionId, username: ids.username(index), - learnerId, + // teamName: '', dateSubmitted: date0 + (day * index), status, grade, @@ -35,8 +38,18 @@ const createSubmission = (grade, status) => { for (let i = 0; i < 20; i++) { createSubmission(null, statuses.ungraded); - createSubmission(70 + i, statuses.locked); - createSubmission(80 + i, statuses.graded); + createSubmission( + { pointsEarned: 70 + i, pointsPossible: 100 }, + statuses.locked, + ); + createSubmission( + { pointsEarned: 80 + i, pointsPossible: 100 }, + statuses.graded, + ); + createSubmission( + null, + statuses.inProgress, + ); } export default submissions;