From ca8119292867cddd2c537bc04aa608a42aadd777 Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Wed, 13 Oct 2021 13:24:48 -0400 Subject: [PATCH 1/3] docs(api): add StudentCompetency model definition --- api-docs/definitions/Slate/CBL/StudentCompetency.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 api-docs/definitions/Slate/CBL/StudentCompetency.yaml diff --git a/api-docs/definitions/Slate/CBL/StudentCompetency.yaml b/api-docs/definitions/Slate/CBL/StudentCompetency.yaml new file mode 100644 index 000000000..dd1e17c75 --- /dev/null +++ b/api-docs/definitions/Slate/CBL/StudentCompetency.yaml @@ -0,0 +1,7 @@ +x-activeRecord: Slate\CBL\StudentCompetency +description: | + A `StudentCompetency` record captures a student's state on a particular competency+level combination. + + In addition to the data stored via this database model, the `StudentCompetency` class also hosts the core + calculation workflow methods for student progress, performance, and growth since they are based on the + intersection of Student+Competency+Level. From a56e3e78447fade41f743058814c363f40f46e70 Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Wed, 13 Oct 2021 14:18:34 -0400 Subject: [PATCH 2/3] fix(e2e): update exports/student_competencies test to use calculations fixture --- cypress/fixtures/growth-calculations.json | 118 ----------------- .../student-competency-calculations.json | 124 ++++++++++++++++++ .../exports/student_competencies.js | 113 +++++++++------- .../student_demonstrations_growth.js | 2 +- 4 files changed, 187 insertions(+), 170 deletions(-) delete mode 100644 cypress/fixtures/growth-calculations.json create mode 100644 cypress/fixtures/student-competency-calculations.json diff --git a/cypress/fixtures/growth-calculations.json b/cypress/fixtures/growth-calculations.json deleted file mode 100644 index d3f28aed4..000000000 --- a/cypress/fixtures/growth-calculations.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "student": { - "ELA": { - "1": { - "baseline": 10, - "average": 9.3, - "growth": -1.5, - "percentage": 33 - }, - "2": { - "baseline": 10, - "average": 10.8, - "growth": 1, - "percentage": 27 - }, - "6": { - "baseline": 9.5, - "average": 10, - "growth": 1.5, - "percentage": 67 - } - } - }, - "student3": { - "ELA": { - "1": { - "baseline": 7.3, - "average": 7.3, - "growth": 0, - "percentage": 33 - }, - "2": { - "baseline": null, - "average": 7.3, - "growth": null, - "percentage": 40 - }, - "3": { - "baseline": 5.5, - "average": 8, - "growth": 2.5, - "percentage": 100 - }, - "4": { - "baseline": 5.7, - "average": 6.5, - "growth": 0.8, - "percentage": 100 - }, - "5": { - "baseline": null, - "average": 7.4, - "growth": null, - "percentage": 83 - }, - "6": { - "baseline": null, - "average": 8, - "growth": null, - "percentage": 33 - }, - "7": { - "baseline": 7, - "average": 7.4, - "growth": 0.7, - "percentage": 63 - } - }, - "SS": { - "1": { - "baseline": 9.4, - "average": 9, - "growth": -0.4, - "percentage": 40 - }, - "2": { - "baseline": null, - "average": 8, - "growth": null, - "percentage": 50 - } - }, - "SCI": { - "1": { - "baseline": 9.1, - "average": 9.4, - "growth": 0.4, - "percentage": 38 - }, - "2": { - "baseline": 9.3, - "average": 8, - "growth": -1.3, - "percentage": 25 - }, - "3": { - "baseline": 9.7, - "average": 7, - "growth": null, - "percentage": 33 - }, - "4": { - "baseline": 9.7, - "average": 10, - "growth": 0.3, - "percentage": 67 - } - }, - "HOS": { - "4": { - "baseline": 9, - "average": 9.3, - "growth": null, - "percentage": 100 - } - } - } -} \ No newline at end of file diff --git a/cypress/fixtures/student-competency-calculations.json b/cypress/fixtures/student-competency-calculations.json new file mode 100644 index 000000000..d28bf8332 --- /dev/null +++ b/cypress/fixtures/student-competency-calculations.json @@ -0,0 +1,124 @@ +{ + "student": { + "ELA": { + "ELA.1": { + "baseline": "10", + "average": "9.3", + "averageExplanation": "ELA.1 for student has Performance Level 9.3 ((8+9+10+10)/4 = 9.25 rounded to 9.3)", + "growth": "-1.5", + "growthExplanation": "ELA.1 for student has -1.5 growth", + "progress": "33", + "progressExplanation": "ELA.1 for student has 33% Progress (4/12 Demonstrations Required for Competency)" + }, + "ELA.2": { + "baseline": "10", + "average": "10.8", + "averageExplanation": "ELA.2 for student has Performance Level 9.3 ((11+11+11+10)/4 = 10.75 rounded to 10.8)", + "growth": "1", + "growthExplanation": "ELA.2 for student has 1 growth", + "progress": "27", + "progressExplanation": "ELA.2 for student has 33% Progress (4/15 Demonstrations Required for Competency)" + }, + "ELA.6": { + "baseline": "9.5", + "average": "10", + "growth": "1.5", + "progress": "67" + } + } + }, + "student3": { + "ELA": { + "ELA.1": { + "baseline": "7.3", + "average": "7.3", + "growth": "0", + "progress": "33" + }, + "ELA.2": { + "baseline": null, + "average": "7.3", + "growth": null, + "progress": "40" + }, + "ELA.3": { + "baseline": "5.5", + "average": "8", + "growth": "2.5", + "progress": "100" + }, + "ELA.4": { + "baseline": "5.7", + "average": "6.5", + "growth": "0.8", + "progress": "100" + }, + "ELA.5": { + "baseline": null, + "average": "7.4", + "growth": null, + "progress": "83" + }, + "ELA.6": { + "baseline": null, + "average": "8", + "growth": null, + "progress": "33" + }, + "ELA.7": { + "baseline": "7", + "average": "7.4", + "growth": "0.7", + "progress": "63" + } + }, + "SS": { + "SS.1": { + "baseline": "9.4", + "average": "9", + "growth": "-0.4", + "progress": "40" + }, + "SS.2": { + "baseline": null, + "average": "8", + "growth": null, + "progress": "50" + } + }, + "SCI": { + "SCI.1": { + "baseline": "9.1", + "average": "9.4", + "growth": "0.4", + "progress": "38" + }, + "SCI.2": { + "baseline": "9.3", + "average": "8", + "growth": "-1.3", + "progress": "25" + }, + "SCI.3": { + "baseline": "9.7", + "average": "7", + "growth": null, + "progress": "33" + }, + "SCI.4": { + "baseline": "9.7", + "average": "10", + "growth": "0.3", + "progress": "67" + } + }, + "HOS": { + "HOS.4": { + "baseline": "9", + "average": "9.3", + "growth": null, + "progress": "100" + } + } + } +} \ No newline at end of file diff --git a/cypress/integration/exports/student_competencies.js b/cypress/integration/exports/student_competencies.js index 5f5ab8d8a..c2928b763 100644 --- a/cypress/integration/exports/student_competencies.js +++ b/cypress/integration/exports/student_competencies.js @@ -1,65 +1,76 @@ const csvtojson = require('csvtojson'); describe('Student Competencies Export', () => { - it('Download and Verify Student Competencies Export via Form', () => { + + // load fixtures that will help generate tests with require + const { student: { ELA: studentCompetencies }} = require('../../fixtures/student-competency-calculations'); + + // declare array to store data in during before for later tests + let recordsByCompetency = {}; + + // all async setup ahead of the generated tests must be done in before + before(() => { + cy.resetDatabase(); + cy.loginAs('admin'); - cy.visit('/exports') - cy.contains('h2', 'Competency Progress') + cy.visit('/exports'); + cy.contains('h2', 'Competency Progress'); - // prepare for form submission that returns back a file - // https://on.cypress.io/intercept - cy.intercept({ - pathname: '/exports/slate-cbl/student-competencies', - }, (req) => { - // instead of redirecting to the CSV file - // and having the browser deal with it - // download the file ourselves - // but we cannot use Cypress commands inside the callback - // thus we will download it later using the captured URL - req.redirect('/exports') - }).as('records') + // prepare for form submission that returns back a file + // https://on.cypress.io/intercept + cy.intercept({ + pathname: '/exports/slate-cbl/student-competencies', + }, (req) => { + // instead of redirecting to the CSV file + // and having the browser deal with it + // download the file ourselves + // but we cannot use Cypress commands inside the callback + // thus we will download it later using the captured URL + req.redirect('/exports'); + }).as('records'); - cy.get('form[action="/exports/slate-cbl/student-competencies"]').within(() => { - cy.get('input[name=students]').type('{selectall}{backspace}student'); - cy.get('select[name=content_area]').select('English Language Arts'); - cy.get('select[name=level]').select('highest'); + cy.get('form[action="/exports/slate-cbl/student-competencies"]').within(() => { + cy.get('input[name=students]').type('{selectall}{backspace}student'); + cy.get('select[name=content_area]').select('English Language Arts'); + cy.get('select[name=level]').select('highest'); - cy.root().submit(); - }) + cy.root().submit(); + }); - cy.wait('@records').its('request').then((req) => { - cy.request(req) + cy.wait('@records').its('request').then((req) => { + cy.request(req) .then(({ body, headers }) => { expect(headers).to.have.property('content-type', 'text/csv; charset=utf-8') return csvtojson().fromString(body) - }).then((records) => { + }) + .then(records => { expect(records, 'One row per competency skill').to.have.length(7); - expect( - records[0]['Performance Level'], - 'ELA.1 for student has Performance Level 9.3 ((8+9+10+10)/4 = 9.25 rounded to 9.3)' - ).to.equal('9.3'); - expect( - records[0]['Progress'], - 'ELA.1 for student has 33% Progress (4/12 Demonstrations Required for Competency)' - ).to.equal('0.33'); - expect( - records[0]['Growth'], - 'ELA.1 for student has -1.5 growth' - ).to.equal('-1.5') - expect( - records[1]['Performance Level'], - 'ELA.2 for student has Performance Level 9.3 ((11+11+11+10)/4 = 10.75 rounded to 10.8)' - ).to.equal('10.8') - expect( - records[1]['Progress'], - 'ELA.2 for student has 33% Progress (4/15 Demonstrations Required for Competency)' - ).to.equal('0.27') - expect( - records[1]['Growth'], - 'ELA.2 for student has 1 growth' - ).to.equal('1') - }) - }) - }) + // index records by competency + for (const record of records) { + recordsByCompetency[record.Competency] = record; + } + }); + }); + }); + + // generate a test for each case in the fixture data + for (const competency in studentCompetencies) { + const { + average, averageExplanation, + growth, growthExplanation, + progress, progressExplanation, + } = studentCompetencies[competency]; + + console.log(`student=student, competency=${competency}`, studentCompetencies[competency]) + + it(`Check case for student=student, competency=${competency}`, () => { + expect(recordsByCompetency).to.have.any.key(competency); + const record = recordsByCompetency[competency]; + + expect(record['Performance Level'], averageExplanation).to.equal(average); + expect(String(record['Progress']*100), progressExplanation).to.equal(progress); + expect(record['Growth'], growthExplanation).to.equal(growth); + }) + } }) \ No newline at end of file diff --git a/cypress/integration/student_demonstrations_growth.js b/cypress/integration/student_demonstrations_growth.js index 1d8a4c15d..763229a8c 100644 --- a/cypress/integration/student_demonstrations_growth.js +++ b/cypress/integration/student_demonstrations_growth.js @@ -12,7 +12,7 @@ describe.skip('Student competency growth calculation test', () => { it('compare growth calculations', () => { - cy.readFile('cypress/fixtures/growth-calculations.json') + cy.readFile('cypress/fixtures/student-competency-calculations.json') .then((growthCalculationsByStudent) => { cy.server().route('GET', '/cbl/student-competencies*').as('studentCompetencyData'); From 60f52eaca3f142cb902784c5165ea188d5beb4f5 Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Wed, 13 Oct 2021 16:44:12 -0400 Subject: [PATCH 3/3] chore(deps): bump slate to v2.16.6 --- .holo/sources/slate.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.holo/sources/slate.toml b/.holo/sources/slate.toml index 66a07a777..8551b5755 100644 --- a/.holo/sources/slate.toml +++ b/.holo/sources/slate.toml @@ -1,3 +1,3 @@ [holosource] url = "https://github.com/SlateFoundation/slate" -ref = "refs/tags/v2.16.5" +ref = "refs/tags/v2.16.6"