Skip to content

Commit

Permalink
remove Best option since we don't grok it. (#948)
Browse files Browse the repository at this point in the history
  • Loading branch information
epugh committed Feb 7, 2024
1 parent fb4d3ab commit f17f367
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 103 deletions.
7 changes: 2 additions & 5 deletions app/assets/javascripts/components/diff/_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ <h3 class="modal-title">Compare Your Search Results</h3>
</div>
</div>

<div class="form-group">
<input type="radio" id="best" name="diffSelection" value="best" ng-model="ctrl.which">
<label for="best">Highest Rated</label>
</div>


<div class="form-group">
<input type="radio" id="disable" name="diffSelection" value="none" ng-model="ctrl.which">
Expand All @@ -69,6 +66,6 @@ <h3 class="modal-title">Compare Your Search Results</h3>
</button>

<div ng-show="ctrl.inProgress">
Fetching snapshot info, this may take a moment or two depending on the number of queries to fetch...
Fetching snapshot info, this may take a moment or two depending on the number of queries to run...
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ angular.module('QuepidApp')
});

// Init
if (initialSelection === 'best') {
ctrl.which = 'best';
} else if (initialSelection === null) {
if (initialSelection === null) {
ctrl.which = 'none';
}

Expand Down Expand Up @@ -113,9 +111,7 @@ angular.module('QuepidApp')
}

function ok() {
if (ctrl.which === 'best') {
$uibModalInstance.close('best');
} else if (ctrl.which === 'none') {
if (ctrl.which === 'none') {
$uibModalInstance.close(null);
} else {
ctrl.inProgress = true;
Expand All @@ -133,7 +129,6 @@ angular.module('QuepidApp')
}

function cancel() {
//$uibModalInstance.dismiss();
$uibModalInstance.dismiss('cancel');
}
}
Expand Down
66 changes: 0 additions & 66 deletions app/assets/javascripts/services/bestFetcherSvc.js

This file was deleted.

9 changes: 2 additions & 7 deletions app/assets/javascripts/services/diffResultsSvc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ angular.module('QuepidApp')
'$log',
'querySnapshotSvc',
'settingsSvc',
'bestFetcherSvc',
function diffResultsSvc(
$q,
$log,
querySnapshotSvc,
settingsSvc,
bestFetcherSvc
settingsSvc
) {

var diffSetting = null;
Expand Down Expand Up @@ -129,10 +127,7 @@ angular.module('QuepidApp')
var fetcher = nullFetcher;

if (diffSetting === null) {
query.diff = null;
} else if (diffSetting === 'best') {
fetcher = bestFetcherSvc.createBestFetcher(query.ratingsStore);
query.diff = new QueryDiffResults(query, fetcher, 'best');
query.diff = null;
} else {
var snapshot = querySnapshotSvc.snapshots[diffSetting];

Expand Down
4 changes: 2 additions & 2 deletions app/assets/javascripts/services/queryViewSvc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
angular.module('QuepidApp')
.service('queryViewSvc', [
function() {
this.enableDiff = function(idOrBest) {
this.diffSetting = idOrBest;
this.enableDiff = function(snapshotId) {
this.diffSetting = snapshotId;
};

this.isDiffEnabled = function() {
Expand Down
16 changes: 0 additions & 16 deletions spec/javascripts/angular/services/diffResultsSvc_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,4 @@ describe('Service: diffResultsSvc', function() {
});
});

it('fetches best docs', function() {
diffResultsSvc.setDiffSetting('best');
diffResultsSvc.createQueryDiff(fakeQuery);
expect(fakeQuery.diff.docs().length).toEqual(0);

fakeQuery.diff.fetch().then(function() {
expect(fakeQuery.diff.docs().length).toEqual(3);
var diffDocs = fakeQuery.diff.docs();
expect(diffDocs[0].id).toEqual(doc3.id);
expect(diffDocs[1].id).toEqual(doc2.id);
expect(diffDocs[2].id).toEqual(doc1.id);
});

$rootScope.$apply();
});

});

0 comments on commit f17f367

Please sign in to comment.