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

[PROD] Spelling correction, auto-db backup, postgres upgrade to 15 #2162

Merged
merged 18 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 20 additions & 2 deletions automation/common/scripts/awscli_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ function download_aws_cli() {
log "ERROR" "Failed to download AWS CLI."
exit 2
fi

if command -v gpg > /dev/null 2>&1; then
if ! wget "$aws_cli_url.sig" -O "$zip_file.sig"; then
log "ERROR" "Failed to download AWS CLI."
exit 2
fi

if ! gpg --verify "${zip_file}.sig" "$zip_file"; then
log "ERROR" "Sig verification failed for AWS CLI."
exit 2
fi
fi
log "INFO" "Download completed successfully."
}

Expand Down Expand Up @@ -137,6 +149,12 @@ function cleanup() {
else
log "INFO" "The zip file does not exist."
fi
if [ -f "$zip_file.sig" ]; then
rm "$zip_file.sig"
log "INFO" "The zip sig file has been deleted."
else
log "INFO" "The zip file does not exist."
fi
if [ -d "$aws_dir" ]; then
rm -r "$aws_dir"
log "INFO" "The 'aws' directory has been deleted."
Expand All @@ -147,10 +165,10 @@ function cleanup() {

# Main function to control workflow
main() {
local aws_cli_url="https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"
local aws_cli_url="https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.15.56.zip"
local install_dir="/tmp/local/aws-cli"
local zip_file="/tmp/awscliv2.zip"
local zip_sha256="b5f5c31aac4cfd7a6eca58bd6f54ff4ebf4417dc70dc77e8db44ce52aa0723c4"
local zip_sha256="f68d3cc42d08a346b55aa531bcc2a0320700e374d87a3282a0f7e48c0f75bff7"
local bin_dir="/tmp/local/bin"
local aws_dir="/tmp/local/aws"

Expand Down
2 changes: 1 addition & 1 deletion automation/common/scripts/postgrescli_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function cleanup() {
function main() {
local deb_url="http://security.debian.org/debian-security/pool/updates/main/p/postgresql-15/postgresql-client-15_15.6-0+deb12u1_amd64.deb"
local deb_file="/tmp/postgresql.deb"
local deb_sha256="c7143d12f17403821fe7111ff8ac3de3884cf96e"
local deb_sha256="f601421f0f075c78df0ee289fbe075f38f52d08362ff2907d1710c26d5e53c39"
local bin_dir="/tmp/local/bin"
local tools=("pg_dump" "pg_isready" "pg_restore" "psql" "reindexdb" "vacuumdb")

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dss.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ services:
volumes:
- ".:/app:rw"
db:
image: postgres:12.4
image: postgres:15.6
container_name: postgres_docker
environment:
POSTGRES_USER: postgres
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ services:
networks:
- ttadp-test
test-db:
image: postgres:12.4
image: postgres:15.6
container_name: test-db
env_file: .env
ports:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
environment:
- SPEC_URL=swagger/index.yaml
db:
image: postgres:12.4
image: postgres:15.6
container_name: postgres_docker
env_file: .env
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const BadgeBelowQuality = () => (
</span>
);

const BadgeBelowCompetetive = () => (
const BadgeBelowCompetitive = () => (
<span className="ttahub-badge--error font-sans-2xs text-white text-bold">
Below competetive
Below competitive
</span>
);

Expand All @@ -46,7 +46,7 @@ const ClassReview = ({ grantNumber, recipientId, regionId }) => {
const getScoreBadge = (key, score, received) => {
if (key === 'ES' || key === 'CO') {
if (score >= 6) return BadgeAbove();
if (score < 5) return BadgeBelowCompetetive();
if (score < 5) return BadgeBelowCompetitive();
return BadgeBelowQuality();
}

Expand All @@ -58,12 +58,12 @@ const ClassReview = ({ grantNumber, recipientId, regionId }) => {
const dt = moment(received, 'MM/DD/YYYY');

if (dt.isAfter('2025-08-01')) {
if (score < 2.5) return BadgeBelowCompetetive();
if (score < 2.5) return BadgeBelowCompetitive();
return BadgeBelowQuality();
}

if (dt.isAfter('2020-11-09') && dt.isBefore('2025-07-31')) {
if (score < 2.3) return BadgeBelowCompetetive();
if (score < 2.3) return BadgeBelowCompetitive();
return BadgeBelowQuality();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ describe('ClassReview', () => {
describe('emotional support', () => {
it('above all thresholds', () => testThreshold('ES', 6, 'Above all thresholds'));
it('below quality', () => testThreshold('ES', 5.1, 'Below quality'));
it('below competetive', () => testThreshold('ES', 5.1, 'Below quality'));
it('below competitive', () => testThreshold('ES', 5.1, 'Below quality'));
});

describe('classroom organization', () => {
it('above all thresholds', () => testThreshold('CO', 6, 'Above all thresholds'));
it('below quality', () => testThreshold('CO', 5.1, 'Below quality'));
it('below competetive', () => testThreshold('CO', 4.9, 'Below competetive'));
it('below competitive', () => testThreshold('CO', 4.9, 'Below competitive'));
});

describe('instructional support', () => {
it('above all thresholds', () => testThreshold('IS', 3.1, 'Above all thresholds'));
it('below quality - after 2025-08-01', () => testThreshold('IS', 2.5, 'Below quality'));
it('below quality - between 2020-11-09 and 2025-07-31', () => testThreshold('IS', 2.4, 'Below quality'));
it('below competetive - after 2025-08-01', () => testThreshold('IS', 2.4, 'Below competetive', '08/02/2025'));
it('below competetive - between 2020-11-09 and 2025-07-31', () => testThreshold('IS', 2.2, 'Below competetive'));
it('below competitive - after 2025-08-01', () => testThreshold('IS', 2.4, 'Below competitive', '08/02/2025'));
it('below competitive - between 2020-11-09 and 2025-07-31', () => testThreshold('IS', 2.2, 'Below competitive'));
});
});
});
2 changes: 1 addition & 1 deletion src/goalServices/goals.js
Original file line number Diff line number Diff line change
Expand Up @@ -2448,7 +2448,7 @@ export async function getGoalsForReport(reportId) {
ON gtfp.id = argfr."goalTemplateFieldPromptId"
AND argfr."activityReportGoalId" = "activityReportGoals".id
WHERE "goalTemplate".id = gtfp."goalTemplateId"
GROUP BY TRUE
GROUP BY 1=1
)`), 'prompts'],
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/models/hooks/activityReportGoalFieldResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const recalculateOnAR = async (
WHERE g.id = "GoalFieldResponses"."goalId"
AND arg."id" != ${instance.activityReportGoalId}
AND argfr."goalTemplateFieldPromptId" = ${instance.goalTemplateFieldPromptId}
GROUP BY TRUE
GROUP BY 1=1
), FALSE)`),
},
{
Expand Down
14 changes: 7 additions & 7 deletions src/services/dashboards/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ export async function resourceData(scopes, skipResources = false, skipTopics = f
'tableType', 'report'
))
FROM UNNEST("resources->ActivityReportResource"."sourceFields") SF("sourceField")
GROUP BY TRUE
GROUP BY 1=1
)`),
),
),
Expand Down Expand Up @@ -958,7 +958,7 @@ export async function resourceData(scopes, skipResources = false, skipTopics = f
'tableType', 'specialistNextStep'
))
FROM UNNEST("specialistNextSteps->resources->NextStepResource"."sourceFields") SF("sourceField")
GROUP BY TRUE
GROUP BY 1=1
)`),
),
),
Expand Down Expand Up @@ -1057,7 +1057,7 @@ export async function resourceData(scopes, skipResources = false, skipTopics = f
'tableType', 'recipientNextStep'
))
FROM UNNEST("recipientNextSteps->resources->NextStepResource"."sourceFields") SF("sourceField")
GROUP BY TRUE
GROUP BY 1=1
)`),
),
),
Expand Down Expand Up @@ -1157,7 +1157,7 @@ export async function resourceData(scopes, skipResources = false, skipTopics = f
'tableType', 'objective'
))
FROM UNNEST("activityReportObjectives->resources->ActivityReportObjectiveResource"."sourceFields") SF("sourceField")
GROUP BY TRUE
GROUP BY 1=1
)`),
sequelize.literal('\'topics\''),
sequelize.literal(`(
Expand All @@ -1166,7 +1166,7 @@ export async function resourceData(scopes, skipResources = false, skipTopics = f
JOIN "Topics" t
ON arot."topicId" = t.id
WHERE arot."activityReportObjectiveId" = "activityReportObjectives"."id"
GROUP BY TRUE
GROUP BY 1=1
)`),
),
),
Expand Down Expand Up @@ -1287,7 +1287,7 @@ export async function resourceData(scopes, skipResources = false, skipTopics = f
'tableType', 'goals'
))
FROM UNNEST("activityReportGoals->resources->ActivityReportGoalResource"."sourceFields") SF("sourceField")
GROUP BY TRUE
GROUP BY 1=1
)`),
sequelize.literal('\'topics\''),
sequelize.literal(`(
Expand All @@ -1296,7 +1296,7 @@ export async function resourceData(scopes, skipResources = false, skipTopics = f
JOIN "Topics" t
ON arot."topicId" = t.id
WHERE arot."activityReportObjectiveId" = "activityReportObjectives"."id"
GROUP BY TRUE
GROUP BY 1=1
)`),
),
),
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/topicFrequencyGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export async function topicFrequencyGraph(scopes) {
SELECT aro.topic
FROM UNNEST(ARRAY_AGG("activityReportObjectives->topics".name)) aro(topic)
) x(topic)
GROUP BY TRUE
GROUP BY 1=1
)`),
'topics',
],
Expand Down Expand Up @@ -146,7 +146,7 @@ export async function topicFrequencyGraphViaGoals(scopes) {
'reportIds', x."reportIds"
)), null)
FROM "all_topics_with_report_array" x(topic, "reportIds")
GROUP BY TRUE
GROUP BY 1=1
)`),
'topics',
],
Expand Down