Skip to content

Commit

Permalink
Merge pull request #616 from SlateFoundation/develop
Browse files Browse the repository at this point in the history
Release: v3.4.4
  • Loading branch information
themightychris authored Oct 13, 2021
2 parents 6049182 + 60f52ea commit f92d1b6
Show file tree
Hide file tree
Showing 6 changed files with 195 additions and 171 deletions.
2 changes: 1 addition & 1 deletion .holo/sources/slate.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[holosource]
url = "https://github.com/SlateFoundation/slate"
ref = "refs/tags/v2.16.5"
ref = "refs/tags/v2.16.6"
7 changes: 7 additions & 0 deletions api-docs/definitions/Slate/CBL/StudentCompetency.yaml
Original file line number Diff line number Diff line change
@@ -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.
118 changes: 0 additions & 118 deletions cypress/fixtures/growth-calculations.json

This file was deleted.

124 changes: 124 additions & 0 deletions cypress/fixtures/student-competency-calculations.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
113 changes: 62 additions & 51 deletions cypress/integration/exports/student_competencies.js
Original file line number Diff line number Diff line change
@@ -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);
})
}
})
2 changes: 1 addition & 1 deletion cypress/integration/student_demonstrations_growth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down

0 comments on commit f92d1b6

Please sign in to comment.