Skip to content

Commit

Permalink
Merge pull request #1179 from UoM-Podcast/f/sort-workflows
Browse files Browse the repository at this point in the history
fix #997, correct workflow ordering
  • Loading branch information
Arnei authored Oct 5, 2023
2 parents 54c1c31 + 9e4de4a commit fed8678
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/main/WorkflowSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ const WorkflowSelection : React.FC = () => {
const dispatch = useDispatch();

// Initialite redux states
const workflows = useSelector(selectWorkflows)
let workflows = useSelector(selectWorkflows)
// Need to make copy to handle undefined displayOrder values
workflows = [...workflows].sort((a, b) => {
return (b.displayOrder - a.displayOrder)
})

const finishState = useSelector(selectFinishState)
const pageNumber = useSelector(selectPageNumber)
const theme = useTheme()
Expand Down
4 changes: 1 addition & 3 deletions src/redux/videoSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,7 @@ const videoSlice = createSlice({
state.duration = action.payload.duration
state.title = action.payload.title
state.segments = parseSegments(action.payload.segments, action.payload.duration)
state.workflows = action.payload.workflows.sort((n1: { displayOrder: number; }, n2: { displayOrder: number; }) => {
return n1.displayOrder - n2.displayOrder;
});
state.workflows = action.payload.workflows
state.waveformImages = action.payload.waveformURIs ? action.payload.waveformURIs : state.waveformImages
state.originalThumbnails = state.tracks.map((track: Track) => { return {id: track.id, uri: track.thumbnailUri} })

Expand Down

0 comments on commit fed8678

Please sign in to comment.