Fix proceed to use filtered summaries

This commit is contained in:
Buck Doyle 2020-11-09 15:00:58 -06:00
parent 1cfbac5483
commit 7ed1f4dda8
2 changed files with 49 additions and 2 deletions

View File

@ -158,8 +158,8 @@ export default class OptimizeController extends Controller {
// This is a task because the accordion uses timeouts for animation
// eslint-disable-next-line require-yield
@(task(function*() {
const currentSummaryIndex = this.model.indexOf(this.activeRecommendationSummary);
const nextSummary = this.model.objectAt(currentSummaryIndex + 1);
const currentSummaryIndex = this.filteredSummaries.indexOf(this.activeRecommendationSummary);
const nextSummary = this.filteredSummaries.objectAt(currentSummaryIndex + 1);
if (nextSummary) {
this.transitionToSummary(nextSummary);

View File

@ -413,6 +413,53 @@ module('Acceptance | optimize search and facets', function(hooks) {
assert.equal(Optimize.empty.headline, 'No Matches');
});
test('processing a summary moves to the next one in the sorted list', async function(assert) {
server.createList('job', 1, {
name: 'ooo111',
createRecommendations: true,
groupsCount: 1,
groupTaskCount: 4,
});
server.createList('job', 1, {
name: 'pppppp',
createRecommendations: true,
groupsCount: 1,
groupTaskCount: 4,
});
server.createList('job', 1, {
name: 'ooo222',
createRecommendations: true,
groupsCount: 1,
groupTaskCount: 4,
});
// Directly set the sorting of the above jobss summaries in the table
const futureSubmitTime = (Date.now() + 10000) * 1000000;
const nowSubmitTime = Date.now() * 1000000;
const pastSubmitTime = (Date.now() - 10000) * 1000000;
const jobNameToRecommendationSubmitTime = {
ooo111: futureSubmitTime,
pppppp: nowSubmitTime,
ooo222: pastSubmitTime,
};
server.schema.recommendations.all().models.forEach(recommendation => {
const parentJob = recommendation.task.taskGroup.job;
const submitTimeForJob = jobNameToRecommendationSubmitTime[parentJob.name];
recommendation.submitTime = submitTimeForJob;
recommendation.save();
});
await Optimize.visit();
await Optimize.search.fillIn('ooo');
await Optimize.card.acceptButton.click();
assert.equal(Optimize.card.slug.jobName, 'ooo222');
});
test('the optimize page has appropriate faceted search options', async function(assert) {
server.createList('job', 4, {
status: 'running',