From 3b456bdc7246f0e67d7aa6ae67cd1ed181aa184c Mon Sep 17 00:00:00 2001 From: emily-ejag Date: Fri, 23 Aug 2024 13:44:02 -0700 Subject: [PATCH 1/2] make participants sign legal doc after every august first each year --- src/pages/HomeParticipant.vue | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/pages/HomeParticipant.vue b/src/pages/HomeParticipant.vue index ae64bbfa0..ac71d36ca 100644 --- a/src/pages/HomeParticipant.vue +++ b/src/pages/HomeParticipant.vue @@ -223,14 +223,25 @@ async function checkConsent() { if (_get(toRaw(consentStatus), consentDoc.version)) { const legalDocs = _get(toRaw(consentStatus), consentDoc.version); let found = false; + let signedBeforeAugFirst = false; _forEach(legalDocs, (document) => { + const signedDate = new Date(document.dateSigned); + const augustFirstThisYear = new Date(currentDate.getFullYear(), 7, 1); // August 1st of the current year + if (document.amount === docAmount && document.expectedTime === docExpectedTime) { found = true; + if (signedDate < augustFirstThisYear && currentDate >= augustFirstThisYear) { + console.log('Signed before August 1st'); + signedBeforeAugFirst = true; + } + } + if (isNaN(new Date(document.dateSigned)) && currentDate >= augustFirstThisYear) { + signedBeforeAugFirst = true; } }); - if (!found) { - if (docAmount !== '' || docExpectedTime !== '') { + if (!found || signedBeforeAugFirst) { + if (docAmount !== '' || docExpectedTime !== '' || signedBeforeAugFirst) { confirmText.value = consentDoc.text; showConsent.value = true; return; From db4481d1b73302f148e3e049465e5ba25e8f01fe Mon Sep 17 00:00:00 2001 From: emily-ejag Date: Fri, 23 Aug 2024 13:54:25 -0700 Subject: [PATCH 2/2] legal doc cypress test --- cypress.config.cjs | 6 +++++- cypress/e2e/participant/default-tests/checkLegalDoc.cy.js | 4 ++-- src/pages/HomeParticipant.vue | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cypress.config.cjs b/cypress.config.cjs index 007a0a483..2cb518848 100644 --- a/cypress.config.cjs +++ b/cypress.config.cjs @@ -83,7 +83,11 @@ module.exports = defineConfig({ testSpanishRoarAppsAdministration: 'Cypress Test Spanish Roar Apps Administration', testSpanishRoarAppsAdministrationId: '', // Generate a list of test users CypressTestStudent0, CypressTestStudent1, ..., CypressTestStudent50 - testUserList: Array.from({ length: 51 }, (_, i) => `CypressTestStudent${i}`), + testUserList: (() => { + const list = Array.from({ length: 51 }, (_, i) => `CypressTestStudent${i}`); + list.push('test_legal_doc'); + return list; + })(), roarDemoDistrictName: 'Roar Demo District', roarDemoDistrictId: 'dfyDUItJNf3wEoG6Mf8H', roarDemoAdministrationName: 'ROAR demo administration', diff --git a/cypress/e2e/participant/default-tests/checkLegalDoc.cy.js b/cypress/e2e/participant/default-tests/checkLegalDoc.cy.js index de2889f92..49f9816de 100644 --- a/cypress/e2e/participant/default-tests/checkLegalDoc.cy.js +++ b/cypress/e2e/participant/default-tests/checkLegalDoc.cy.js @@ -1,13 +1,13 @@ export const timeout = Cypress.env('timeout'); // userId in gse-roar-admin: NZouDdq6ZwYNyFdCbnuclw2fLJ82 -// userId in gse-roar-admin-dev: XAq5qOuXnNPHClK0xZXXhfGsWX22 +// userId in gse-roar-admin-dev: O75V6IcVeiTwW8TRjXb76uydlwV2 describe('Test to maintain that assent form shows in when signing in with an un-assented user', () => { it('passes', () => { // this is a user that has an assignment of roarVocab -- how can we create a user that can // ALWAYS play the game - let test_login = 'DO_NOT_ACCEPT_DOC'; + let test_login = 'testlegaldoc@test.com'; let test_pw = 'passwordLEGAL'; // how can we write some logic to reset the already played cy.login(test_login, test_pw); diff --git a/src/pages/HomeParticipant.vue b/src/pages/HomeParticipant.vue index ac71d36ca..ff9679340 100644 --- a/src/pages/HomeParticipant.vue +++ b/src/pages/HomeParticipant.vue @@ -197,7 +197,7 @@ async function checkConsent() { if (!legal?.consent) { // Always show consent form for this test student when running Cypress tests - if (userData.value?.id === 'XAq5qOuXnNPHClK0xZXXhfGsWX22') { + if (userData.value?.id === 'O75V6IcVeiTwW8TRjXb76uydlwV2') { consentType.value = 'consent'; confirmText.value = 'This is a test student. Please do not accept this form.'; showConsent.value = true;