Skip to content

Commit db25e46

Browse files
Merge branch 'develop' into SWAP-4929-user-officer-experiment-table-filter
2 parents e296a44 + f5150a2 commit db25e46

66 files changed

Lines changed: 2343 additions & 971 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test-build.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,18 @@ jobs:
214214
JWT_TOKEN_LIFE: 7d
215215
SPARKPOST_TOKEN: wrong_token_for_test
216216

217+
- name: Cache backend build
218+
uses: actions/cache@v4
219+
with:
220+
path: apps/backend/build
221+
key: backend-build-${{ github.sha }}-${{ github.run_id }}
222+
223+
- name: Cache frontend build
224+
uses: actions/cache@v4
225+
with:
226+
path: apps/frontend/build
227+
key: frontend-build-${{ github.sha }}-${{ github.run_id }}
228+
217229
test_backend:
218230
runs-on: ubuntu-latest
219231
needs: build
@@ -333,6 +345,18 @@ jobs:
333345
${{ env.FRONTEND_SDK_KEY }}
334346
sdk-frontend-
335347
348+
- name: Restore backend build
349+
uses: actions/cache@v4
350+
with:
351+
path: apps/backend/build
352+
key: backend-build-${{ github.sha }}-${{ github.run_id }}
353+
354+
- name: Restore frontend build
355+
uses: actions/cache@v4
356+
with:
357+
path: apps/frontend/build
358+
key: frontend-build-${{ github.sha }}-${{ github.run_id }}
359+
336360
# TODO: See how to proceed with e2e caching because there is some error:
337361
# - You're caching 'node_modules' but are not caching this path: /home/runner/.cache/Cypress
338362
# - You ran 'npm install' at an earlier build step but did not persist: /home/runner/.cache/Cypress
@@ -399,7 +423,7 @@ jobs:
399423
run: |
400424
REPO_DIR_NAME=$(basename $GITHUB_WORKSPACE)
401425
402-
npm run e2e:after:dev:stfc
426+
npm run e2e:after:start:stfc
403427
404428
- name: Run e2e tests
405429
env:
@@ -438,7 +462,7 @@ jobs:
438462
run: |
439463
REPO_DIR_NAME=$(basename $GITHUB_WORKSPACE)
440464
441-
npm run e2e:after:dev -- --dns-result-order=ipv4first
465+
npm run e2e:after:start -- --dns-result-order=ipv4first
442466
443467
- name: Upload cypres screenshots
444468
if: failure()

Dockerfile.e2e

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM cypress/included:13.2.0
1+
FROM cypress/included:15.4.0
22

33
# Copy and install node modules needed for frontend
44
WORKDIR /e2e
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
DO
2+
$$
3+
BEGIN
4+
IF register_patch('ChangeFapGradeToString.sql', 'TCMeldrum', 'Make grade a string for FAPs', '2025-09-04') THEN
5+
BEGIN
6+
7+
DROP VIEW review_data;
8+
9+
ALTER TABLE fap_reviews
10+
ALTER COLUMN grade type varchar(30);
11+
12+
CREATE OR REPLACE VIEW public.review_data
13+
AS SELECT proposal.proposal_pk,
14+
proposal.proposal_id,
15+
proposal.title,
16+
proposal.instrument_name,
17+
proposal.availability_time,
18+
proposal.time_allocation,
19+
proposal.fap_id,
20+
proposal.rank_order,
21+
proposal.call_id,
22+
proposal.proposer_id,
23+
proposal.instrument_id,
24+
proposal.fap_time_allocation,
25+
proposal.questionary_id,
26+
grade.avg AS average_grade,
27+
proposal.public_comment AS comment
28+
FROM ( SELECT fp.proposal_pk,
29+
p.proposal_id,
30+
p.title,
31+
i.name AS instrument_name,
32+
chi.availability_time,
33+
tr.time_allocation,
34+
f.fap_id,
35+
fmd.rank_order,
36+
c.call_id,
37+
p.proposer_id,
38+
i.instrument_id,
39+
fp.fap_time_allocation,
40+
p.questionary_id,
41+
tr.public_comment
42+
FROM fap_proposals fp
43+
JOIN faps f ON f.fap_id = fp.fap_id
44+
JOIN call c ON c.call_id = fp.call_id
45+
JOIN proposals p ON p.proposal_pk = fp.proposal_pk
46+
JOIN technical_review tr ON tr.proposal_pk = p.proposal_pk AND tr.instrument_id = fp.instrument_id
47+
LEFT JOIN fap_meeting_decisions fmd ON fmd.proposal_pk = p.proposal_pk
48+
JOIN call_has_instruments chi ON chi.instrument_id = fp.instrument_id AND chi.call_id = c.call_id
49+
JOIN instruments i ON i.instrument_id = chi.instrument_id
50+
WHERE p.status_id <> 9 AND p.status_id <> 1) proposal
51+
LEFT JOIN ( SELECT fr.proposal_pk,
52+
avg(CASE
53+
WHEN fr.grade ~ '^\d+(\.\d+)\?$' THEN fr.grade::double precision
54+
ELSE NULL
55+
END) AS avg
56+
FROM fap_proposals fp
57+
JOIN fap_reviews fr ON fr.proposal_pk = fp.proposal_pk
58+
GROUP BY fr.proposal_pk) grade ON grade.proposal_pk = proposal.proposal_pk;
59+
60+
61+
UPDATE questions SET default_config = jsonb_set(default_config, '{maxGrade}', '10', true) WHERE question_id = 'fap_review_basis';
62+
UPDATE questions SET default_config = jsonb_set(default_config, '{minGrade}', '1', true) WHERE question_id = 'fap_review_basis';
63+
UPDATE questions SET default_config = jsonb_set(default_config, '{decimalPoints}', '0', true) WHERE question_id = 'fap_review_basis';
64+
UPDATE templates_has_questions SET config = jsonb_set(config, '{maxGrade}', '10', true) WHERE question_id = 'fap_review_basis';
65+
UPDATE templates_has_questions SET config = jsonb_set(config, '{minGrade}', '1', true) WHERE question_id = 'fap_review_basis';
66+
UPDATE templates_has_questions SET config = jsonb_set(config, '{decimalPoints}', '0', true) WHERE question_id = 'fap_review_basis';
67+
68+
DELETE FROM settings WHERE settings_id = 'GRADE_PRECISION';
69+
END;
70+
END IF;
71+
END;
72+
$$
73+
LANGUAGE plpgsql;

apps/backend/db_patches/db_seeds/0005_ProposalQuestions.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ INSERT INTO templates_has_questions(
389389
VALUES
390390
(
391391
'dynamic_multiple_choice_question',
392-
proposal_template_id_var, proposal_topic_id_var, 6, '{"variant":"dropdown", "url":"", "jsonPath":"","isMultipleSelect":true, "apiCallRequestHeaders":[],"readPermissions":[]}'
392+
proposal_template_id_var, proposal_topic_id_var, 10, '{"variant":"dropdown", "url":"", "jsonPath":"","isMultipleSelect":true, "apiCallRequestHeaders":[],"readPermissions":[]}'
393393
);
394394
INSERT INTO answers(
395395
questionary_id, question_id, answer
@@ -456,7 +456,7 @@ INSERT INTO templates_has_questions(
456456
VALUES
457457
(
458458
'instrument_picker_question',
459-
proposal_template_id_var, proposal_topic_id_var, 6, '{"variant":"dropdown","options":[1, 2], "readPermissions":[]}'
459+
proposal_template_id_var, proposal_topic_id_var, 11, '{"variant":"dropdown","options":[1, 2], "readPermissions":[]}'
460460
);
461461
INSERT INTO answers(
462462
questionary_id, question_id, answer
@@ -491,7 +491,7 @@ INSERT INTO templates_has_questions(
491491
VALUES
492492
(
493493
'technique_picker_question',
494-
proposal_template_id_var, proposal_topic_id_var, 6, '{"variant":"dropdown","options":[1, 2], "readPermissions":[]}'
494+
proposal_template_id_var, proposal_topic_id_var, 12, '{"variant":"dropdown","options":[1, 2], "readPermissions":[]}'
495495
);
496496
INSERT INTO answers(
497497
questionary_id, question_id, answer

apps/backend/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/backend/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"tsc": "tsc",
1919
"build": "npm run generate:uows && rm -rf ./build && tsc",
2020
"dev": "docker compose up -d --remove-orphans && ts-node-dev -r tsconfig-paths/register --respawn -T ./index.ts",
21-
"dev:e2e": "docker compose -f docker-compose.e2e.yml up -d --remove-orphans && wait-on --verbose --interval 5000 --delay 15000 --timeout 300000 tcp:5432 && ts-node -r tsconfig-paths/register -T ./index.ts",
22-
"dev:e2e:stfc": "docker compose -f docker-compose-stfc.e2e.yml up -d --remove-orphans && wait-on --verbose --interval 5000 --delay 15000 --timeout 300000 tcp:5432 && ts-node -r tsconfig-paths/register -T ./index.ts",
21+
"start:e2e": "docker compose -f docker-compose.e2e.yml up -d --remove-orphans && wait-on --verbose --interval 5000 --delay 15000 --timeout 300000 tcp:5432 && node ./build/index.js",
22+
"start:e2e:stfc": "docker compose -f docker-compose-stfc.e2e.yml up -d --remove-orphans && wait-on --verbose --interval 5000 --delay 15000 --timeout 300000 tcp:5432 && node ./build/index.js",
2323
"dev:docker": "npm install && ts-node-dev --inspect=0.0.0.0:9229 --respawn -T ./index.ts",
2424
"prod": "tsc && node ./build/index.js",
2525
"lint": "npm run generate:uows && tsc --noEmit && eslint . --ext .js,.ts --quiet",
@@ -47,7 +47,7 @@
4747
"@user-office-software/duo-localisation": "^1.2.0",
4848
"@user-office-software/duo-logger": "^2.3.2",
4949
"@user-office-software/duo-message-broker": "^1.6.0",
50-
"@user-office-software/duo-validation": "^5.1.19",
50+
"@user-office-software/duo-validation": "^5.1.20",
5151
"@user-office-software/openid": "^1.4.0",
5252
"await-to-js": "^2.1.1",
5353
"bcryptjs": "^2.4.3",
@@ -129,4 +129,4 @@
129129
"npm": ">=10.9.2",
130130
"node": ">=22.0.0"
131131
}
132-
}
132+
}

apps/backend/src/auth/StfcUserAuthorization.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,8 @@ export class StfcUserAuthorization extends UserAuthorization {
334334
return response.identifier !== undefined;
335335
})
336336
.catch((error) => {
337-
logger.logError(
337+
// Warn only as this could be a user trying to use an expired token
338+
logger.logWarn(
338339
'An error occurred while validating the token using validateToken',
339340
error
340341
);

apps/backend/src/config/eli/configureELIEnvironment.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@ async function enableDefaultELIFeatures() {
102102
settingsId: SettingsId.DEFAULT_INST_SCI_STATUS_FILTER,
103103
settingsValue: 'FEASIBILITY_REVIEW',
104104
});
105-
await db.updateSettings({
106-
settingsId: SettingsId.GRADE_PRECISION,
107-
settingsValue: '1',
108-
});
109105
}
110106

111107
async function setELIRoleNames() {

apps/backend/src/config/ess/configureESSEnvironment.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ async function enableDefaultEssFeatures() {
9898
settingsId: SettingsId.DEFAULT_INST_SCI_STATUS_FILTER,
9999
settingsValue: 'FEASIBILITY_REVIEW',
100100
});
101-
await db.updateSettings({
102-
settingsId: SettingsId.GRADE_PRECISION,
103-
settingsValue: '1',
104-
});
105101
await db.updateSettings({
106102
settingsId: SettingsId.DISPLAY_FAQ_LINK,
107103
settingsValue: 'true',

apps/backend/src/config/stfc/configureSTFCEnvironment.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ async function enableDefaultStfcFeatures() {
114114
settingsId: SettingsId.IDLE_TIMEOUT,
115115
settingsValue: '1200000',
116116
});
117-
await db.updateSettings({
118-
settingsId: SettingsId.GRADE_PRECISION,
119-
settingsValue: '0.01',
120-
});
121117
await db.updateSettings({
122118
settingsId: SettingsId.TECH_REVIEW_OPTIONAL_WORKFLOW_STATUS,
123119
settingsValue: 'FEASIBILITY',

0 commit comments

Comments
 (0)