Skip to content

Commit 7951970

Browse files
committed
Allow specify hour/minute/second when fetching review history
1 parent 2412af1 commit 7951970

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

app/scripts/controllers/tools.js

+16-5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ angular.module('oncokbApp')
1414
$scope.typeCheckboxes = ['update', 'name change', 'add', 'delete'];
1515
$scope.selectedTypeCheckboxes = [];
1616
$scope.dateRange = {startDate: null, endDate: null};
17+
$scope.dateRangeStartDateStr = null;
18+
$scope.dateRangeEndDateStr = null;
1719
$scope.dateRangeOptions = {
1820
ranges: {
1921
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
@@ -33,6 +35,7 @@ angular.module('oncokbApp')
3335
});
3436
};
3537
var sorting = [[2, 'desc'], [1, 'asc'], [0, 'asc']];
38+
var dateRangeFormat = 'YYYY-MM-DD HH:mm:ss ZZ';
3639

3740
$scope.dtOptions = DTOptionsBuilder
3841
.newOptions()
@@ -46,6 +49,15 @@ angular.module('oncokbApp')
4649
DTColumnDefBuilder.newColumnDef(2).withOption('sType', 'date'),
4750
DTColumnDefBuilder.newColumnDef(3)
4851
];
52+
53+
$scope.$watch('dateRange', function (n) {
54+
if(n.startDate){
55+
$scope.dateRangeStartDateStr = n.startDate.format(dateRangeFormat);
56+
}
57+
if(n.endDate){
58+
$scope.dateRangeEndDateStr = n.endDate.format(dateRangeFormat);
59+
}
60+
});
4961
$scope.$watch('ugtData.gene', function (n) {
5062
if($scope.ugtData.firebaseGeneUnbind) {
5163
$scope.ugtData.firebaseGeneUnbind();
@@ -142,7 +154,7 @@ angular.module('oncokbApp')
142154
$scope.searchHistory = function(genesForHistory) {
143155
$scope.errorMessage = '';
144156
$scope.historySearchResults = [];
145-
if ((!$scope.dateRange.startDate || !$scope.dateRange.endDate) &&
157+
if ((!$scope.dateRangeStartDateStr || !$scope.dateRange.dateRangeEndDateStr) &&
146158
(!_.isArray($scope.genesForHistory) || $scope.genesForHistory.length === 0) &&
147159
$scope.selectedTypeCheckboxes.length === 0) {
148160
$scope.errorMessage = 'Please choose conditions from Gene, Date or Type.';
@@ -152,11 +164,10 @@ angular.module('oncokbApp')
152164
var startTimestamp = 0;
153165
var endTimestamp = 0;
154166
var hasDateRange = false;
155-
if ($scope.dateRange.startDate && $scope.dateRange.endDate) {
167+
if ($scope.dateRangeStartDateStr && $scope.dateRangeEndDateStr) {
156168
hasDateRange = true;
157-
startTimestamp = new Date($scope.dateRange.startDate.format('YYYY-MM-DD')).getTime();
158-
var endDate = moment($scope.dateRange.endDate).add(1, 'days');
159-
endTimestamp = new Date(endDate.format('YYYY-MM-DD')).getTime();
169+
startTimestamp = new Date($scope.dateRangeStartDateStr).getTime();
170+
endTimestamp = new Date($scope.dateRangeEndDateStr).getTime();
160171
}
161172
loadFiles.load('history').then(function(success) {
162173
var historyResults = [];

app/views/tools.html

+11-1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,16 @@ <h3>Review History</h3>
106106
<span id='close' class="cancel-icon" ng-click="clearDateRange()">x</span>
107107
</div>
108108
</div>
109+
<div class="row row-margin">
110+
<div class="col-sm-1" style="white-space: nowrap">Start Date:</div>
111+
<div class="col-sm-3">
112+
<input id="reviewHistoryStartDate" type="text" class="form-control" ng-model="dateRangeStartDateStr"/>
113+
</div>
114+
<div class="col-sm-1" style="white-space: nowrap">End Date:</div>
115+
<div class="col-sm-3">
116+
<input id="reviewHistoryEndDate" type="text" class="form-control" ng-model="dateRangeEndDateStr"/>
117+
</div>
118+
</div>
109119
<div class="row last-row-margin">
110120
<div class="col-sm-1">Type:</div>
111121
<div class="col-sm-6">
@@ -137,7 +147,7 @@ <h3>Review History</h3>
137147
<tr ng-repeat="x in historySearchResults">
138148
<td><strong><a href="#!/gene/{{x.gene}}">{{ x.gene }}</a></strong></td>
139149
<td>{{x.admin}}</td>
140-
<td>{{x.timeStamp | date : 'MMM d, h:mm a yyyy'}}</td>
150+
<td>{{x.timeStamp | date : 'yyyy-MM-dd HH:mm:ss Z'}}</td>
141151
<td class="records-width">
142152
<ul class="list-group">
143153
<li class="list-group-item" ng-repeat="y in x.records track by $index">

0 commit comments

Comments
 (0)