Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds data tables to more course visualizations #7946

Merged
merged 43 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
00bd5c6
completely redefines course/vocab viz as bar chart and adds data tabl…
stopfstedt Jul 9, 2024
e380cdd
adds data table and updates graph formula.
stopfstedt Jul 11, 2024
8d71cc6
rework stylesheets to center graphs on course viz overview page.
stopfstedt Jul 15, 2024
fad8a2d
render session types graph as bar chart in the overview.
stopfstedt Jul 17, 2024
73a1ca4
replaces resource with tracked async data.
stopfstedt Jul 17, 2024
e4274a9
filter out zero mins session types before graphing, and slightly rewo…
stopfstedt Jul 17, 2024
9198538
adds data table to course session type chart.
stopfstedt Jul 17, 2024
506c167
adds data table to course vocab term viz.
stopfstedt Jul 17, 2024
070b60d
resources are out, tracked-async-data is in.
stopfstedt Jul 17, 2024
af412e7
this graph is always a bar chart now.
stopfstedt Jul 17, 2024
bd768d5
redo tooltip contents and graph bar labels.
stopfstedt Jul 17, 2024
24d0dfc
clean-up/simplify filteredData() getter.
stopfstedt Jul 17, 2024
c8c08ea
adds data table.
stopfstedt Jul 17, 2024
0824ac5
fixes regression in click-through handler.
stopfstedt Jul 17, 2024
01a0fa8
only show chart if filtered data list is not empty.
stopfstedt Jul 17, 2024
1212caf
wait for data to load before rendering data tables.
stopfstedt Jul 17, 2024
1e50e6d
fixate height of charts in course viz.
stopfstedt Jul 18, 2024
ccd8434
corrects markup indentation in template.
stopfstedt Jul 18, 2024
21c5d8d
replaces resource with tracked async data.
stopfstedt Jul 18, 2024
b5e74aa
prevent graph rendering before data is fully loaded.
stopfstedt Jul 18, 2024
e4e7576
adds data table.
stopfstedt Jul 18, 2024
6d59705
realigns preview with detail-view of graph.
stopfstedt Jul 18, 2024
7c5f0ad
filter out instructors without instructional time.
stopfstedt Jul 18, 2024
7949cd7
filter out session types without instructional time.
stopfstedt Jul 19, 2024
bc4f24d
cleanup: replace Resources with TrackedAsyncData and tighten up gette…
stopfstedt Jul 22, 2024
549ea45
adds data tables to course instructor viz.
stopfstedt Jul 22, 2024
0e195a9
rm kruft.
stopfstedt Jul 22, 2024
b7d580c
code cleanup and html safety.
stopfstedt Jul 23, 2024
141fade
DRY: put graph with data tables styles into mixin.
stopfstedt Jul 23, 2024
18b7164
mv viz tests acceptance tests into course namespace.
stopfstedt Jul 24, 2024
32bff2d
adds descriptions to chart segments, update component test coverage w…
stopfstedt Jul 25, 2024
0ea808e
update acceptance tests for course viz.
stopfstedt Jul 25, 2024
a3c6991
fix up viz course objectives component test.
stopfstedt Jul 26, 2024
b60815a
adds "no data" message to course/session-type viz.
stopfstedt Jul 26, 2024
55f6a1c
list linked zero instructional time in datatable.
stopfstedt Jul 26, 2024
e1601e3
rm spinner from objectives graph.
stopfstedt Aug 14, 2024
61635d9
display instructor graphs side-by-side on larger screens.
stopfstedt Aug 14, 2024
596502a
reverts presentation back from bars to donut.
stopfstedt Aug 15, 2024
81ccbad
shorten table header to make it fit in its box.
stopfstedt Aug 15, 2024
da07656
regression-fix: squeeze the space out of objectives in table.
stopfstedt Aug 15, 2024
4056735
corrects css linting error.
stopfstedt Aug 19, 2024
ade62a5
rm unnecessary slicing of ember-data collections into arrays.
stopfstedt Aug 19, 2024
1af7733
fix up acceptance test.
stopfstedt Aug 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module('Acceptance | course visualizations - instructor', function (hooks) {
});

test('it renders', async function (assert) {
assert.expect(21);
assert.expect(26);
const instructor = this.server.create('user');
const vocabulary1 = this.server.create('vocabulary');
const vocabulary2 = this.server.create('vocabulary');
Expand Down Expand Up @@ -78,24 +78,27 @@ module('Acceptance | course visualizations - instructor', function (hooks) {
// wait for charts to load
await waitFor('.loaded', { count: 2 });
await waitFor('svg .bars');
await waitFor('svg .chart');
await waitFor('svg .slice');
await percySnapshot(assert);
assert.strictEqual(page.root.termsChart.chart.bars.length, 3);
assert.strictEqual(page.root.termsChart.chart.labels.length, 3);
assert.strictEqual(page.root.termsChart.chart.labels[0].text, 'Vocabulary 1 - term 0');
assert.strictEqual(page.root.termsChart.chart.labels[1].text, 'Vocabulary 1 - term 1');
assert.strictEqual(page.root.termsChart.chart.labels[2].text, 'Vocabulary 2 - term 2');
assert.strictEqual(page.root.sessionTypesChart.chart.slices.length, 2);
assert.strictEqual(page.root.sessionTypesChart.chart.labels.length, 2);
assert.strictEqual(page.root.sessionTypesChart.chart.descriptions.length, 2);
assert.strictEqual(page.root.sessionTypesChart.chart.labels[0].text, 'session type 1');
assert.strictEqual(page.root.sessionTypesChart.chart.labels[1].text, 'session type 0');

assert.strictEqual(
page.root.termsChart.chart.labels[0].text,
'Vocabulary 1 > term 0: 60 Minutes',
);
assert.strictEqual(
page.root.termsChart.chart.labels[1].text,
'Vocabulary 1 > term 1: 30 Minutes',
page.root.sessionTypesChart.chart.descriptions[0].text,
'session type 1 - 30 Minutes',
);
assert.strictEqual(
page.root.termsChart.chart.labels[2].text,
'Vocabulary 2 > term 2: 30 Minutes',
page.root.sessionTypesChart.chart.descriptions[1].text,
'session type 0 - 60 Minutes',
);
assert.strictEqual(page.root.sessionTypesChart.chart.slices.length, 2);
assert.strictEqual(page.root.sessionTypesChart.chart.slices[0].text, 'session type 0 66.7%');
assert.strictEqual(page.root.sessionTypesChart.chart.slices[1].text, 'session type 1 33.3%');
assert.strictEqual(page.root.sessionTypesChart.dataTable.rows.length, 2);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module('Acceptance | course visualizations - instructors', function (hooks) {
});

test('it renders', async function (assert) {
assert.expect(12);
assert.expect(15);
await page.visit({ courseId: this.course.id });
assert.strictEqual(currentURL(), '/data/courses/1/instructors');
assert.strictEqual(page.root.title, 'course 0 2022');
Expand All @@ -80,15 +80,18 @@ module('Acceptance | course visualizations - instructors', function (hooks) {
await waitFor('svg .bars');
await percySnapshot(assert);
assert.strictEqual(page.root.instructorsChart.chart.bars.length, 2);
assert.strictEqual(page.root.instructorsChart.chart.labels.length, 2);
assert.strictEqual(
page.root.instructorsChart.chart.labels[0].text,
'1 guy M. Mc1son: 75 Minutes',
page.root.instructorsChart.chart.bars[0].description,
'1 guy M. Mc1son - 75 Minutes',
);
assert.strictEqual(
page.root.instructorsChart.chart.labels[1].text,
'2 guy M. Mc2son: 90 Minutes',
page.root.instructorsChart.chart.bars[1].description,
'2 guy M. Mc2son - 90 Minutes',
);
assert.strictEqual(page.root.instructorsChart.chart.labels.length, 2);
assert.strictEqual(page.root.instructorsChart.chart.labels[0].text, '1 guy M. Mc1son');
assert.strictEqual(page.root.instructorsChart.chart.labels[1].text, '2 guy M. Mc2son');
assert.strictEqual(page.root.instructorsChart.dataTable.rows.length, 2);
});

test('clicking chart transitions user to instructor visualization', async function (assert) {
Expand All @@ -98,10 +101,7 @@ module('Acceptance | course visualizations - instructors', function (hooks) {
// wait for charts to load
await waitFor('.loaded');
await waitFor('svg .bars');
assert.strictEqual(
page.root.instructorsChart.chart.labels[0].text,
'1 guy M. Mc1son: 75 Minutes',
);
assert.strictEqual(page.root.instructorsChart.chart.labels[0].text, '1 guy M. Mc1son');
await page.root.instructorsChart.chart.bars[0].click();
assert.strictEqual(currentURL(), '/data/courses/1/instructors/2');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module('Acceptance | course visualizations - objectives', function (hooks) {
});

test('it renders', async function (assert) {
assert.expect(14);
assert.expect(17);
const school = this.server.create('school');
const course = this.server.create('course', { year: 2021, school });
const courseObjectives = this.server.createList('course-objective', 3, {
Expand Down Expand Up @@ -72,13 +72,22 @@ module('Acceptance | course visualizations - objectives', function (hooks) {
await waitFor('svg .chart');
await percySnapshot(assert);
assert.strictEqual(page.root.objectivesChart.chart.slices.length, 2);
assert.strictEqual(page.root.objectivesChart.chart.slices[0].text, '77.8%');
assert.strictEqual(page.root.objectivesChart.chart.slices[1].text, '22.2%');
assert.strictEqual(page.root.objectivesChart.chart.slices[0].label, '77.8%');
assert.strictEqual(
page.root.objectivesChart.chart.slices[0].description,
'course objective 0 - 630 Minutes',
);
assert.strictEqual(page.root.objectivesChart.chart.slices[1].label, '22.2%');
assert.strictEqual(
page.root.objectivesChart.chart.slices[1].description,
'course objective 1 - 180 Minutes',
);
assert.notOk(page.root.objectivesChart.unlinkedObjectives.isPresent);
assert.strictEqual(page.root.objectivesChart.untaughtObjectives.items.length, 1);
assert.strictEqual(
page.root.objectivesChart.untaughtObjectives.items[0].text,
'course objective 2',
);
assert.strictEqual(page.root.objectivesChart.dataTable.rows.length, 3);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module('Acceptance | course visualizations - session-type', function (hooks) {
});

test('it renders', async function (assert) {
assert.expect(16);
assert.expect(19);
const sessionType = this.server.create('session-type');
const vocabulary1 = this.server.create('vocabulary');
const vocabulary2 = this.server.create('vocabulary');
Expand Down Expand Up @@ -70,18 +70,21 @@ module('Acceptance | course visualizations - session-type', function (hooks) {
await percySnapshot(assert);
assert.strictEqual(page.root.title, 'course 0 2022');
assert.strictEqual(page.root.sessionTypeChart.chart.bars.length, 3);
assert.strictEqual(page.root.sessionTypeChart.chart.labels.length, 3);
assert.strictEqual(
page.root.sessionTypeChart.chart.labels[0].text,
'Vocabulary 1 - term 1: 30 Minutes',
page.root.sessionTypeChart.chart.bars[0].description,
'Vocabulary 1 - term 1 - 30 Minutes',
);
assert.strictEqual(
page.root.sessionTypeChart.chart.labels[1].text,
'Vocabulary 1 - term 0: 60 Minutes',
page.root.sessionTypeChart.chart.bars[1].description,
'Vocabulary 1 - term 0 - 60 Minutes',
);
assert.strictEqual(
page.root.sessionTypeChart.chart.labels[2].text,
'Vocabulary 2 - term 2: 30 Minutes',
page.root.sessionTypeChart.chart.bars[2].description,
'Vocabulary 2 - term 2 - 30 Minutes',
);
assert.strictEqual(page.root.sessionTypeChart.chart.labels.length, 3);
assert.strictEqual(page.root.sessionTypeChart.chart.labels[0].text, 'Vocabulary 1 - term 1');
assert.strictEqual(page.root.sessionTypeChart.chart.labels[1].text, 'Vocabulary 1 - term 0');
assert.strictEqual(page.root.sessionTypeChart.chart.labels[2].text, 'Vocabulary 2 - term 2');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module('Acceptance | course visualizations - session-types', function (hooks) {
});

test('it renders', async function (assert) {
assert.expect(14);
assert.expect(18);
const sessionType1 = this.server.create('session-type');
const sessionType2 = this.server.create('session-type');
const sessionType3 = this.server.create('session-type');
Expand Down Expand Up @@ -72,18 +72,22 @@ module('Acceptance | course visualizations - session-types', function (hooks) {
await percySnapshot(assert);
assert.strictEqual(page.root.title, 'course 0 2022');
assert.strictEqual(page.root.sessionTypesChart.chart.bars.length, 3);
assert.strictEqual(page.root.sessionTypesChart.chart.labels.length, 3);
assert.strictEqual(
page.root.sessionTypesChart.chart.labels[0].text,
'session type 1: 30 Minutes',
page.root.sessionTypesChart.chart.bars[0].description,
'session type 1 - 30 Minutes',
);
assert.strictEqual(
page.root.sessionTypesChart.chart.labels[1].text,
'session type 0: 60 Minutes',
page.root.sessionTypesChart.chart.bars[1].description,
'session type 0 - 60 Minutes',
);
assert.strictEqual(
page.root.sessionTypesChart.chart.labels[2].text,
'session type 2: 120 Minutes',
page.root.sessionTypesChart.chart.bars[2].description,
'session type 2 - 120 Minutes',
);
assert.strictEqual(page.root.sessionTypesChart.chart.labels.length, 3);
assert.strictEqual(page.root.sessionTypesChart.chart.labels[0].text, 'session type 1');
assert.strictEqual(page.root.sessionTypesChart.chart.labels[1].text, 'session type 0');
assert.strictEqual(page.root.sessionTypesChart.chart.labels[2].text, 'session type 2');
assert.strictEqual(page.root.sessionTypesChart.dataTable.rows.length, 3);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module('Acceptance | course visualizations - vocabularies', function (hooks) {
});

test('it renders', async function (assert) {
assert.expect(12);
assert.expect(16);
const sessionType = this.server.create('session-type');
const vocabulary1 = this.server.create('vocabulary');
const vocabulary2 = this.server.create('vocabulary');
Expand Down Expand Up @@ -67,10 +67,20 @@ module('Acceptance | course visualizations - vocabularies', function (hooks) {
assert.strictEqual(page.root.breadcrumb.crumbs[2].text, 'Vocabularies');
// wait for charts to load
await waitFor('.loaded');
await waitFor('svg .chart');
await waitFor('svg .bars');
await percySnapshot(assert);
assert.strictEqual(page.root.vocabulariesChart.chart.slices.length, 2);
assert.strictEqual(page.root.vocabulariesChart.chart.slices[0].text, 'Vocabulary 1');
assert.strictEqual(page.root.vocabulariesChart.chart.slices[1].text, 'Vocabulary 2');
assert.strictEqual(page.root.vocabulariesChart.chart.bars.length, 2);
assert.strictEqual(
page.root.vocabulariesChart.chart.bars[0].description,
'Vocabulary 2 - 30 Minutes',
);
assert.strictEqual(
page.root.vocabulariesChart.chart.bars[1].description,
'Vocabulary 1 - 90 Minutes',
);
assert.strictEqual(page.root.vocabulariesChart.chart.labels.length, 2);
assert.strictEqual(page.root.vocabulariesChart.chart.labels[0].text, 'Vocabulary 2');
assert.strictEqual(page.root.vocabulariesChart.chart.labels[1].text, 'Vocabulary 1');
assert.strictEqual(page.root.vocabulariesChart.dataTable.rows.length, 2);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ module('Acceptance | course visualizations - vocabulary', function (hooks) {
});

test('it renders', async function (assert) {
assert.expect(17);

assert.expect(21);
await page.visit({ courseId: this.course.id, vocabularyId: this.vocabulary.id });
assert.strictEqual(currentURL(), '/data/courses/1/vocabularies/1');
assert.strictEqual(page.root.vocabularyTitle, 'Vocabulary 1');
Expand All @@ -74,10 +73,14 @@ module('Acceptance | course visualizations - vocabulary', function (hooks) {
await waitFor('svg .bars');
await percySnapshot(assert);
assert.strictEqual(page.root.termsChart.chart.bars.length, 3);
assert.strictEqual(page.root.termsChart.chart.bars[0].description, 'term 1 - 30 Minutes');
assert.strictEqual(page.root.termsChart.chart.bars[1].description, 'term 0 - 60 Minutes');
assert.strictEqual(page.root.termsChart.chart.bars[2].description, 'term 2 - 150 Minutes');
assert.strictEqual(page.root.termsChart.chart.labels.length, 3);
assert.strictEqual(page.root.termsChart.chart.labels[0].text, 'term 1: 30 Minutes');
assert.strictEqual(page.root.termsChart.chart.labels[1].text, 'term 0: 60 Minutes');
assert.strictEqual(page.root.termsChart.chart.labels[2].text, 'term 2: 150 Minutes');
assert.strictEqual(page.root.termsChart.chart.labels[0].text, 'term 1');
assert.strictEqual(page.root.termsChart.chart.labels[1].text, 'term 0');
assert.strictEqual(page.root.termsChart.chart.labels[2].text, 'term 2');
assert.strictEqual(page.root.termsChart.dataTable.rows.length, 3);
});

test('clicking chart transitions user to term visualization', async function (assert) {
Expand All @@ -86,7 +89,7 @@ module('Acceptance | course visualizations - vocabulary', function (hooks) {
// wait for charts to load
await waitFor('.loaded');
await waitFor('svg .bars');
assert.strictEqual(page.root.termsChart.chart.labels[0].text, 'term 1: 30 Minutes');
assert.strictEqual(page.root.termsChart.chart.labels[0].text, 'term 1');
await page.root.termsChart.chart.bars[0].click();
assert.strictEqual(currentURL(), '/data/courses/1/terms/2');
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,44 @@
import { collection, create, notHasClass } from 'ember-cli-page-object';
import { attribute, clickable, collection, create, notHasClass, text } from 'ember-cli-page-object';

const definition = {
scope: '[data-test-course-visualize-instructor-session-type-graph]',
isIcon: notHasClass('no-icon'),
chart: {
scope: '.simple-chart',
slices: collection('svg .slice'),
labels: collection('.slice text'),
descriptions: collection('.slice desc'),
},
noData: {
scope: '[data-test-no-data]',
},
dataTable: {
scope: '[data-test-data-table]',
header: {
scope: 'thead',
sessionType: {
scope: '[data-test-session-type]',
toggle: clickable('button'),
},
sessions: {
scope: '[data-test-sessions]',
toggle: clickable('button'),
},
minutes: {
scope: '[data-test-minutes]',
toggle: clickable('button'),
},
},
rows: collection('tbody tr', {
sessionType: text('[data-test-session-type]'),
sessions: {
scope: '[data-test-sessions]',
links: collection('a', {
url: attribute('href'),
}),
},
minutes: text('[data-test-minutes]'),
}),
},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
import { collection, create, notHasClass } from 'ember-cli-page-object';
import { attribute, clickable, collection, create, notHasClass, text } from 'ember-cli-page-object';

const definition = {
scope: '[data-test-course-visualize-instructor-term-graph]',
isIcon: notHasClass('no-icon'),
chart: {
scope: '.simple-chart',
bars: collection('.bars rect'),
bars: collection('.bars rect', {
description: text('desc'),
}),
labels: collection('.bars text'),
},
noData: {
scope: '[data-test-no-data]',
},
dataTable: {
scope: '[data-test-data-table]',
header: {
scope: 'thead',
vocabularyTerm: {
scope: '[data-test-vocabulary-term]',
toggle: clickable('button'),
},
sessions: {
scope: '[data-test-sessions]',
toggle: clickable('button'),
},
minutes: {
scope: '[data-test-minutes]',
toggle: clickable('button'),
},
},
rows: collection('tbody tr', {
vocabularyTerm: text('[data-test-vocabulary-term]'),
sessions: {
scope: '[data-test-sessions]',
links: collection('a', {
url: attribute('href'),
}),
},
minutes: text('[data-test-minutes]'),
}),
},
};

export default definition;
Expand Down
Loading