Skip to content

Commit

Permalink
refactor: display only changed subsection and units in publish modal
Browse files Browse the repository at this point in the history
  • Loading branch information
navinkarkera committed Dec 5, 2023
1 parent 5dda7bf commit 8734daa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/course-outline/publish-modal/PublishModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const PublishModal = ({
</ModalDialog.Header>
<ModalDialog.Body>
<p className="small">{intl.formatMessage(messages.description)}</p>
{subSections.map((subSection) => {
const units = subSection.childInfo.children;
{subSections.filter(subSection => subSection.hasChanges).map((subSection) => {
const units = subSection.childInfo.children.filter(unit => unit.hasChanges);

return units.length ? (
<React.Fragment key={subSection.id}>
Expand Down
4 changes: 4 additions & 0 deletions src/course-outline/publish-modal/PublishModal.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,29 @@ const currentSectionMock = {
{
displayName: 'Subsection 1',
id: 1,
hasChanges: true,
childInfo: {
displayName: 'Unit',
children: [
{
id: 11,
displayName: 'Subsection_1 Unit 1',
hasChanges: true,
},
],
},
},
{
displayName: 'Subsection 2',
id: 2,
hasChanges: true,
childInfo: {
displayName: 'Unit',
children: [
{
id: 21,
displayName: 'Subsection_2 Unit 1',
hasChanges: true,
},
],
},
Expand Down

0 comments on commit 8734daa

Please sign in to comment.