Skip to content

Commit

Permalink
sorting courses in dropdown (#167)
Browse files Browse the repository at this point in the history
* sorting courses in dropdown

* added to changelog

* fix order of entries
  • Loading branch information
ApoorvaDixit authored and genevievehelsel committed Nov 30, 2018
1 parent 0c9a08f commit 5dbeeb3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,7 @@ with the current date and the next changes should go under a **[Next]** header.
* Allow an admin to join any course. ([@genevievehelsel](https://github.com/genevievehelsel) in [#164](https://github.com/illinois/queue/pull/164))
* Updated API documentation. ([@genevievehelsel](https://github.com/genevievehelsel) in [#170](https://github.com/illinois/queue/pull/170))
* Fix readme typo and prettierignore. ([@genevievehelsel](https://github.com/genevievehelsel) in [#159](https://github.com/illinois/queue/pull/159))
* Sort courses in "Create a queue" panel. ([@ApoorvaDixit](https://github.com/ApoorvaDixit) in [#167](https://github.com/illinois/queue/pull/167))

## 22 October 2018

Expand Down
12 changes: 11 additions & 1 deletion src/components/NewQueue.js
Expand Up @@ -232,7 +232,17 @@ NewQueue.propTypes = {

const mapStateToProps = state => ({
user: state.user.user,
courses: mapObjectToArray(state.courses.courses),
courses: mapObjectToArray(state.courses.courses).sort((a, b) => {
const x = a.name.toLowerCase()
const y = b.name.toLowerCase()
if (x < y) {
return -1
}
if (x > y) {
return 1
}
return 0
}),
})

export default connect(
Expand Down

0 comments on commit 5dbeeb3

Please sign in to comment.