-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: open response assesment detail (problem steps) UI #263
Changes from all commits
0788611
14851b5
0a728e1
4242939
e23dc31
2d2f88b
3852a24
375a6e8
87dd3ca
b374c4d
5cd90d4
e43acc2
5c98341
df3423d
949a9e8
35250c1
06c5635
c6f1933
527d69b
24d6df0
7ff03ef
4c16376
6e41dee
f19f7c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,15 @@ import { | |
DataTable, | ||
TextFilter, | ||
MultiSelectDropdownFilter, | ||
Button, | ||
Hyperlink, | ||
} from '@openedx/paragon'; | ||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; | ||
|
||
import { gradingStatuses, submissionFields } from 'data/services/lms/constants'; | ||
import lmsMessages from 'data/services/lms/messages'; | ||
|
||
import { selectors, thunkActions } from 'data/redux'; | ||
import { selectors, thunkActions, actions } from 'data/redux'; | ||
|
||
import StatusBadge from 'components/StatusBadge'; | ||
import FilterStatusComponent from './FilterStatusComponent'; | ||
|
@@ -22,19 +24,27 @@ import SelectedBulkAction from './SelectedBulkAction'; | |
|
||
import messages from './messages'; | ||
|
||
const problemSteps = { | ||
problemStepsTraining: true, | ||
problemStepsPeers: false, | ||
problemStepsSelf: true, | ||
problemStepsStaff: true, | ||
}; | ||
/** | ||
* <SubmissionsTable /> | ||
*/ | ||
export class SubmissionsTable extends React.Component { | ||
get gradeStatusOptions() { | ||
return Object.keys(gradingStatuses).map(statusKey => ({ | ||
return Object.keys(gradingStatuses).map((statusKey) => ({ | ||
name: this.translate(lmsMessages[gradingStatuses[statusKey]]), | ||
value: gradingStatuses[statusKey], | ||
})); | ||
} | ||
|
||
get userLabel() { | ||
return this.translate(this.props.isIndividual ? messages.username : messages.teamName); | ||
return this.translate( | ||
this.props.isIndividual ? messages.username : messages.teamName, | ||
); | ||
} | ||
|
||
get userAccessor() { | ||
|
@@ -54,11 +64,56 @@ export class SubmissionsTable extends React.Component { | |
return date.toLocaleString(); | ||
}; | ||
|
||
formatGrade = ({ value: score }) => ( | ||
score === null ? '-' : `${score.pointsEarned}/${score.pointsPossible}` | ||
formatGrade = ({ value: score }) => (score === null ? '-' : `${score.pointsEarned}/${score.pointsPossible}`); | ||
|
||
formatStatus = ({ value }) => <StatusBadge status={value} />; | ||
|
||
formatProblemStepsStatus = () => { | ||
const stepProblems = Object.keys(problemSteps); | ||
return ( | ||
<div> | ||
{stepProblems.map((stepProblem) => ( | ||
<Button | ||
variant="tertiary" | ||
className="step-problems-button-badge" | ||
key={stepProblem} | ||
> | ||
<StatusBadge | ||
status={problemSteps[stepProblem] ? 'graded' : 'ungraded'} | ||
title={this.translate(messages[stepProblem])} | ||
/> | ||
</Button> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
handleProblemStepsDetailClick = (data, currentRow) => { | ||
const submissionUUIDs = data.map((row) => row.submissionUUID); | ||
const submissionId = currentRow.original.submissionUUID; | ||
const currentRowIndex = submissionUUIDs.indexOf(submissionId); | ||
this.props.loadSelectionForReview(submissionUUIDs, false, submissionId); | ||
this.props.setActiveSubmissionIndex(currentRowIndex); | ||
this.props.setProblemStepsModal(true); | ||
}; | ||
|
||
problemStepsViewDetails = ({ data, row: currentRow }) => ( | ||
<Button | ||
variant="link" | ||
className="btn-view-details" | ||
data-testid="button-view-details" | ||
size="sm" | ||
onClick={() => this.handleProblemStepsDetailClick(data, currentRow)} | ||
> | ||
{this.translate(messages.actionDetail)} | ||
</Button> | ||
); | ||
|
||
formatStatus = ({ value }) => (<StatusBadge status={value} />); | ||
emailAddressCell = ({ value }) => ( | ||
<Hyperlink destination="#" showLaunchIcon={false}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is the destination "#"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because it's a link but won't redirect to any destination There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh! Thank you |
||
{value} | ||
</Hyperlink> | ||
); | ||
|
||
translate = (...args) => this.props.intl.formatMessage(...args); | ||
|
||
|
@@ -95,6 +150,18 @@ export class SubmissionsTable extends React.Component { | |
{ | ||
Header: this.userLabel, | ||
accessor: this.userAccessor, | ||
filter: false, | ||
}, | ||
{ | ||
Header: this.translate(messages.learnerFullname), | ||
accessor: submissionFields.fullname, | ||
disableFilters: true, | ||
}, | ||
{ | ||
Header: this.translate(messages.emailLabel), | ||
accessor: submissionFields.email, | ||
Cell: this.emailAddressCell, | ||
disableFilters: true, | ||
}, | ||
{ | ||
Header: this.dateSubmittedLabel, | ||
|
@@ -116,6 +183,17 @@ export class SubmissionsTable extends React.Component { | |
filter: 'includesValue', | ||
filterChoices: this.gradeStatusOptions, | ||
}, | ||
{ | ||
Header: this.translate(messages.problemSteps), | ||
Cell: this.formatProblemStepsStatus, | ||
}, | ||
]} | ||
additionalColumns={[ | ||
{ | ||
id: 'action', | ||
Header: this.translate(messages.action), | ||
Cell: this.problemStepsViewDetails, | ||
}, | ||
]} | ||
> | ||
<DataTable.TableControlBar /> | ||
|
@@ -144,6 +222,8 @@ SubmissionsTable.propTypes = { | |
}), | ||
})), | ||
loadSelectionForReview: PropTypes.func.isRequired, | ||
setProblemStepsModal: PropTypes.func.isRequired, | ||
setActiveSubmissionIndex: PropTypes.func.isRequired, | ||
}; | ||
|
||
export const mapStateToProps = (state) => ({ | ||
|
@@ -153,6 +233,8 @@ export const mapStateToProps = (state) => ({ | |
|
||
export const mapDispatchToProps = { | ||
loadSelectionForReview: thunkActions.grading.loadSelectionForReview, | ||
setProblemStepsModal: actions.problemSteps.setOpenReviewModal, | ||
setActiveSubmissionIndex: actions.grading.setActiveIndex, | ||
}; | ||
|
||
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(SubmissionsTable)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good! Thanks