Skip to content

Commit

Permalink
feat(projects): order by customer_name & id
Browse files Browse the repository at this point in the history
  • Loading branch information
Ephigenia committed Mar 26, 2018
1 parent f380878 commit 59103c3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/mite-projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const BUDGET_TYPE = formater.BUDGET_TYPE;
const SORT_OPTIONS = [
'id',
'name',
'customer',
'customer_name',
'customer_id',
'updated_at',
'created_at',
];
Expand Down Expand Up @@ -82,7 +84,10 @@ mite[method](opts, (err, responseData) => {
.map((e) => e.project)
.sort((a, b) => {
if (!program.sort) return 0;
const sortByAttributeName = program.sort;
let sortByAttributeName = program.sort;
if (sortByAttributeName === 'customer') {
sortByAttributeName = 'customer_name';
}
var val1 = String(a[sortByAttributeName]).toLowerCase();
var val2 = String(b[sortByAttributeName]).toLowerCase();
if (val1 > val2) {
Expand Down

0 comments on commit 59103c3

Please sign in to comment.