Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix(search): get min age_at_diagnosis
Browse files Browse the repository at this point in the history
 - fix issue where NaN was being displayed in table

Closes #911
  • Loading branch information
alex-wilmer committed Mar 31, 2016
1 parent 657e11c commit 0e7870a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/scripts/components/tables/tableicious.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module ngApp.components.tables.directives.tableicious {
refresh(n);
}, true);

$scope.headings = $scope.saved.length ?
$scope.headings = $scope.saved.length ?
_.map($scope.saved, (s: IHeading): IHeading => _.merge(_.find($scope.headings, {id: s.id}), s)) :
$scope.headings;

Expand Down
3 changes: 2 additions & 1 deletion app/scripts/components/tables/tables.controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ module ngApp.components.tables.controllers {
} else {
this.displayedData = this.$scope.data;
}
if (this.$scope.paging)
if (this.$scope.paging) {
this.$scope.paging.count = this.displayedData && this.displayedData.length;
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion app/scripts/search/search.participants.table.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@ module ngApp.search.models {
}, {
name: 'Age at diagnosis',
id: 'diagnoses.age_at_diagnosis',
td: (row, $scope) => (row.diagnoses && $scope.$filter("ageDisplay")(row.diagnoses.age_at_diagnosis)) || "--",
td: (row, $scope) => {
// Use diagnosis with minimum age
const age = row.diagnoses.reduce((p, c) => c.age_at_diagnosis < p ? c.age_at_diagnosis : p, Infinity);
return (row.diagnoses && $scope.$filter("ageDisplay")(age)) || "--"
},
sortable: false,
hidden: true
}, {
Expand Down

0 comments on commit 0e7870a

Please sign in to comment.