From c08c6f1835deb69176721b770fc235eeb10cb079 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Tue, 12 Sep 2023 16:07:02 -0700 Subject: [PATCH 01/78] Sonarcloud config changes. --- .sonarcloud.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 43fd3f956..e7844c072 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,8 +1,8 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api/,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-web -sonar.exclusions=**/*.test.js,request-management-api/migrations/versions/*,request-management-api/tests/**/* +sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-web,notification-manager +sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests @@ -14,4 +14,4 @@ sonar.exclusions=**/*.test.js,request-management-api/migrations/versions/*,reque sonar.sourceEncoding=UTF-8 # Exclusions for copy-paste detection -sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions/*,request-management-api/tests/**/* \ No newline at end of file +sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file From 6ccca4ce0bb5f3e083473d4c7a722f8ec0cb8c56 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Tue, 12 Sep 2023 22:45:37 -0700 Subject: [PATCH 02/78] Sonarcloud config changes. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index e7844c072..f88da6f0d 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -4,7 +4,7 @@ sonar.projectName=foi-flow sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-web,notification-manager sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= - +sonar.branch.name=main-ST-sonarcloud # Path to tests # sonar.tests= #sonar.test.exclusions= From bc56889bb23e5f23066e15323e584a522cf24059 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Tue, 12 Sep 2023 22:53:48 -0700 Subject: [PATCH 03/78] Sonarcloud config changes. --- .sonarcloud.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index f88da6f0d..57f638145 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -5,6 +5,7 @@ sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/form sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= sonar.branch.name=main-ST-sonarcloud +sonar.python.version=3.8 # Path to tests # sonar.tests= #sonar.test.exclusions= From d17461e900a388b9568eb93dc7291b5309e8496a Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Tue, 12 Sep 2023 22:55:48 -0700 Subject: [PATCH 04/78] Sonarcloud config changes. --- .sonarcloud.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 57f638145..8d25873c9 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,8 +1,8 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-web,notification-manager -sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests +sonar.sources=request-management-api,notification-manager +sonar.exclusions=request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= sonar.branch.name=main-ST-sonarcloud sonar.python.version=3.8 @@ -15,4 +15,4 @@ sonar.python.version=3.8 sonar.sourceEncoding=UTF-8 # Exclusions for copy-paste detection -sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file +sonar.cpd.exclusions=request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file From 9abd024d536f54ba8359f3161397cb0f5c9bb443 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Tue, 12 Sep 2023 23:00:48 -0700 Subject: [PATCH 05/78] default configuration for scan --- .sonarcloud.properties | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 8d25873c9..8fb5cc01f 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,11 +1,9 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api,notification-manager -sonar.exclusions=request-management-api/migrations/versions,request-management-api/tests +sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-web,notification-manager +sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= -sonar.branch.name=main-ST-sonarcloud -sonar.python.version=3.8 # Path to tests # sonar.tests= #sonar.test.exclusions= @@ -15,4 +13,4 @@ sonar.python.version=3.8 sonar.sourceEncoding=UTF-8 # Exclusions for copy-paste detection -sonar.cpd.exclusions=request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file +sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file From eef15b4ab085f7ca93a8c828c0e43cd07436159c Mon Sep 17 00:00:00 2001 From: nimya-aot Date: Wed, 13 Sep 2023 13:53:55 -0700 Subject: [PATCH 06/78] Version changes --- .github/workflows/katalon-ci.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/katalon-ci.yaml b/.github/workflows/katalon-ci.yaml index e90d1638b..1f01beceb 100644 --- a/.github/workflows/katalon-ci.yaml +++ b/.github/workflows/katalon-ci.yaml @@ -12,7 +12,7 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v3.0 + uses: actions/checkout@v2 with: ref: dev-automationscripts - name: set screen resolution @@ -35,9 +35,9 @@ jobs: dir shell: cmd - name: Katalon Studio Github Action - uses: katalon-studio/katalon-studio-github-action@v3.0 + uses: katalon-studio/katalon-studio-github-action@v2 with: - version: '8.2.0' + version: '8.6.6' projectPath: '${{ github.workspace }}/testing/foi-qa-automation/foi-qa-automation.prj' args: '-noSplash -retry=0 -testSuiteCollectionPath="Test Suites/foi-test" -apiKey=${{ secrets.KATALON_API_KEY }} --config -webui.autoUpdateDrivers=true -licenseRelease=true -browserType="Chrome" -proxy.auth.option=NO_PROXY -proxy.system.option=NO_PROXY -proxy.system.applyToDesiredCapabilities=true -executionProfile="dev" ' - name: copy reports to one folder @@ -50,15 +50,15 @@ jobs: dir shell: cmd - name: Setup Node.js - uses: actions/setup-node@v3.0 + uses: actions/setup-node@v2 with: - node-version: '14' + node-version: '16' - name: Create collection report run: | npm i -g xunit-viewer xunit-viewer -r artifacts\JUnit_Report.xml -o artifacts\foi-test.html - name: Archive Katalon report - uses: actions/upload-artifact@v3.0 + uses: actions/upload-artifact@v2 with: name: katalon-report path: artifacts From 52f15906e178153d4ae16e2fa4489d198d54285c Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Tue, 19 Sep 2023 11:49:33 -0400 Subject: [PATCH 07/78] added few logs to test #4460 issue --- .gitignore | 2 +- .../FOI/customComponents/Records/index.js | 32 ++++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5d90a726b..acb86feb8 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ request-management-api/request_api/__pycache__/__init__.cpython-38.pyc request-management-api/request_api/models/__pycache__/*.* request-management-api/migrations/__pycache__/*.* request-management-api/.env - +notification-manager/env/* *.pyc */__pycache__/* request-management-api/request_api/__pycache__/*.pyc diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/index.js b/forms-flow-web/src/components/FOI/customComponents/Records/index.js index 07306c026..0dac46ca7 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/index.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/index.js @@ -366,6 +366,9 @@ export const RecordsLog = ({ var deleteRecords = []; var deleteAttachemnts = []; if (updateAttachment) { + console.log( + `if updateAttachment = ${JSON.stringify(updateAttachment)}` + ); deleteRecords.push( (({ recordid, documentmasterid, s3uripath }) => ({ recordid, @@ -374,8 +377,10 @@ export const RecordsLog = ({ }))(updateAttachment) ); } else { + console.log(`else updateAttachment`); for (let record of records) { if (record.isselected) { + console.log(`if record.isselected`); deleteRecords.push( (({ recordid, documentmasterid, s3uripath }) => ({ recordid, @@ -384,6 +389,7 @@ export const RecordsLog = ({ }))(record) ); } else { + console.log(`else record.isselected`); for (let attachment of record.attachments) { if (attachment.isselected) { deleteAttachemnts.push(attachment.filepath); @@ -393,6 +399,7 @@ export const RecordsLog = ({ } } if (deleteRecords.length > 0) { + console.log(`deleteRecords.length = ${deleteRecords.length} `); dispatch( updateFOIRecords( requestId, @@ -1388,8 +1395,13 @@ export const RecordsLog = ({ //function to manage download for harms option const enableHarmsDonwnload = () => { - return !recordsObj.records.every(record => record.isredactionready || record.failed || isrecordtimeout(record.created_at, RECORD_PROCESSING_HRS)); - } + return !recordsObj.records.every( + (record) => + record.isredactionready || + record.failed || + isrecordtimeout(record.created_at, RECORD_PROCESSING_HRS) + ); + }; return (
@@ -1450,8 +1462,8 @@ export const RecordsLog = ({ disabled={item.disabled} sx={{ display: "flex" }} > - {!item.disabled ? - (isDownloadReady ? ( + {!item.disabled ? ( + isDownloadReady ? ( - ) : null) : (item.id === 1 && ())} + ) : null + ) : ( + item.id === 1 && ( + + ) + )} {item.label} ); From 9d49311ca27af91a66b0fe4a71ebf3dcfd565c1b Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Tue, 19 Sep 2023 12:33:52 -0400 Subject: [PATCH 08/78] added debug lines --- .../src/components/FOI/customComponents/Records/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/index.js b/forms-flow-web/src/components/FOI/customComponents/Records/index.js index 0dac46ca7..695232ad7 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/index.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/index.js @@ -390,6 +390,10 @@ export const RecordsLog = ({ ); } else { console.log(`else record.isselected`); + console.log(`record = ${JSON.stringify(record)}`); + console.log( + `record?.attachments?.length = ${record?.attachments?.length}` + ); for (let attachment of record.attachments) { if (attachment.isselected) { deleteAttachemnts.push(attachment.filepath); From f5689680e069185f4675da49d14fb88fef67af42 Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Tue, 19 Sep 2023 13:04:22 -0400 Subject: [PATCH 09/78] added/removed debug lines --- .../FOI/customComponents/Records/index.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/index.js b/forms-flow-web/src/components/FOI/customComponents/Records/index.js index 695232ad7..a997245da 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/index.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/index.js @@ -366,9 +366,6 @@ export const RecordsLog = ({ var deleteRecords = []; var deleteAttachemnts = []; if (updateAttachment) { - console.log( - `if updateAttachment = ${JSON.stringify(updateAttachment)}` - ); deleteRecords.push( (({ recordid, documentmasterid, s3uripath }) => ({ recordid, @@ -377,10 +374,8 @@ export const RecordsLog = ({ }))(updateAttachment) ); } else { - console.log(`else updateAttachment`); for (let record of records) { if (record.isselected) { - console.log(`if record.isselected`); deleteRecords.push( (({ recordid, documentmasterid, s3uripath }) => ({ recordid, @@ -390,13 +385,17 @@ export const RecordsLog = ({ ); } else { console.log(`else record.isselected`); - console.log(`record = ${JSON.stringify(record)}`); + console.log( + `record?.attachments = ${JSON.stringify(record?.attachments)}` + ); console.log( `record?.attachments?.length = ${record?.attachments?.length}` ); - for (let attachment of record.attachments) { - if (attachment.isselected) { - deleteAttachemnts.push(attachment.filepath); + if (record?.attachments) { + for (let attachment of record.attachments) { + if (attachment.isselected) { + deleteAttachemnts.push(attachment.filepath); + } } } } From babf48df6fd09c99e0ff924e28b35e0a7a89cc8a Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Tue, 19 Sep 2023 13:31:46 -0400 Subject: [PATCH 10/78] reverting the changes --- .../FOI/customComponents/Records/index.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/index.js b/forms-flow-web/src/components/FOI/customComponents/Records/index.js index a997245da..678fe49d3 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/index.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/index.js @@ -384,25 +384,15 @@ export const RecordsLog = ({ }))(record) ); } else { - console.log(`else record.isselected`); - console.log( - `record?.attachments = ${JSON.stringify(record?.attachments)}` - ); - console.log( - `record?.attachments?.length = ${record?.attachments?.length}` - ); - if (record?.attachments) { - for (let attachment of record.attachments) { - if (attachment.isselected) { - deleteAttachemnts.push(attachment.filepath); - } + for (let attachment of record.attachments) { + if (attachment.isselected) { + deleteAttachemnts.push(attachment.filepath); } } } } } if (deleteRecords.length > 0) { - console.log(`deleteRecords.length = ${deleteRecords.length} `); dispatch( updateFOIRecords( requestId, From 2817b791e0554f93ea8acff7b9bf1600b9e21773 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Wed, 20 Sep 2023 10:38:02 -0700 Subject: [PATCH 11/78] Debug sonar setup.. --- .sonarcloud.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 8fb5cc01f..d4a9e08d5 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,8 +1,8 @@ -sonar.projectName=foi-flow +#sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-web,notification-manager -sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests +#sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-web,notification-manager +#sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests # sonar.tests= @@ -10,7 +10,7 @@ sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request #sonar.test.inclusions= # Source encoding -sonar.sourceEncoding=UTF-8 +#sonar.sourceEncoding=UTF-8 # Exclusions for copy-paste detection -sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file +#sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file From 7c258f8cf744830cf47e789d4589e3ccdc9a60a0 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 12:48:16 -0700 Subject: [PATCH 12/78] Debug sonar setup.. --- .sonarcloud.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index d4a9e08d5..decf0751b 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,8 +1,8 @@ -#sonar.projectName=foi-flow +sonar.projectName=foi-flow # Path to sources -#sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-web,notification-manager -#sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests +sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-ai-web,notification-manager +sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests # sonar.tests= @@ -10,7 +10,7 @@ #sonar.test.inclusions= # Source encoding -#sonar.sourceEncoding=UTF-8 +sonar.sourceEncoding=UTF-8 # Exclusions for copy-paste detection -#sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file +sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file From e75dcd13fe116202fb929b799aea681c70fab471 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 12:52:48 -0700 Subject: [PATCH 13/78] Debug sonar setup.. --- .sonarcloud.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index decf0751b..09611fba0 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,4 +1,4 @@ -sonar.projectName=foi-flow +#sonar.projectName=foi-flow # Path to sources sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-ai-web,notification-manager @@ -10,7 +10,7 @@ sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request #sonar.test.inclusions= # Source encoding -sonar.sourceEncoding=UTF-8 +#sonar.sourceEncoding=UTF-8 # Exclusions for copy-paste detection sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file From e54cf81c3dd1dc10aeba727f47ab6940193c441c Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 12:54:58 -0700 Subject: [PATCH 14/78] Debug sonar setup.. --- .sonarcloud.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 09611fba0..aac1a7ea4 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,8 +1,8 @@ -#sonar.projectName=foi-flow +sonar.projectName=foi-flow # Path to sources sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-ai-web,notification-manager -sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests +#sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests # sonar.tests= @@ -13,4 +13,4 @@ sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request #sonar.sourceEncoding=UTF-8 # Exclusions for copy-paste detection -sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file +#sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file From 562a960bc4c3030aa3e09e7464dae3e41fb1623b Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 12:56:59 -0700 Subject: [PATCH 15/78] Debug sonar setup.. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index aac1a7ea4..43f2a5b23 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-ai-web,notification-manager +#sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-ai-web,notification-manager #sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From 2c3622db1a77a8535cfc5e36089de1c336e298b5 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 13:08:59 -0700 Subject: [PATCH 16/78] Debug sonar setup.. --- .sonarcloud.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 43f2a5b23..07e6598c6 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -2,7 +2,7 @@ sonar.projectName=foi-flow # Path to sources #sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-ai-web,notification-manager -#sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests +sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests # sonar.tests= @@ -10,7 +10,7 @@ sonar.projectName=foi-flow #sonar.test.inclusions= # Source encoding -#sonar.sourceEncoding=UTF-8 +sonar.sourceEncoding=UTF-8 # Exclusions for copy-paste detection -#sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file +sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file From 89c7582a9407883ee016f7415b42bcf2601bfd1b Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 13:20:40 -0700 Subject: [PATCH 17/78] Debug sonar setup.. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 07e6598c6..70751457e 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -#sonar.sources=request-management-api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-ai-web,notification-manager +sonar.sources=request-management-api/request_api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-ai-web,notification-manager sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From 7243731dafbdfb0511dc36b474fe42bc123bf517 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 13:21:37 -0700 Subject: [PATCH 18/78] Debug sonar setup.. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 70751457e..a439821ac 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api/request_api,apps/forms-flow-ai/forms-flow-bpm,apps/forms-flow-ai/forms-flow-ai-web,notification-manager +sonar.sources=request-management-api/request_api,apps/forms-flow-ai/forms-flow-bpm,forms-flow-web/src,notification-manager sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From 49f1c7bbc23ff2aba939e6aa85421fb51f82dd98 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 13:24:24 -0700 Subject: [PATCH 19/78] Debug sonar setup.. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index a439821ac..5f8dba9f2 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api/request_api,apps/forms-flow-ai/forms-flow-bpm,forms-flow-web/src,notification-manager +sonar.sources=request-management-api,forms-flow-web,notification-manager sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From bf90e542025bbe9a6bad1d7d1a2d2e67ee411132 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 13:28:09 -0700 Subject: [PATCH 20/78] Debug sonar setup.. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 5f8dba9f2..930998cd1 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api,forms-flow-web,notification-manager +sonar.sources=forms-flow-web,notification-manager sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From a623bcb813a859e347df2c2cdbb1ab8b5adf2a73 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 13:40:09 -0700 Subject: [PATCH 21/78] Debug sonar setup.. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 930998cd1..6b65ac6de 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=forms-flow-web,notification-manager +sonar.sources=forms-flow-web/src sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From d775aab28adc67a93af38c043a788ba0b8d92e25 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 13:43:10 -0700 Subject: [PATCH 22/78] Debug sonar setup..Debug sonar setup.. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 6b65ac6de..878851642 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=forms-flow-web/src +#sonar.sources=request-management-api/request_api,apps/forms-flow-ai/forms-flow-bpm,forms-flow-web/src,notification-manager sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From 47a0480320f4785b3726bfe872f158c42b004813 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 13:48:35 -0700 Subject: [PATCH 23/78] Debug sonar setup..Debug sonar setup.. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 878851642..f3c836e47 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -#sonar.sources=request-management-api/request_api,apps/forms-flow-ai/forms-flow-bpm,forms-flow-web/src,notification-manager +sonar.sources=request-management-api sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From 8be6e250fb40a870542d3eadfc484423cd229129 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 13:54:51 -0700 Subject: [PATCH 24/78] Debug sonar setup..Debug sonar setup.. --- .sonarcloud.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index f3c836e47..300e91674 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -2,7 +2,7 @@ sonar.projectName=foi-flow # Path to sources sonar.sources=request-management-api -sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests +sonar.exclusions=request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests # sonar.tests= @@ -13,4 +13,4 @@ sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request sonar.sourceEncoding=UTF-8 # Exclusions for copy-paste detection -sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file +sonar.cpd.exclusions=request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file From e53bd4659177fa775a4bd66782c8acf542c7eeaa Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 13:59:24 -0700 Subject: [PATCH 25/78] Debug sonar setup..Debug sonar setup.. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 300e91674..e082c022c 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api +sonar.sources=request-management-api/request-api sonar.exclusions=request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From c73abae51ac2b82a01e7890183d71c2ec2e65e04 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 14:02:30 -0700 Subject: [PATCH 26/78] Debug sonar setup..Debug sonar setup.. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index e082c022c..09b5cd909 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api/request-api +sonar.sources=request-management-api/request-api,notification-manager sonar.exclusions=request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From d1bea7266fb7f759378ea8149dc6c8d27b3c7f02 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 14:05:52 -0700 Subject: [PATCH 27/78] Debug sonar setup..Debug sonar setup.. Include notification manager. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 09b5cd909..768a852c3 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api/request-api,notification-manager +sonar.sources=request-management-api/request-api,notification-manager/notification_api sonar.exclusions=request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From 3d2876287634e6b864abbef5b204f2e4695e13ab Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 14:12:13 -0700 Subject: [PATCH 28/78] Debug sonar setup..Debug sonar setup.. Remove notificaiton manager and include forms-flow-web. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 768a852c3..61c400fd7 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api/request-api,notification-manager/notification_api +sonar.sources=request-management-api/request-api,forms-flow-web sonar.exclusions=request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From 020b0a8a70d1c0ddeb29e037c14ff65eb0406562 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 14:14:54 -0700 Subject: [PATCH 29/78] Debug sonar setup..Debug sonar setup.. Remove notificaiton manager and include forms-flow-web. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 61c400fd7..056d887dd 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api/request-api,forms-flow-web +sonar.sources=request-management-api/request-api,forms-flow-web/src sonar.exclusions=request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From e1156b052d1326397d1657675fe14567ffe11d19 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 14:18:16 -0700 Subject: [PATCH 30/78] Debug sonar setup..Debug sonar setup.. Remove all except request-api. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 056d887dd..e082c022c 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api/request-api,forms-flow-web/src +sonar.sources=request-management-api/request-api sonar.exclusions=request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From a21ba0fa8cc404b2bcffb6034af6a7a849465f58 Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 14:25:27 -0700 Subject: [PATCH 31/78] Changes to enable scan all. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index e082c022c..c17ddb3fc 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api/request-api +#sonar.sources=request-management-api/request_api,apps/forms-flow-ai/forms-flow-bpm,forms-flow-web/src,notification-manager sonar.exclusions=request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From ae04c457cb5c3cbfb16a884ceded5129f023634d Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Thu, 21 Sep 2023 14:32:27 -0700 Subject: [PATCH 32/78] Changes to enable scan all. skip. test in js --- .sonarcloud.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index c17ddb3fc..878851642 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -2,7 +2,7 @@ sonar.projectName=foi-flow # Path to sources #sonar.sources=request-management-api/request_api,apps/forms-flow-ai/forms-flow-bpm,forms-flow-web/src,notification-manager -sonar.exclusions=request-management-api/migrations/versions,request-management-api/tests +sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests # sonar.tests= @@ -13,4 +13,4 @@ sonar.exclusions=request-management-api/migrations/versions,request-management-a sonar.sourceEncoding=UTF-8 # Exclusions for copy-paste detection -sonar.cpd.exclusions=request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file +sonar.cpd.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests \ No newline at end of file From 8991523cfed16e193422509564beddb526b0f8dd Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Fri, 22 Sep 2023 09:55:03 -0700 Subject: [PATCH 33/78] Changes to enable scan by sources. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index 878851642..a439821ac 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -#sonar.sources=request-management-api/request_api,apps/forms-flow-ai/forms-flow-bpm,forms-flow-web/src,notification-manager +sonar.sources=request-management-api/request_api,apps/forms-flow-ai/forms-flow-bpm,forms-flow-web/src,notification-manager sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From 3a21aebfad62095b40027f05a9ee6b0d6b61e04c Mon Sep 17 00:00:00 2001 From: "sumathi.thirumani" Date: Fri, 22 Sep 2023 10:00:15 -0700 Subject: [PATCH 34/78] Changes to enable scan all sources. --- .sonarcloud.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sonarcloud.properties b/.sonarcloud.properties index a439821ac..878851642 100644 --- a/.sonarcloud.properties +++ b/.sonarcloud.properties @@ -1,7 +1,7 @@ sonar.projectName=foi-flow # Path to sources -sonar.sources=request-management-api/request_api,apps/forms-flow-ai/forms-flow-bpm,forms-flow-web/src,notification-manager +#sonar.sources=request-management-api/request_api,apps/forms-flow-ai/forms-flow-bpm,forms-flow-web/src,notification-manager sonar.exclusions=**/*.test.js,request-management-api/migrations/versions,request-management-api/tests #sonar.inclusions= # Path to tests From 15f79b5ffd2a24f3158604244a8415e5a0204b28 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Tue, 3 Oct 2023 11:55:26 -0700 Subject: [PATCH 35/78] Adjusted url to link to main help articles page --- forms-flow-web/src/components/FOI/Header/FOIHeader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms-flow-web/src/components/FOI/Header/FOIHeader.js b/forms-flow-web/src/components/FOI/Header/FOIHeader.js index 27bffaf0a..04493de2e 100644 --- a/forms-flow-web/src/components/FOI/Header/FOIHeader.js +++ b/forms-flow-web/src/components/FOI/Header/FOIHeader.js @@ -141,7 +141,7 @@ const adminDashboard = (_e) => { }
  • - +
  • From 065b9cbd3acf051ef1926aa57e6c9eb6ed9a3c12 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 19 Oct 2023 12:39:18 -0700 Subject: [PATCH 36/78] Remove unused import --- request-management-api/request_api/services/events/payment.py | 1 - 1 file changed, 1 deletion(-) diff --git a/request-management-api/request_api/services/events/payment.py b/request-management-api/request_api/services/events/payment.py index 78a543428..bb2ed1a65 100644 --- a/request-management-api/request_api/services/events/payment.py +++ b/request-management-api/request_api/services/events/payment.py @@ -14,7 +14,6 @@ from dateutil.parser import parse from pytz import timezone from request_api.utils.enums import PaymentEventType -from request_api.services.commons.duecalculator import duecalculator from request_api.utils.commons.datetimehandler import datetimehandler from request_api.exceptions import BusinessException from flask import current_app From eee0d090718d86a5f504bec26deece92e7bd3e45 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Mon, 23 Oct 2023 13:43:20 -0700 Subject: [PATCH 37/78] Change notification msg to use axisrequestid --- .../request_api/models/FOIRawRequests.py | 2 +- .../request_api/services/events/payment.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/request-management-api/request_api/models/FOIRawRequests.py b/request-management-api/request_api/models/FOIRawRequests.py index 257af5811..b7f9dd380 100644 --- a/request-management-api/request_api/models/FOIRawRequests.py +++ b/request-management-api/request_api/models/FOIRawRequests.py @@ -365,7 +365,7 @@ def getassignmenttransition(cls,requestid): def getonholdapplicationfeerequests(cls): # with the reminder date onholdapplicationfeerequests = [] try: - sql = '''SELECT * FROM (SELECT DISTINCT ON (requestid) requestid, (updated_at + INTERVAL '20 days') as reminder_date, status FROM public."FOIRawRequests" + sql = '''SELECT * FROM (SELECT DISTINCT ON (requestid) requestid, axisrequestid, (updated_at + INTERVAL '20 days') as reminder_date, status FROM public."FOIRawRequests" ORDER BY requestid ASC, version DESC) r WHERE r.status = 'On-Hold - Application Fee' ''' diff --git a/request-management-api/request_api/services/events/payment.py b/request-management-api/request_api/services/events/payment.py index bb2ed1a65..3c137d8ad 100644 --- a/request-management-api/request_api/services/events/payment.py +++ b/request-management-api/request_api/services/events/payment.py @@ -42,7 +42,7 @@ def createpaymentreminderevent(self): try: _today = datetimehandler().gettoday() - # notificationservice().dismissremindernotification("ministryrequest", self.__notificationtype()) + notificationservice().dismissremindernotification("rawrequest", self.__notificationtype()) # ca_holidays = duecalculator.getholidays() eventtype = PaymentEventType.reminder.value _onholdrequests = FOIRawRequest.getonholdapplicationfeerequests() @@ -50,7 +50,7 @@ def createpaymentreminderevent(self): _reminderdate = datetimehandler().formatdate(entry['reminder_date']) if _reminderdate == _today: self.__createnotificationforrawrequest(entry['requestid'], eventtype) - self.__createcommentforrawrequest(entry['requestid'], eventtype) + self.__createcommentforrawrequest(entry['axisrequestid'], eventtype) pass return DefaultMethodResult(True,'Payment reminder notifications created',_today) except BusinessException as exception: @@ -59,11 +59,11 @@ def createpaymentreminderevent(self): def __createcommentforrawrequest(self, requestid, eventtype): comment = self.__preparecomment(requestid, eventtype) - return commentservice().createrawrequestcomment(comment, "System", 2) + return commentservice().createrawrequestcomment(comment, "system", 2) def __createnotificationforrawrequest(self, requestid, eventtype): notification = self.__preparenotification(requestid, eventtype) - return notificationservice().createnotification({"message" : notification}, requestid, "rawrequest", "Payment", "System") + return notificationservice().createnotification({"message" : notification}, requestid, "rawrequest", "Payment", "system") def __createcomment(self, requestid, eventtype): comment = self.__preparecomment(requestid, eventtype) From 7332ec044f208ab1b121fe76d87824cc829f3d95 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 24 Oct 2023 09:57:25 -0700 Subject: [PATCH 38/78] Update sql to include only today's date --- .../request_api/models/FOIRawRequests.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/request-management-api/request_api/models/FOIRawRequests.py b/request-management-api/request_api/models/FOIRawRequests.py index b7f9dd380..eb528090d 100644 --- a/request-management-api/request_api/models/FOIRawRequests.py +++ b/request-management-api/request_api/models/FOIRawRequests.py @@ -365,9 +365,12 @@ def getassignmenttransition(cls,requestid): def getonholdapplicationfeerequests(cls): # with the reminder date onholdapplicationfeerequests = [] try: - sql = '''SELECT * FROM (SELECT DISTINCT ON (requestid) requestid, axisrequestid, (updated_at + INTERVAL '20 days') as reminder_date, status FROM public."FOIRawRequests" - ORDER BY requestid ASC, version DESC) r + sql = ''' + SELECT * FROM (SELECT DISTINCT ON (requestid) requestid, (updated_at + INTERVAL '20 days') as reminder_date, status FROM public."FOIRawRequests" + ORDER BY requestid ASC, version DESC) r WHERE r.status = 'On-Hold - Application Fee' + and r.reminder_date::date = now()::date + order by r.reminder_date asc ''' rs = db.session.execute(text(sql)) for row in rs: From 1d255da14263661f626f66923d343d3243711e62 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 24 Oct 2023 11:47:41 -0700 Subject: [PATCH 39/78] Add self.__notificationtype and fix messaging --- .../request_api/models/FOIRawRequests.py | 4 +--- .../request_api/services/events/payment.py | 10 ++++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/request-management-api/request_api/models/FOIRawRequests.py b/request-management-api/request_api/models/FOIRawRequests.py index eb528090d..5d7cc7377 100644 --- a/request-management-api/request_api/models/FOIRawRequests.py +++ b/request-management-api/request_api/models/FOIRawRequests.py @@ -373,9 +373,7 @@ def getonholdapplicationfeerequests(cls): # with the reminder date order by r.reminder_date asc ''' rs = db.session.execute(text(sql)) - for row in rs: - if row.status == 'On-Hold - Application Fee': - onholdapplicationfeerequests.append(row) + onholdapplicationfeerequests = rs except Exception as ex: logging.error(ex) raise ex diff --git a/request-management-api/request_api/services/events/payment.py b/request-management-api/request_api/services/events/payment.py index 3c137d8ad..0dfdf1932 100644 --- a/request-management-api/request_api/services/events/payment.py +++ b/request-management-api/request_api/services/events/payment.py @@ -50,8 +50,7 @@ def createpaymentreminderevent(self): _reminderdate = datetimehandler().formatdate(entry['reminder_date']) if _reminderdate == _today: self.__createnotificationforrawrequest(entry['requestid'], eventtype) - self.__createcommentforrawrequest(entry['axisrequestid'], eventtype) - pass + self.__createcommentforrawrequest(entry['requestid'], eventtype) return DefaultMethodResult(True,'Payment reminder notifications created',_today) except BusinessException as exception: current_app.logger.error("%s,%s" % ('Payment reminder Notification Error', exception.message)) @@ -63,7 +62,7 @@ def __createcommentforrawrequest(self, requestid, eventtype): def __createnotificationforrawrequest(self, requestid, eventtype): notification = self.__preparenotification(requestid, eventtype) - return notificationservice().createnotification({"message" : notification}, requestid, "rawrequest", "Payment", "system") + return notificationservice().createnotification({"message" : notification}, requestid, "rawrequest", self.__notificationtype, "system") def __createcomment(self, requestid, eventtype): comment = self.__preparecomment(requestid, eventtype) @@ -86,7 +85,7 @@ def __preparecomment(self, requestid, eventtype): elif eventtype == PaymentEventType.depositpaid.value: comment = {"comment": "Applicant has paid deposit. New LDD is " + FOIMinistryRequest.getduedate(requestid).strftime("%m/%d/%Y")} elif eventtype == PaymentEventType.reminder.value: - comment = {"comment": f"Request {requestid} - 20 business days has passed awaiting payment, you can consider closing the request as abandoned"} + comment = {"comment": "20 business days has passed awaiting payment, you can consider closing the request as abandoned"} else: comment = None if comment is not None: @@ -116,3 +115,6 @@ def __defaultuserid(self): def gettoday(self): now_pst = maya.parse(maya.now()).datetime(to_timezone='America/Vancouver', naive=False) return now_pst.strftime('%m/%d/%Y') + + def __notificationtype(self): + return "Payment" \ No newline at end of file From 544c79a62b5fb455b6565f251965decf3a068db1 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 24 Oct 2023 11:56:45 -0700 Subject: [PATCH 40/78] Fix function call --- request-management-api/request_api/services/events/payment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/request-management-api/request_api/services/events/payment.py b/request-management-api/request_api/services/events/payment.py index 0dfdf1932..cef581a14 100644 --- a/request-management-api/request_api/services/events/payment.py +++ b/request-management-api/request_api/services/events/payment.py @@ -62,7 +62,7 @@ def __createcommentforrawrequest(self, requestid, eventtype): def __createnotificationforrawrequest(self, requestid, eventtype): notification = self.__preparenotification(requestid, eventtype) - return notificationservice().createnotification({"message" : notification}, requestid, "rawrequest", self.__notificationtype, "system") + return notificationservice().createnotification({"message" : notification}, requestid, "rawrequest", self.__notificationtype(), "system") def __createcomment(self, requestid, eventtype): comment = self.__preparecomment(requestid, eventtype) From 0343476aef2ae13153feac341cd2261fff13fc8e Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 24 Oct 2023 12:03:58 -0700 Subject: [PATCH 41/78] Adjust interval to match business days --- request-management-api/request_api/models/FOIRawRequests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/request-management-api/request_api/models/FOIRawRequests.py b/request-management-api/request_api/models/FOIRawRequests.py index 5d7cc7377..2521aea26 100644 --- a/request-management-api/request_api/models/FOIRawRequests.py +++ b/request-management-api/request_api/models/FOIRawRequests.py @@ -366,7 +366,7 @@ def getonholdapplicationfeerequests(cls): # with the reminder date onholdapplicationfeerequests = [] try: sql = ''' - SELECT * FROM (SELECT DISTINCT ON (requestid) requestid, (updated_at + INTERVAL '20 days') as reminder_date, status FROM public."FOIRawRequests" + SELECT * FROM (SELECT DISTINCT ON (requestid) requestid, (updated_at + INTERVAL '28 days') as reminder_date, status FROM public."FOIRawRequests" ORDER BY requestid ASC, version DESC) r WHERE r.status = 'On-Hold - Application Fee' and r.reminder_date::date = now()::date From 6af1a00b6f3cbbc45545c87e9e184c8b5e2c8465 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 24 Oct 2023 13:57:23 -0700 Subject: [PATCH 42/78] Update SQL to use state changed date --- request-management-api/request_api/models/FOIRawRequests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/request-management-api/request_api/models/FOIRawRequests.py b/request-management-api/request_api/models/FOIRawRequests.py index 2521aea26..bbe7c1118 100644 --- a/request-management-api/request_api/models/FOIRawRequests.py +++ b/request-management-api/request_api/models/FOIRawRequests.py @@ -366,11 +366,11 @@ def getonholdapplicationfeerequests(cls): # with the reminder date onholdapplicationfeerequests = [] try: sql = ''' - SELECT * FROM (SELECT DISTINCT ON (requestid) requestid, (updated_at + INTERVAL '28 days') as reminder_date, status FROM public."FOIRawRequests" + SELECT * FROM (SELECT DISTINCT ON (requestid) requestid, updated_at, status FROM public."FOIRawRequests" ORDER BY requestid ASC, version DESC) r WHERE r.status = 'On-Hold - Application Fee' - and r.reminder_date::date = now()::date - order by r.reminder_date asc + AND r.updated_at::date BETWEEN NOW()::date - INTERVAL '35 DAY' AND NOW()::date + INTERVAL '1 DAY' + order by r.updated_at asc ''' rs = db.session.execute(text(sql)) onholdapplicationfeerequests = rs From bd9dc56ada4b0a38f6d0bbaca964cd3da16baf53 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 24 Oct 2023 14:00:22 -0700 Subject: [PATCH 43/78] Calculate relative to business days --- .../request_api/services/events/payment.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/request-management-api/request_api/services/events/payment.py b/request-management-api/request_api/services/events/payment.py index cef581a14..fd467e7be 100644 --- a/request-management-api/request_api/services/events/payment.py +++ b/request-management-api/request_api/services/events/payment.py @@ -15,6 +15,7 @@ from pytz import timezone from request_api.utils.enums import PaymentEventType from request_api.utils.commons.datetimehandler import datetimehandler +from request_api.services.commons.duecalculator import duecalculator from request_api.exceptions import BusinessException from flask import current_app @@ -43,12 +44,12 @@ def createpaymentreminderevent(self): _today = datetimehandler().gettoday() notificationservice().dismissremindernotification("rawrequest", self.__notificationtype()) - # ca_holidays = duecalculator.getholidays() eventtype = PaymentEventType.reminder.value _onholdrequests = FOIRawRequest.getonholdapplicationfeerequests() for entry in _onholdrequests: - _reminderdate = datetimehandler().formatdate(entry['reminder_date']) - if _reminderdate == _today: + _dateofstatechange = datetimehandler().formatdate(entry['updated_at']) + businessdayselapsed = duecalculator().getbusinessdaysbetween(_dateofstatechange) + if businessdayselapsed == 20 and duecalculator().isbusinessday(_today): self.__createnotificationforrawrequest(entry['requestid'], eventtype) self.__createcommentforrawrequest(entry['requestid'], eventtype) return DefaultMethodResult(True,'Payment reminder notifications created',_today) From 29c21bd64d1116d3fe86dfa0ce0179cd2d416d4e Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 24 Oct 2023 15:06:01 -0700 Subject: [PATCH 44/78] Change notification logic to include older requests --- .../request_api/services/events/payment.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/request-management-api/request_api/services/events/payment.py b/request-management-api/request_api/services/events/payment.py index fd467e7be..f3a864be1 100644 --- a/request-management-api/request_api/services/events/payment.py +++ b/request-management-api/request_api/services/events/payment.py @@ -49,9 +49,15 @@ def createpaymentreminderevent(self): for entry in _onholdrequests: _dateofstatechange = datetimehandler().formatdate(entry['updated_at']) businessdayselapsed = duecalculator().getbusinessdaysbetween(_dateofstatechange) - if businessdayselapsed == 20 and duecalculator().isbusinessday(_today): + if businessdayselapsed >= 20 and duecalculator().isbusinessday(_today): + commentexists = False + existingcomments = commentservice().getrawrequestcomments(entry['requestid']) + for comment in existingcomments: + if comment['text'] == '20 business days has passed awaiting payment, you can consider closing the request as abandoned': + commentexists = True + if not commentexists: + self.__createcommentforrawrequest(entry['requestid'], eventtype) self.__createnotificationforrawrequest(entry['requestid'], eventtype) - self.__createcommentforrawrequest(entry['requestid'], eventtype) return DefaultMethodResult(True,'Payment reminder notifications created',_today) except BusinessException as exception: current_app.logger.error("%s,%s" % ('Payment reminder Notification Error', exception.message)) From a6a75d7c98d58a4e572b0f6790da1940889a8726 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 24 Oct 2023 15:10:41 -0700 Subject: [PATCH 45/78] Update sql to include all older requests --- request-management-api/request_api/models/FOIRawRequests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/request-management-api/request_api/models/FOIRawRequests.py b/request-management-api/request_api/models/FOIRawRequests.py index bbe7c1118..91eb206b6 100644 --- a/request-management-api/request_api/models/FOIRawRequests.py +++ b/request-management-api/request_api/models/FOIRawRequests.py @@ -369,7 +369,7 @@ def getonholdapplicationfeerequests(cls): # with the reminder date SELECT * FROM (SELECT DISTINCT ON (requestid) requestid, updated_at, status FROM public."FOIRawRequests" ORDER BY requestid ASC, version DESC) r WHERE r.status = 'On-Hold - Application Fee' - AND r.updated_at::date BETWEEN NOW()::date - INTERVAL '35 DAY' AND NOW()::date + INTERVAL '1 DAY' + AND r.updated_at::date < NOW()::date - INTERVAL '15 DAY' order by r.updated_at asc ''' rs = db.session.execute(text(sql)) From 74b2ee9959276e3eb4f4274b60deb0b22cdb6cc4 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 24 Oct 2023 15:18:58 -0700 Subject: [PATCH 46/78] Remove hardcoded comparison --- request-management-api/request_api/services/events/payment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/request-management-api/request_api/services/events/payment.py b/request-management-api/request_api/services/events/payment.py index f3a864be1..61393d28d 100644 --- a/request-management-api/request_api/services/events/payment.py +++ b/request-management-api/request_api/services/events/payment.py @@ -53,7 +53,7 @@ def createpaymentreminderevent(self): commentexists = False existingcomments = commentservice().getrawrequestcomments(entry['requestid']) for comment in existingcomments: - if comment['text'] == '20 business days has passed awaiting payment, you can consider closing the request as abandoned': + if comment['text'] == self.__preparecomment(entry['requestid'], eventtype)['comment']: #checks if comment already exists commentexists = True if not commentexists: self.__createcommentforrawrequest(entry['requestid'], eventtype) From a79d2f0fe3c0f90aecee9fbbaa1fdaf859ca2890 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Tue, 24 Oct 2023 16:21:23 -0700 Subject: [PATCH 47/78] adjusted sql and eventservice logic to take into account holidays and weekends --- .../request_api/models/FOIRawRequests.py | 4 ++-- .../services/events/section5pending.py | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/request-management-api/request_api/models/FOIRawRequests.py b/request-management-api/request_api/models/FOIRawRequests.py index eb528090d..2eada38b0 100644 --- a/request-management-api/request_api/models/FOIRawRequests.py +++ b/request-management-api/request_api/models/FOIRawRequests.py @@ -1009,13 +1009,13 @@ def getlatestsection5pendings(cls): section5pendings = [] try: sql = """SELECT * FROM - (SELECT DISTINCT ON (requestid) requestid, created_at, version, status, to_char(created_at + INTERVAL '10 days', 'YYYY-MM-DD') as duedate, axisrequestid + (SELECT DISTINCT ON (requestid) requestid, created_at, version, status, axisrequestid FROM public."FOIRawRequests" ORDER BY requestid ASC, version DESC) foireqs WHERE foireqs.status = 'Section 5 Pending';""" rs = db.session.execute(text(sql)) for row in rs: - section5pendings.append({"requestid": row["requestid"], "duedate": row["duedate"], "version": row["version"], "statusname": row["status"], "created_at": row["created_at"], "axisrequestid": ["axisrequestid"]}) + section5pendings.append({"requestid": row["requestid"], "version": row["version"], "statusname": row["status"], "created_at": row["created_at"], "axisrequestid": ["axisrequestid"]}) except Exception as ex: logging.error(ex) raise ex diff --git a/request-management-api/request_api/services/events/section5pending.py b/request-management-api/request_api/services/events/section5pending.py index 3a76ad2b7..20450500e 100644 --- a/request-management-api/request_api/services/events/section5pending.py +++ b/request-management-api/request_api/services/events/section5pending.py @@ -7,7 +7,7 @@ from request_api.models.default_method_result import DefaultMethodResult from enum import Enum from request_api.exceptions import BusinessException -from datetime import datetime +from request_api.utils.commons.datetimehandler import datetimehandler from flask import current_app from dateutil.parser import parse @@ -21,12 +21,18 @@ def createdueevent(self): notificationservice().dismissremindernotification("rawrequest", self.__notificationtype()) section5pendings = FOIRawRequest.getlatestsection5pendings() for entry in section5pendings: - duedate = self.formatduedate(entry['duedate']) - message = None - if _today == duedate: + _dateofstatechange = datetimehandler().formatdate(entry['created_at']) + businessdayselapsed = self.getbusinessdaysbetween(_dateofstatechange) + if businessdayselapsed >= 10 and self.isbusinessday(_today): message = self.__passeddueremindermessage() - self.__createnotification(message, entry['requestid']) - self.__createcomment(entry, message) + commentexists = False + existingcomments = commentservice().getrawrequestcomments(entry['requestid']) + for comment in existingcomments: + if comment['text'] == message: #checks if comment already exists + commentexists = True + if not commentexists: + self.__createcomment(entry, message) + self.__createnotification(message, entry['requestid']) return DefaultMethodResult(True,'Section 5 Pending passed due notification created',_today) except BusinessException as exception: current_app.logger.error("%s,%s" % ('Section 5 Pending passed due notification Error', exception.message)) From a57b190eac0317b83b04e8874bf90159d8822e11 Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Tue, 24 Oct 2023 23:32:04 -0700 Subject: [PATCH 48/78] bug fix - non raw request saved in raw request table 4606 --- request-management-api/request_api/resources/request.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/request-management-api/request_api/resources/request.py b/request-management-api/request_api/resources/request.py index 7c76f84df..32a049d37 100644 --- a/request-management-api/request_api/resources/request.py +++ b/request-management-api/request_api/resources/request.py @@ -95,7 +95,8 @@ def post(requestid=None, actiontype=None): if int(requestid) and str(requestid) != "-1" : status = rawrequestservice().getstatus(updaterequest) - rawrequest = rawrequestservice().getrawrequest(requestid) + if status not in ['Intake in Progress', 'Closed', 'Redirect', 'Peer Review']: + raise ValueError('Invalid request state.') result = rawrequestservice().saverawrequestversion(updaterequest,requestid,assigneegroup,assignee,status,AuthHelper.getuserid(),assigneefirstname,assigneemiddlename,assigneelastname, actiontype) assignee = '' if(actiontype == 'assignee'): @@ -110,8 +111,8 @@ def post(requestid=None, actiontype=None): assignee = getassignee(assigneefirstname,assigneelastname,assigneegroup) asyncio.ensure_future(eventservice().postevent(result.identifier,"rawrequest",AuthHelper.getuserid(),AuthHelper.getusername(),AuthHelper.isministrymember(),assignee)) return {'status': result.success, 'message':result.message,'id':result.identifier} , 200 - except ValueError: - return {'status': 500, 'message':INVALID_REQUEST_ID}, 500 + except ValueError as valuexception: + return {'status': 500, 'message':str(valuexception)}, 500 except BusinessException as exception: return {'status': exception.status_code, 'message':exception.message}, 500 From 15ce876488a72c5c64b92049251eb0dc87c1f192 Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Wed, 25 Oct 2023 12:18:48 -0700 Subject: [PATCH 49/78] replace deprecated method --- .../applicantcorrespondence/applicantcorrespondencelog.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/request-management-api/request_api/services/applicantcorrespondence/applicantcorrespondencelog.py b/request-management-api/request_api/services/applicantcorrespondence/applicantcorrespondencelog.py index e1ce8290d..715ad9056 100644 --- a/request-management-api/request_api/services/applicantcorrespondence/applicantcorrespondencelog.py +++ b/request-management-api/request_api/services/applicantcorrespondence/applicantcorrespondencelog.py @@ -4,7 +4,7 @@ import maya import json -from html.parser import HTMLParser +import html from datetime import datetime class applicantcorrespondenceservice: @@ -57,8 +57,7 @@ def updateapplicantcorrespondencelog(self, correspondenceid, content): def getapplicantcorrespondencelogbyid(self, applicantcorrespondenceid): applicantcorrespondence = FOIApplicantCorrespondence.getapplicantcorrespondencebyid(applicantcorrespondenceid) (_correspondencemessagejson, _isjson) = self.__getjsonobject(applicantcorrespondence["correspondencemessagejson"]) - parser = HTMLParser() - emailhtml_decoded_string = parser.unescape(self.__getvaluefromjson(_correspondencemessagejson, 'emailhtml')) + emailhtml_decoded_string = html.unescape(self.__getvaluefromjson(_correspondencemessagejson, 'emailhtml')) return emailhtml_decoded_string if _isjson else _correspondencemessagejson def getlatestapplicantcorrespondence(self, ministryid): From b1732b6124f59b2757924905319a0164a0e93d88 Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Wed, 25 Oct 2023 14:14:17 -0700 Subject: [PATCH 50/78] 1. add two new states 2. production bug fix #4629 --- .../applicantcorrespondence/applicantcorrespondencelog.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/request-management-api/request_api/services/applicantcorrespondence/applicantcorrespondencelog.py b/request-management-api/request_api/services/applicantcorrespondence/applicantcorrespondencelog.py index e1ce8290d..cc265139b 100644 --- a/request-management-api/request_api/services/applicantcorrespondence/applicantcorrespondencelog.py +++ b/request-management-api/request_api/services/applicantcorrespondence/applicantcorrespondencelog.py @@ -4,7 +4,7 @@ import maya import json -from html.parser import HTMLParser +import html from datetime import datetime class applicantcorrespondenceservice: @@ -57,8 +57,7 @@ def updateapplicantcorrespondencelog(self, correspondenceid, content): def getapplicantcorrespondencelogbyid(self, applicantcorrespondenceid): applicantcorrespondence = FOIApplicantCorrespondence.getapplicantcorrespondencebyid(applicantcorrespondenceid) (_correspondencemessagejson, _isjson) = self.__getjsonobject(applicantcorrespondence["correspondencemessagejson"]) - parser = HTMLParser() - emailhtml_decoded_string = parser.unescape(self.__getvaluefromjson(_correspondencemessagejson, 'emailhtml')) + emailhtml_decoded_string = html.unescape(self.__getvaluefromjson(_correspondencemessagejson, 'emailhtml')) return emailhtml_decoded_string if _isjson else _correspondencemessagejson def getlatestapplicantcorrespondence(self, ministryid): From 3a61b83d8a5355011b825332c44f12f4e6f91289 Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Wed, 25 Oct 2023 14:14:35 -0700 Subject: [PATCH 51/78] two new states --- request-management-api/request_api/resources/request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/request-management-api/request_api/resources/request.py b/request-management-api/request_api/resources/request.py index 32a049d37..52fd52ba2 100644 --- a/request-management-api/request_api/resources/request.py +++ b/request-management-api/request_api/resources/request.py @@ -95,7 +95,7 @@ def post(requestid=None, actiontype=None): if int(requestid) and str(requestid) != "-1" : status = rawrequestservice().getstatus(updaterequest) - if status not in ['Intake in Progress', 'Closed', 'Redirect', 'Peer Review']: + if status not in ['Intake in Progress', 'Closed', 'Redirect', 'Peer Review', 'Section 5 Pending', 'On-Hold - Application Fee']: raise ValueError('Invalid request state.') result = rawrequestservice().saverawrequestversion(updaterequest,requestid,assigneegroup,assignee,status,AuthHelper.getuserid(),assigneefirstname,assigneemiddlename,assigneelastname, actiontype) assignee = '' From 7b406d96c74d95e863a4f74d997e46fa233ba6ea Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 26 Oct 2023 09:38:21 -0700 Subject: [PATCH 52/78] Change notification times for testing --- request-management-api/request_api/services/events/payment.py | 2 +- .../request_api/services/events/section5pending.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/request-management-api/request_api/services/events/payment.py b/request-management-api/request_api/services/events/payment.py index 61393d28d..f5143a2c4 100644 --- a/request-management-api/request_api/services/events/payment.py +++ b/request-management-api/request_api/services/events/payment.py @@ -49,7 +49,7 @@ def createpaymentreminderevent(self): for entry in _onholdrequests: _dateofstatechange = datetimehandler().formatdate(entry['updated_at']) businessdayselapsed = duecalculator().getbusinessdaysbetween(_dateofstatechange) - if businessdayselapsed >= 20 and duecalculator().isbusinessday(_today): + if businessdayselapsed >= 1 and duecalculator().isbusinessday(_today): commentexists = False existingcomments = commentservice().getrawrequestcomments(entry['requestid']) for comment in existingcomments: diff --git a/request-management-api/request_api/services/events/section5pending.py b/request-management-api/request_api/services/events/section5pending.py index 20450500e..3cdf1f201 100644 --- a/request-management-api/request_api/services/events/section5pending.py +++ b/request-management-api/request_api/services/events/section5pending.py @@ -23,7 +23,7 @@ def createdueevent(self): for entry in section5pendings: _dateofstatechange = datetimehandler().formatdate(entry['created_at']) businessdayselapsed = self.getbusinessdaysbetween(_dateofstatechange) - if businessdayselapsed >= 10 and self.isbusinessday(_today): + if businessdayselapsed >= 1 and self.isbusinessday(_today): message = self.__passeddueremindermessage() commentexists = False existingcomments = commentservice().getrawrequestcomments(entry['requestid']) From 7fc2f37c823a3be1feeec131ad02376f227fb2db Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 26 Oct 2023 11:15:43 -0700 Subject: [PATCH 53/78] Add .jpeg to file type --- forms-flow-web/src/constants/FOI/enum.js | 2 +- forms-flow-web/src/modules/FOI/foiRequestsReducer.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/forms-flow-web/src/constants/FOI/enum.js b/forms-flow-web/src/constants/FOI/enum.js index f7ddd3364..93db1d925 100644 --- a/forms-flow-web/src/constants/FOI/enum.js +++ b/forms-flow-web/src/constants/FOI/enum.js @@ -15,7 +15,7 @@ const MimeTypeList = Object.freeze({ 'image/bmp','image/gif','image/jpeg','image/png','image/svg+xml','image/tiff','image/webp', 'application/vnd.ms-excel.sheet.macroEnabled.12','.msg', '.eml', '.xls', '.xlsx', '.doc', '.docx', '.ics','.json', '.shx', '.shp','.dbf','.kml','.kmz','.geojson','.cpg','.prj','.sbn','.sbx','.gml','.gdb','.freelist','.atx','.gpkg','.mbtiles','.mpk','.wkt', - '.las','.lasd','.laz','.dwf','.dwg','.dxf','.csv','.txt','.png','.jpg'], + '.las','.lasd','.laz','.dwf','.dwg','.dxf','.csv','.txt','.png','.jpg', '.jpeg'], extensionAttachment: ['application/pdf', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/msword', '.msg', '.eml', 'image/jpeg', diff --git a/forms-flow-web/src/modules/FOI/foiRequestsReducer.js b/forms-flow-web/src/modules/FOI/foiRequestsReducer.js index 7317d7a17..c533e0556 100644 --- a/forms-flow-web/src/modules/FOI/foiRequestsReducer.js +++ b/forms-flow-web/src/modules/FOI/foiRequestsReducer.js @@ -95,7 +95,7 @@ const initialState = { 'image/bmp','image/gif','image/jpeg','image/png','image/svg+xml','image/tiff','image/webp', 'application/vnd.ms-excel.sheet.macroEnabled.12','.msg', '.eml', '.xls', '.xlsx', '.doc', '.docx', '.ics','.json', '.shx', '.shp','.dbf','.kml','.kmz','.geojson','.cpg','.prj','.sbn','.sbx','.gml','.gdb','.freelist','.atx','.gpkg','.mbtiles','.mpk','.wkt', - '.las','.lasd','.laz','.dwf','.dwg','.dxf','.csv','.txt','.png','.jpg'], + '.las','.lasd','.laz','.dwf','.dwg','.dxf','.csv','.txt','.png','.jpg', '.jpeg'], conversionFormats: [], }; From e4b51836a5bad8dfbe81f3143e7977774be654ce Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Thu, 26 Oct 2023 14:26:25 -0700 Subject: [PATCH 54/78] Change tab header to fixed width and remove Applicant Contact tab --- forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js | 1 + .../MinistryReview/MinistryReviewTabbedContainer.scss | 2 +- .../src/components/FOI/FOIRequest/TabbedContainer.scss | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 2c463b12a..27b6653c8 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -791,6 +791,7 @@ const FOIRequest = React.memo(({ userDetail }) => { return (requestState !== StateEnum.intakeinprogress.name && requestState !== StateEnum.unopened.name && requestState !== StateEnum.open.name && + requestState !== StateEnum.onholdapplicationfee.name && requestDetails?.requestType === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_GENERAL) } diff --git a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReviewTabbedContainer.scss b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReviewTabbedContainer.scss index 8bca27a86..fd1a57bdc 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReviewTabbedContainer.scss +++ b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReviewTabbedContainer.scss @@ -149,7 +149,7 @@ } .foitabheadercollection { - width: fit-content; + width: 200px; // height: calc(100% - 96px - 67px); // height: 100%; border-radius: 0px 30px 30px 0px!important; diff --git a/forms-flow-web/src/components/FOI/FOIRequest/TabbedContainer.scss b/forms-flow-web/src/components/FOI/FOIRequest/TabbedContainer.scss index c7c6e8018..2109e8674 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/TabbedContainer.scss +++ b/forms-flow-web/src/components/FOI/FOIRequest/TabbedContainer.scss @@ -49,7 +49,7 @@ } .foitabheadercollection { - width: fit-content; + width: 200px; // height: calc(100% - 96px - 67px); // height: 100%; border-radius: 0px 30px 30px 0px!important; From c9ad6c3d792270db57c5962fa21888fe1edee9bb Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Fri, 27 Oct 2023 09:14:11 -0700 Subject: [PATCH 55/78] Change sql to retrieve all requests in on-hold appfee state --- request-management-api/request_api/models/FOIRawRequests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/request-management-api/request_api/models/FOIRawRequests.py b/request-management-api/request_api/models/FOIRawRequests.py index 2a37de197..9c7fa98b1 100644 --- a/request-management-api/request_api/models/FOIRawRequests.py +++ b/request-management-api/request_api/models/FOIRawRequests.py @@ -369,7 +369,6 @@ def getonholdapplicationfeerequests(cls): # with the reminder date SELECT * FROM (SELECT DISTINCT ON (requestid) requestid, updated_at, status FROM public."FOIRawRequests" ORDER BY requestid ASC, version DESC) r WHERE r.status = 'On-Hold - Application Fee' - AND r.updated_at::date < NOW()::date - INTERVAL '15 DAY' order by r.updated_at asc ''' rs = db.session.execute(text(sql)) From 4177e82c54280a92270770c93357e3a66da6131f Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Fri, 27 Oct 2023 15:56:35 -0700 Subject: [PATCH 56/78] revised 1491b3126887 and a79cd809e85e migrations scripts to remove hardcoding of ids --- .../1491b3126887_add_on_hold_application_fee_state_to_.py | 4 ++-- .../migrations/versions/a79cd809e85e_.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/request-management-api/migrations/versions/1491b3126887_add_on_hold_application_fee_state_to_.py b/request-management-api/migrations/versions/1491b3126887_add_on_hold_application_fee_state_to_.py index 368532898..30e648b1b 100644 --- a/request-management-api/migrations/versions/1491b3126887_add_on_hold_application_fee_state_to_.py +++ b/request-management-api/migrations/versions/1491b3126887_add_on_hold_application_fee_state_to_.py @@ -18,11 +18,11 @@ def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - sql = '''INSERT INTO "FOIRequestStatuses" (requeststatusid, name, description, isactive) VALUES (19, 'On-Hold - Application Fee', 'On Hold for Application Fee', true)''' + sql = '''INSERT INTO "FOIRequestStatuses" (name, description, isactive) VALUES ('On-Hold - Application Fee', 'On Hold for Application Fee', true)''' op.execute(sql) def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - sql = '''DELETE FROM "FOIRequestStatuses" WHERE requeststatusid = 19''' + sql = '''DELETE FROM "FOIRequestStatuses" WHERE name = 'On-Hold - Application Fee';''' op.execute(sql) \ No newline at end of file diff --git a/request-management-api/migrations/versions/a79cd809e85e_.py b/request-management-api/migrations/versions/a79cd809e85e_.py index 607788802..5c6efbc57 100644 --- a/request-management-api/migrations/versions/a79cd809e85e_.py +++ b/request-management-api/migrations/versions/a79cd809e85e_.py @@ -16,11 +16,11 @@ def upgrade(): - op.execute('INSERT INTO public."FOIRequestStatuses"(requeststatusid, name, description, isactive) VALUES (20, \'Section 5 Pending\', \'Section 5 Pending (Personal)\', true);commit;') - op.execute('INSERT INTO public."NotificationTypes"(notificationtypeid, name, description, isactive) VALUES (20, \'Section 5 Pending Reminder\', \'Section 5 Pending Reminder\', true);commit;') + op.execute('INSERT INTO public."FOIRequestStatuses"(name, description, isactive) VALUES (\'Section 5 Pending\', \'Section 5 Pending (Personal)\', true);commit;') + op.execute('INSERT INTO public."NotificationTypes"(name, description, isactive) VALUES (\'Section 5 Pending Reminder\', \'Section 5 Pending Reminder\', true);commit;') def downgrade(): - op.execute('DELETE FROM public."FOIRequestStatuses" WHERE requeststatusid = 20;commit;') - op.execute('DELETE FROM public."NotificationTypes" WHERE notificationtypeid = 20;commit;') + op.execute('DELETE FROM public."FOIRequestStatuses" WHERE name = \'Section 5 Pending\';commit;') + op.execute('DELETE FROM public."NotificationTypes" WHERE name = \'Section 5 Pending Reminder\';commit;') From ea4be17b19318cc6dff55f4862dfeaf3b362a483 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Mon, 30 Oct 2023 10:19:41 -0700 Subject: [PATCH 57/78] Revised notifcation reminder days back to normal (previously changed to >= 1 day to allow for testing/QA --- request-management-api/request_api/services/events/payment.py | 2 +- .../request_api/services/events/section5pending.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/request-management-api/request_api/services/events/payment.py b/request-management-api/request_api/services/events/payment.py index f5143a2c4..61393d28d 100644 --- a/request-management-api/request_api/services/events/payment.py +++ b/request-management-api/request_api/services/events/payment.py @@ -49,7 +49,7 @@ def createpaymentreminderevent(self): for entry in _onholdrequests: _dateofstatechange = datetimehandler().formatdate(entry['updated_at']) businessdayselapsed = duecalculator().getbusinessdaysbetween(_dateofstatechange) - if businessdayselapsed >= 1 and duecalculator().isbusinessday(_today): + if businessdayselapsed >= 20 and duecalculator().isbusinessday(_today): commentexists = False existingcomments = commentservice().getrawrequestcomments(entry['requestid']) for comment in existingcomments: diff --git a/request-management-api/request_api/services/events/section5pending.py b/request-management-api/request_api/services/events/section5pending.py index 3cdf1f201..20450500e 100644 --- a/request-management-api/request_api/services/events/section5pending.py +++ b/request-management-api/request_api/services/events/section5pending.py @@ -23,7 +23,7 @@ def createdueevent(self): for entry in section5pendings: _dateofstatechange = datetimehandler().formatdate(entry['created_at']) businessdayselapsed = self.getbusinessdaysbetween(_dateofstatechange) - if businessdayselapsed >= 1 and self.isbusinessday(_today): + if businessdayselapsed >= 10 and self.isbusinessday(_today): message = self.__passeddueremindermessage() commentexists = False existingcomments = commentservice().getrawrequestcomments(entry['requestid']) From 768a4ccd786c1f26c9021c7ca36aaca191b6ffb9 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Mon, 30 Oct 2023 10:46:11 -0700 Subject: [PATCH 58/78] Change notif times back to real values --- request-management-api/request_api/services/events/payment.py | 2 +- .../request_api/services/events/section5pending.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/request-management-api/request_api/services/events/payment.py b/request-management-api/request_api/services/events/payment.py index f5143a2c4..61393d28d 100644 --- a/request-management-api/request_api/services/events/payment.py +++ b/request-management-api/request_api/services/events/payment.py @@ -49,7 +49,7 @@ def createpaymentreminderevent(self): for entry in _onholdrequests: _dateofstatechange = datetimehandler().formatdate(entry['updated_at']) businessdayselapsed = duecalculator().getbusinessdaysbetween(_dateofstatechange) - if businessdayselapsed >= 1 and duecalculator().isbusinessday(_today): + if businessdayselapsed >= 20 and duecalculator().isbusinessday(_today): commentexists = False existingcomments = commentservice().getrawrequestcomments(entry['requestid']) for comment in existingcomments: diff --git a/request-management-api/request_api/services/events/section5pending.py b/request-management-api/request_api/services/events/section5pending.py index 3cdf1f201..20450500e 100644 --- a/request-management-api/request_api/services/events/section5pending.py +++ b/request-management-api/request_api/services/events/section5pending.py @@ -23,7 +23,7 @@ def createdueevent(self): for entry in section5pendings: _dateofstatechange = datetimehandler().formatdate(entry['created_at']) businessdayselapsed = self.getbusinessdaysbetween(_dateofstatechange) - if businessdayselapsed >= 1 and self.isbusinessday(_today): + if businessdayselapsed >= 10 and self.isbusinessday(_today): message = self.__passeddueremindermessage() commentexists = False existingcomments = commentservice().getrawrequestcomments(entry['requestid']) From 94d2545e857cd40ffb5deb900a149de559ff53f0 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Mon, 30 Oct 2023 14:38:20 -0700 Subject: [PATCH 59/78] Update on-hold state name to App Fee Owing --- .../FOI/FOIRequest/BottomButtonGroup/index.js | 2 +- .../src/components/FOI/FOIRequest/FOIRequest.js | 2 +- .../src/components/FOI/FOIRequest/TabbedContainer.scss | 2 +- forms-flow-web/src/components/FOI/FOIRequest/utils.js | 4 ++-- .../FOI/customComponents/ConfirmationModal/util.js | 4 ++-- .../components/FOI/customComponents/StateDropDown.js | 4 ++-- .../components/FOI/customComponents/statedropdown.scss | 2 +- forms-flow-web/src/constants/FOI/statusEnum.js | 6 +++--- ...91b3126887_add_on_hold_application_fee_state_to_.py | 4 ++-- .../request_api/models/FOIRawRequests.py | 10 +++++----- .../request_api/resources/request.py | 2 +- .../request_api/services/events/payment.py | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js index 96c30d6a9..5c301c061 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/BottomButtonGroup/index.js @@ -350,7 +350,7 @@ const BottomButtonGroup = React.memo( case StateEnum.readytoscan.name: case StateEnum.peerreview.name: case StateEnum.section5pending.name: - case StateEnum.onholdapplicationfee.name: + case StateEnum.appfeeowing.name: const status = Object.values(StateEnum).find( (statusValue) => statusValue.name === currentSelectedStatus ); diff --git a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js index 27b6653c8..5c324a493 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js @@ -791,7 +791,7 @@ const FOIRequest = React.memo(({ userDetail }) => { return (requestState !== StateEnum.intakeinprogress.name && requestState !== StateEnum.unopened.name && requestState !== StateEnum.open.name && - requestState !== StateEnum.onholdapplicationfee.name && + requestState !== StateEnum.appfeeowing.name && requestDetails?.requestType === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_GENERAL) } diff --git a/forms-flow-web/src/components/FOI/FOIRequest/TabbedContainer.scss b/forms-flow-web/src/components/FOI/FOIRequest/TabbedContainer.scss index 2109e8674..afde8ffbb 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/TabbedContainer.scss +++ b/forms-flow-web/src/components/FOI/FOIRequest/TabbedContainer.scss @@ -69,7 +69,7 @@ background-color: #C45303; } - .foitabheaderIntakeInProgressBG, .foitabheaderOnHoldApplicationFeeBG, .foitabheaderSection5Pending { + .foitabheaderIntakeInProgressBG, .foitabheaderAppFeeOwingBG, .foitabheaderSection5Pending { background-color: #8C3601; } diff --git a/forms-flow-web/src/components/FOI/FOIRequest/utils.js b/forms-flow-web/src/components/FOI/FOIRequest/utils.js index 2542c7f06..f4aa33500 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/utils.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/utils.js @@ -135,8 +135,8 @@ export const getTabBG = (_tabStatus, _requestState) => { return "foitabheadercollection foitabheaderReadytoScanBG"; case StateEnum.section5pending.name: return "foitabheadercollection foitabheaderSection5Pending"; - case StateEnum.onholdapplicationfee.name: - return "foitabheadercollection foitabheaderOnHoldApplicationFeeBG"; + case StateEnum.appfeeowing.name: + return "foitabheadercollection foitabheaderAppFeeOwingBG"; default: return "foitabheadercollection foitabheaderdefaultBG"; diff --git a/forms-flow-web/src/components/FOI/customComponents/ConfirmationModal/util.js b/forms-flow-web/src/components/FOI/customComponents/ConfirmationModal/util.js index 20cef4232..c24c79a58 100644 --- a/forms-flow-web/src/components/FOI/customComponents/ConfirmationModal/util.js +++ b/forms-flow-web/src/components/FOI/customComponents/ConfirmationModal/util.js @@ -126,8 +126,8 @@ import { getFullnameList } from "../../../../helper/FOI/helper"; return {title: "Ministry Sign Off", body: `Upload eApproval Logs, and enter in required approval fields to verify Ministry Approval and then change the state.`}; else return {title: "Changing the state", body: `Are you sure you want to change Request #${_requestNumber} to ${StateEnum.response.name}?`}; - case StateEnum.onholdapplicationfee.name.toLowerCase(): - return {title: "Changing the state", body: `Are you sure you want to change Request #${_requestNumber} to ${StateEnum.onholdapplicationfee.name}?`}; + case StateEnum.appfeeowing.name.toLowerCase(): + return {title: "Changing the state", body: `Are you sure you want to change Request #${_requestNumber} to ${StateEnum.appfeeowing.name}?`}; default: return {title: "", body: ""}; } diff --git a/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js b/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js index 90f957c96..c0355fa1c 100644 --- a/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js +++ b/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js @@ -175,8 +175,8 @@ const StateDropDown = ({ return _stateList.section5pending; } break - case StateEnum.onholdapplicationfee.name.toLowerCase(): - return _stateList.onholdapplicationfee; + case StateEnum.appfeeowing.name.toLowerCase(): + return _stateList.appfeeowing; default: return []; diff --git a/forms-flow-web/src/components/FOI/customComponents/statedropdown.scss b/forms-flow-web/src/components/FOI/customComponents/statedropdown.scss index ae7e7f1b1..f38a748e4 100644 --- a/forms-flow-web/src/components/FOI/customComponents/statedropdown.scss +++ b/forms-flow-web/src/components/FOI/customComponents/statedropdown.scss @@ -62,7 +62,7 @@ background-color: #595959; } -.on-hold-applicationfee { +.appfeeowing { background-color: #8C3601; } diff --git a/forms-flow-web/src/constants/FOI/statusEnum.js b/forms-flow-web/src/constants/FOI/statusEnum.js index 8242d858c..67f6bed93 100644 --- a/forms-flow-web/src/constants/FOI/statusEnum.js +++ b/forms-flow-web/src/constants/FOI/statusEnum.js @@ -1,6 +1,6 @@ const StateList = Object.freeze({ unopened: [{status: "Unopened", isSelected: false}, {status:"Intake in Progress", isSelected: false}], - intakeinprogress: [{status:"Intake in Progress", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "On-Hold - Application Fee", isSelected: false}, {status: "Closed", isSelected: false}], + intakeinprogress: [{status:"Intake in Progress", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "App Fee Owing", isSelected: false}, {status: "Closed", isSelected: false}], intakeinprogressforpersonals: [{status:"Intake in Progress", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "Section 5 Pending", isSelected: false}, {status: "Closed", isSelected: false}], redirect: [{status: "Redirect", isSelected: false}, {status:"Intake in Progress", isSelected: false}, {status: "Closed", isSelected: false}], open: [{status: "Open", isSelected: false}, {status: "Call For Records", isSelected: false}, {status:"Peer Review", isSelected: false},{status: "Closed", isSelected: false}], @@ -22,7 +22,7 @@ const StateList = Object.freeze({ //peerreview: [{status:"Peer Review", isSelected: false},{status:"Intake in Progress", isSelected: false}, {status: "Open", isSelected: false},{status: "Records Review", isSelected: false},{status: "Consult", isSelected: false},{status: "Response", isSelected: false}], peerreview: [{status:"Peer Review", isSelected: false}], section5pending: [{status: "Section 5 Pending", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "Closed", isSelected: false}], - onholdapplicationfee: [{status: "On-Hold - Application Fee", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "Closed", isSelected: false}] + appfeeowing: [{status: "App Fee Owing", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "Closed", isSelected: false}] }); const MinistryStateList = Object.freeze({ @@ -67,7 +67,7 @@ const StateEnum = Object.freeze({ peerreview: {name: "Peer Review", id: 16}, tagging: {name: "Tagging", id: 17}, readytoscan: {name: "Ready to Scan", id: 18}, - onholdapplicationfee: {name: "On-Hold - Application Fee", id: 19}, + appfeeowing: {name: "App Fee Owing", id: 19}, section5pending: {name: "Section 5 Pending", id: 20}, }); diff --git a/request-management-api/migrations/versions/1491b3126887_add_on_hold_application_fee_state_to_.py b/request-management-api/migrations/versions/1491b3126887_add_on_hold_application_fee_state_to_.py index 30e648b1b..764d47db9 100644 --- a/request-management-api/migrations/versions/1491b3126887_add_on_hold_application_fee_state_to_.py +++ b/request-management-api/migrations/versions/1491b3126887_add_on_hold_application_fee_state_to_.py @@ -18,11 +18,11 @@ def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - sql = '''INSERT INTO "FOIRequestStatuses" (name, description, isactive) VALUES ('On-Hold - Application Fee', 'On Hold for Application Fee', true)''' + sql = '''INSERT INTO "FOIRequestStatuses" (name, description, isactive) VALUES ('App Fee Owing', 'On Hold for Application Fee', true)''' op.execute(sql) def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - sql = '''DELETE FROM "FOIRequestStatuses" WHERE name = 'On-Hold - Application Fee';''' + sql = '''DELETE FROM "FOIRequestStatuses" WHERE name = 'App Fee Owing';''' op.execute(sql) \ No newline at end of file diff --git a/request-management-api/request_api/models/FOIRawRequests.py b/request-management-api/request_api/models/FOIRawRequests.py index 9c7fa98b1..9a0169647 100644 --- a/request-management-api/request_api/models/FOIRawRequests.py +++ b/request-management-api/request_api/models/FOIRawRequests.py @@ -362,23 +362,23 @@ def getassignmenttransition(cls,requestid): return assignments @classmethod - def getonholdapplicationfeerequests(cls): # with the reminder date - onholdapplicationfeerequests = [] + def getappfeeowingrequests(cls): # with the reminder date + appfeeowingrequests = [] try: sql = ''' SELECT * FROM (SELECT DISTINCT ON (requestid) requestid, updated_at, status FROM public."FOIRawRequests" ORDER BY requestid ASC, version DESC) r - WHERE r.status = 'On-Hold - Application Fee' + WHERE r.status = 'App Fee Owing' order by r.updated_at asc ''' rs = db.session.execute(text(sql)) - onholdapplicationfeerequests = rs + appfeeowingrequests = rs except Exception as ex: logging.error(ex) raise ex finally: db.session.close() - return onholdapplicationfeerequests + return appfeeowingrequests @classmethod def getversionforrequest(cls,requestid): diff --git a/request-management-api/request_api/resources/request.py b/request-management-api/request_api/resources/request.py index 52fd52ba2..cfc9fc012 100644 --- a/request-management-api/request_api/resources/request.py +++ b/request-management-api/request_api/resources/request.py @@ -95,7 +95,7 @@ def post(requestid=None, actiontype=None): if int(requestid) and str(requestid) != "-1" : status = rawrequestservice().getstatus(updaterequest) - if status not in ['Intake in Progress', 'Closed', 'Redirect', 'Peer Review', 'Section 5 Pending', 'On-Hold - Application Fee']: + if status not in ['Intake in Progress', 'Closed', 'Redirect', 'Peer Review', 'Section 5 Pending', 'App Fee Owing']: raise ValueError('Invalid request state.') result = rawrequestservice().saverawrequestversion(updaterequest,requestid,assigneegroup,assignee,status,AuthHelper.getuserid(),assigneefirstname,assigneemiddlename,assigneelastname, actiontype) assignee = '' diff --git a/request-management-api/request_api/services/events/payment.py b/request-management-api/request_api/services/events/payment.py index 61393d28d..6263e5a8a 100644 --- a/request-management-api/request_api/services/events/payment.py +++ b/request-management-api/request_api/services/events/payment.py @@ -45,7 +45,7 @@ def createpaymentreminderevent(self): notificationservice().dismissremindernotification("rawrequest", self.__notificationtype()) eventtype = PaymentEventType.reminder.value - _onholdrequests = FOIRawRequest.getonholdapplicationfeerequests() + _onholdrequests = FOIRawRequest.getappfeeowingrequests() for entry in _onholdrequests: _dateofstatechange = datetimehandler().formatdate(entry['updated_at']) businessdayselapsed = duecalculator().getbusinessdaysbetween(_dateofstatechange) From 932e683ff15b3508497e552a39adefb5df61b6eb Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Tue, 31 Oct 2023 10:00:45 -0700 Subject: [PATCH 60/78] Update states for peerreview --- .../src/components/FOI/customComponents/StateDropDown.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js b/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js index c0355fa1c..459aa806b 100644 --- a/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js +++ b/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js @@ -121,6 +121,8 @@ const StateDropDown = ({ return _stateList.consult; else if(previousState === StateEnum.response.name) return _stateList.response; + else if(previousState === StateEnum.appfeeowing.name) + return _stateList.appfeeowing } else{ return _stateList.peerreview; From 341f62ff90311184004688a448bdc1a0279225d2 Mon Sep 17 00:00:00 2001 From: nkan-aot <96087745+nkan-aot@users.noreply.github.com> Date: Tue, 31 Oct 2023 10:11:22 -0700 Subject: [PATCH 61/78] fix issue if birthdate field does not exist --- .../services/rawrequest/rawrequestservicegetter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/request-management-api/request_api/services/rawrequest/rawrequestservicegetter.py b/request-management-api/request_api/services/rawrequest/rawrequestservicegetter.py index 6134b7df6..bb56f9317 100644 --- a/request-management-api/request_api/services/rawrequest/rawrequestservicegetter.py +++ b/request-management-api/request_api/services/rawrequest/rawrequestservicegetter.py @@ -179,7 +179,7 @@ def __prepareadditionalpersonalinfo(self, requestrawdata): return { 'alsoKnownAs': contactinfo['alsoKnownAs'], 'requestFor': requestrawdata['selectAbout'], - 'birthDate': parse(contactinfo['birthDate']).strftime(self.__generaldateformat()) if contactinfo['birthDate'] is not None else '', + 'birthDate': parse(contactinfo['birthDate']).strftime(self.__generaldateformat()) if contactinfo.get('birthDate', None) is not None else '', 'childFirstName': self.__getpropertyvalue(childinformation,'firstName', haschildinfo), 'childMiddleName': self.__getpropertyvalue(childinformation,'middleName', haschildinfo), @@ -227,4 +227,4 @@ def __ispersonalinfopresent(self, criteria): return True if criteria != None else False def __generaldateformat(self): - return '%Y-%m-%d' \ No newline at end of file + return '%Y-%m-%d' From 45b03bb350b3601fae579199aaa500c0cd2789cc Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Fri, 10 Nov 2023 13:27:20 -0500 Subject: [PATCH 62/78] hot fix for harms download attachment not included issue --- .../FOI/customComponents/Records/index.js | 314 ++++++++++++------ 1 file changed, 204 insertions(+), 110 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/index.js b/forms-flow-web/src/components/FOI/customComponents/Records/index.js index 825ce3d26..764b4ec1f 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/index.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/index.js @@ -122,8 +122,8 @@ import { isScanningTeam } from "../../../../helper/FOI/helper"; import { MinistryNeedsScanning } from "../../../../constants/FOI/enum"; //import {convertBytesToMB} from "../../../../components/FOI/customComponents/FileUpload/util"; import FOI_COMPONENT_CONSTANTS from "../../../../constants/FOI/foiComponentConstants"; -import MCFPersonal from './MCFPersonal'; -import MSDPersonal from './MSDPersonal'; +import MCFPersonal from "./MCFPersonal"; +import MSDPersonal from "./MSDPersonal"; const useStyles = makeStyles((_theme) => ({ createButton: { @@ -224,14 +224,12 @@ export const RecordsLog = ({ isMinistryCoordinator, setRecordsUploading, recordsTabSelect, - requestType + requestType, }) => { const user = useSelector((state) => state.user.userDetail); - const userGroups = user?.groups?.map(group => group.slice(1)); - - let recordsObj = useSelector( - (state) => state.foiRequests.foiRequestRecords - ); + const userGroups = user?.groups?.map((group) => group.slice(1)); + + let recordsObj = useSelector((state) => state.foiRequests.foiRequestRecords); let pdfStitchStatus = useSelector( (state) => state.foiRequests.foiPDFStitchStatusForHarms @@ -257,26 +255,40 @@ export const RecordsLog = ({ (state) => state.foiRequests.isRecordsLoading ); - const tagList = divisions.filter(d => d.divisionname.toLowerCase() !== 'communications').map(division => { - return { - name: division.divisionid, - display: division.divisionname, - } - }); + const tagList = divisions + .filter((d) => d.divisionname.toLowerCase() !== "communications") + .map((division) => { + return { + name: division.divisionid, + display: division.divisionname, + }; + }); const classes = useStyles(); const [records, setRecords] = useState(recordsObj?.records); const [totalUploadedRecordSize, setTotalUploadedRecordSize] = useState(0); - const [isScanningTeamMember, setIsScanningTeamMember] = useState(isScanningTeam(userGroups)); - const [ministryCode, setMinistryCode] = useState(bcgovcode.replaceAll('"', '').toUpperCase()); - const [isMCFPersonal, setIsMCFPersonal] = useState(ministryCode == "MCF" && requestType === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); + const [isScanningTeamMember, setIsScanningTeamMember] = useState( + isScanningTeam(userGroups) + ); + const [ministryCode, setMinistryCode] = useState( + bcgovcode.replaceAll('"', "").toUpperCase() + ); + const [isMCFPersonal, setIsMCFPersonal] = useState( + ministryCode == "MCF" && + requestType === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL + ); - const MCFSections = useSelector((state) => state.foiRequests.foiPersonalSections); + const MCFSections = useSelector( + (state) => state.foiRequests.foiPersonalSections + ); - useEffect(() => { - setRecords(recordsObj?.records) - let nonDuplicateRecords = recordsObj?.records?.filter(record => !record.isduplicate) - let totalUploadedSize= (calculateTotalUploadedFileSizeInKB(nonDuplicateRecords)/ (1024 * 1024)) + useEffect(() => { + setRecords(recordsObj?.records); + let nonDuplicateRecords = recordsObj?.records?.filter( + (record) => !record.isduplicate + ); + let totalUploadedSize = + calculateTotalUploadedFileSizeInKB(nonDuplicateRecords) / (1024 * 1024); setTotalUploadedRecordSize(parseFloat(totalUploadedSize.toFixed(4))); dispatch(checkForRecordsChange(requestId, ministryId)); //To manage enabling and disabling of download for harms package @@ -928,17 +940,12 @@ export const RecordsLog = ({ bcgovcode: bcgovcode, attributes: [], }; - //remove duplicate records(except duplicate attachments) const deduplicatedRecords = removeDuplicateFiles(recordList); //get only relevent fields - const updatedrecords = getUpdatedRecords( - deduplicatedRecords, - conversionFormats - ); + const updatedrecords = getUpdatedRecords(deduplicatedRecords); //sort records and attachments based on lastmodified asc let sortedRecords = sortByLastModified(updatedrecords); - //get all the divisions in the records const divisionObj = {}; for (const _record of sortedRecords) { @@ -946,7 +953,6 @@ export const RecordsLog = ({ divisionObj[_division.divisionid] = _division.divisionname; } } - // arrange the records and its attachments. const recordsArray = []; for (const _record of sortedRecords) { @@ -1479,11 +1485,11 @@ export const RecordsLog = ({ } // setDivisionToUpdate() - if(isMCFPersonal && selectedDivision.size > 0) { - if(divisions.find(d => selectedDivision.has(d.divisionid))) { - return(!isMinistryCoordinator); + if (isMCFPersonal && selectedDivision.size > 0) { + if (divisions.find((d) => selectedDivision.has(d.divisionid))) { + return !isMinistryCoordinator; } else { - return(isMinistryCoordinator); + return isMinistryCoordinator; } } return count === 0; @@ -1663,7 +1669,11 @@ export const RecordsLog = ({ )} - {isMinistryCoordinator || (isScanningTeamMember && MinistryNeedsScanning.includes(bcgovcode.replaceAll('"', '')) && requestType === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) ? + {isMinistryCoordinator || + (isScanningTeamMember && + MinistryNeedsScanning.includes(bcgovcode.replaceAll('"', "")) && + requestType === + FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) ? ( - : ( + ) : ( records?.length > 0 && - DISABLE_REDACT_WEBLINK?.toLowerCase() == "false" && + DISABLE_REDACT_WEBLINK?.toLowerCase() == "false" && ( ) - } + )} - {isMCFPersonal && (<> -
  • - all records selected must be uploaded by your own team -
  • - )} + {isMCFPersonal && ( + <> +
  • + all records selected must be uploaded by your own + team +
  • + + )}
    ) : ( @@ -2124,97 +2137,178 @@ export const RecordsLog = ({ // id="state-change-dialog" > -

    Update Divisions

    - setDivisionsModalOpen(false)}> - Close - - +

    Update Divisions

    + setDivisionsModalOpen(false)} + > + Close + +
    - - - {(records.filter(r=>(r.isselected && r.attributes.divisions.length > 1)).length > 0 && filterValue < 0) ? -
    - You have selected a record that was provided by more than one division.

    - To change the division you must first filter the Records Log by the division that you want to no longer be associated with the selected records. + + + {records.filter( + (r) => r.isselected && r.attributes.divisions.length > 1 + ).length > 0 && filterValue < 0 ? ( +
    + + You have selected a record that was provided by more + than one division.

    + To change the division you must first filter the Records + Log by the division that you want to no longer be + associated with the selected records.
    - : + ) : ( <> -
    - Select the divisions that corresponds to the records you have selected.

    - This will update the divisions on all records you have selected both in the gathering records log and the redaction app. -
    - - {(requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) ? - (bcgovcode == "MCF") ? +
    + + Select the divisions that corresponds to the records + you have selected.

    + This will update the divisions on all records you have + selected both in the gathering records log and the + redaction app. +
    +
    + + {requestType == + FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL ? ( + bcgovcode == "MCF" ? ( r.isselected)[0]?.attributes.divisions[0].divisionid} + tagValue={ + records.filter((r) => r.isselected)[0]?.attributes + .divisions[0].divisionid + } divisionModalTagValue={divisionModalTagValue} divisions={divisions} isMinistryCoordinator={isMinistryCoordinator} /> - : - (bcgovcode == "MSD") ? - r.isselected)[0]?.attributes.divisions[0].divisionid} - divisionModalTagValue={divisionModalTagValue} - divisions={tagList} - /> - : -
    - {divisions.filter(division => { - if (division.divisionname.toLowerCase() === 'communications') { + ) : bcgovcode == "MSD" ? ( + r.isselected)[0]?.attributes + .divisions[0].divisionid + } + divisionModalTagValue={divisionModalTagValue} + divisions={tagList} + /> + ) : ( +
    + {divisions + .filter((division) => { + if ( + division.divisionname.toLowerCase() === + "communications" + ) { return false; - } else if (filterValue > -1 && filterValue !== division.divisionid) { + } else if ( + filterValue > -1 && + filterValue !== division.divisionid + ) { return true; - } else if (records.filter(r => r.isselected)[0]?.attributes.divisions[0].divisionid !== division.divisionid) { + } else if ( + records.filter((r) => r.isselected)[0] + ?.attributes.divisions[0].divisionid !== + division.divisionid + ) { return true; } else { return false; } - }).map(division => + }) + .map((division) => ( {setDivisionModalTagValue(division.divisionid)}} - clicked={divisionModalTagValue === division.divisionid} + onClick={(e) => { + setDivisionModalTagValue( + division.divisionid + ); + }} + clicked={ + divisionModalTagValue === + division.divisionid + } /> - )} -
    - : -
    - {divisions.filter(division => { - if (division.divisionname.toLowerCase() === 'communications') { - return false; - } else if (filterValue > -1 && filterValue !== division.divisionid) { - return true; - } else if (records.filter(r => r.isselected)[0]?.attributes.divisions[0].divisionid !== division.divisionid) { - return true; - } else { - return false; - } - }).map(division => - {setDivisionModalTagValue(division.divisionid)}} - clicked={divisionModalTagValue === division.divisionid} - /> - )} -
    } - } + ))} +
    + ) + ) : ( +
    + {divisions + .filter((division) => { + if ( + division.divisionname.toLowerCase() === + "communications" + ) { + return false; + } else if ( + filterValue > -1 && + filterValue !== division.divisionid + ) { + return true; + } else if ( + records.filter((r) => r.isselected)[0] + ?.attributes.divisions[0].divisionid !== + division.divisionid + ) { + return true; + } else { + return false; + } + }) + .map((division) => ( + { + setDivisionModalTagValue(division.divisionid); + }} + clicked={ + divisionModalTagValue === division.divisionid + } + /> + ))} +
    + )} + + )}
    From 9b8770beb815d7e68f82b49f218e233d12de1d7f Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Fri, 10 Nov 2023 13:54:22 -0500 Subject: [PATCH 63/78] moved unSavedRequest state declaration to the top --- .../MinistryReview/MinistryReview.js | 55 ++++++++++++------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js index 0b387c410..6b779db48 100644 --- a/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js +++ b/forms-flow-web/src/components/FOI/FOIRequest/MinistryReview/MinistryReview.js @@ -17,7 +17,7 @@ import { import { fetchFOIMinistryAssignedToList, - fetchFOIPersonalDivisionsAndSections + fetchFOIPersonalDivisionsAndSections, } from "../../../../apiManager/services/FOI/foiMasterDataServices"; import { fetchFOIRequestAttachmentsList } from "../../../../apiManager/services/FOI/foiAttachmentServices"; @@ -227,8 +227,12 @@ const MinistryReview = React.memo(({ userDetail }) => { const [originalDivisions, setOriginalDivisions] = React.useState([]); const [hasReceivedDate, setHasReceivedDate] = React.useState(true); const [isMinistryRestricted, setIsMinistryRestricted] = useState(false); - const [isMCFPersonal, setIsMCFPersonal] = useState(bcgovcode.replaceAll('"', '') == "MCF" && requestDetails.requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); - + const [isMCFPersonal, setIsMCFPersonal] = useState( + bcgovcode.replaceAll('"', "") == "MCF" && + requestDetails.requestType == + FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL + ); + const [unSavedRequest, setUnSavedRequest] = React.useState(false); let ministryassignedtousername = "Unassigned"; useEffect(() => { const requestDetailsValue = requestDetails; @@ -249,9 +253,15 @@ const MinistryReview = React.memo(({ userDetail }) => { ); } - if(MinistryNeedsScanning.includes(bcgovcode.replaceAll('"', '')) && requestDetails.requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) { - dispatch(fetchFOIPersonalDivisionsAndSections(bcgovcode.replaceAll('"', ''))); - if(bcgovcode.replaceAll('"', '') == "MCF") { + if ( + MinistryNeedsScanning.includes(bcgovcode.replaceAll('"', "")) && + requestDetails.requestType == + FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL + ) { + dispatch( + fetchFOIPersonalDivisionsAndSections(bcgovcode.replaceAll('"', "")) + ); + if (bcgovcode.replaceAll('"', "") == "MCF") { setIsMCFPersonal(true); } } @@ -269,7 +279,6 @@ const MinistryReview = React.memo(({ userDetail }) => { } }, [isMinistryRestricted, requestWatchers]); - const [unSavedRequest, setUnSavedRequest] = React.useState(false); const [recordsUploading, setRecordsUploading] = React.useState(false); const [CFRUnsaved, setCFRUnsaved] = React.useState(false); const hideBottomText = [ @@ -426,11 +435,11 @@ const MinistryReview = React.memo(({ userDetail }) => { foitabheaderBG = "foitabheadercollection foitabheaderPeerreviewBG"; break; case StateEnum.tagging.name: - foitabheaderBG = "foitabheadercollection foitabheaderTaggingBG"; - break; + foitabheaderBG = "foitabheadercollection foitabheaderTaggingBG"; + break; case StateEnum.readytoscan.name: - foitabheaderBG = "foitabheadercollection foitabheaderReadytoScanBG"; - break; + foitabheaderBG = "foitabheadercollection foitabheaderReadytoScanBG"; + break; default: foitabheaderBG = "foitabheadercollection foitabheaderdefaultBG"; break; @@ -632,15 +641,18 @@ const MinistryReview = React.memo(({ userDetail }) => { ? `(${requestNotes.length})` : ""}
    - {(originalDivisions?.length > 0 || isMCFPersonal) && DISABLE_GATHERINGRECORDS_TAB?.toLowerCase() =='false' &&
    tabclick("Records")} - > - Records -
    } + {(originalDivisions?.length > 0 || isMCFPersonal) && + DISABLE_GATHERINGRECORDS_TAB?.toLowerCase() == "false" && ( +
    tabclick("Records")} + > + Records +
    + )}
    @@ -938,7 +950,8 @@ const MinistryReview = React.memo(({ userDetail }) => { [classes.hidden]: !tabLinksStatuses.Records.display, })} > - {!isAttachmentListLoading && (originalDivisions?.length > 0 || isMCFPersonal) ? ( + {!isAttachmentListLoading && + (originalDivisions?.length > 0 || isMCFPersonal) ? ( <> {url.indexOf("records") > -1 ? ( Date: Wed, 15 Nov 2023 12:27:23 -0500 Subject: [PATCH 64/78] fix for ldd miscalculation --- .../request_api/services/requestservice.py | 381 +++++++++++++----- 1 file changed, 284 insertions(+), 97 deletions(-) diff --git a/request-management-api/request_api/services/requestservice.py b/request-management-api/request_api/services/requestservice.py index 83d6bf039..988fa3dca 100644 --- a/request-management-api/request_api/services/requestservice.py +++ b/request-management-api/request_api/services/requestservice.py @@ -1,4 +1,3 @@ - from re import T from request_api.services.documentservice import documentservice @@ -6,163 +5,351 @@ from request_api.services.watcherservice import watcherservice from request_api.services.commentservice import commentservice from request_api.services.paymentservice import paymentservice -from request_api.services.foirequest.requestserviceconfigurator import requestserviceconfigurator -from request_api.services.foirequest.requestservicegetter import requestservicegetter -from request_api.services.foirequest.requestservicecreate import requestservicecreate +from request_api.services.foirequest.requestserviceconfigurator import ( + requestserviceconfigurator, +) +from request_api.services.foirequest.requestservicegetter import requestservicegetter +from request_api.services.foirequest.requestservicecreate import requestservicecreate from request_api.services.foirequest.requestserviceupdate import requestserviceupdate -from request_api.services.applicantcorrespondence.applicantcorrespondencelog import applicantcorrespondenceservice +from request_api.services.applicantcorrespondence.applicantcorrespondencelog import ( + applicantcorrespondenceservice, +) from request_api.services.subjectcodeservice import subjectcodeservice from request_api.models.FOIRequestStatus import FOIRequestStatus from request_api.models.FOIRawRequests import FOIRawRequest from request_api.models.FOIMinistryRequests import FOIMinistryRequest -from request_api.models.FOIMinistryRequestSubjectCodes import FOIMinistryRequestSubjectCode +from request_api.models.FOIMinistryRequestSubjectCodes import ( + FOIMinistryRequestSubjectCode, +) from request_api.models.SubjectCodes import SubjectCode -from request_api.models.FOIRestrictedMinistryRequests import FOIRestrictedMinistryRequest +from request_api.models.FOIRestrictedMinistryRequests import ( + FOIRestrictedMinistryRequest, +) from request_api.utils.enums import StateName from request_api.services.commons.duecalculator import duecalculator from request_api.utils.commons.datetimehandler import datetimehandler import os import json + class requestservice: - """ FOI Request management service + """FOI Request management service This service class manages all CRUD operations related to an FOI opened Request """ - - def saverequest(self,foirequestschema, userid, foirequestid=None, ministryid=None, filenumber=None, version=None, rawrequestid=None, wfinstanceid=None): - return requestservicecreate().saverequest(foirequestschema, userid, foirequestid, ministryid, filenumber, version, rawrequestid, wfinstanceid) - - def saverequestversion(self,foirequestschema, foirequestid , ministryid, userid): - nextstatename = FOIRequestStatus.getrequeststatusname(foirequestschema['requeststatusid']) - rev_foirequestschema = self.updateduedate(foirequestid, ministryid, datetimehandler().gettoday(), foirequestschema, nextstatename) - responseschema = requestservicecreate().saverequestversion(rev_foirequestschema, foirequestid , ministryid, userid) - if "paymentExpiryDate" in foirequestschema and foirequestschema["paymentExpiryDate"] not in (None, ""): - paymentservice().createpayment(foirequestid, ministryid, foirequestschema, userid) + + def saverequest( + self, + foirequestschema, + userid, + foirequestid=None, + ministryid=None, + filenumber=None, + version=None, + rawrequestid=None, + wfinstanceid=None, + ): + return requestservicecreate().saverequest( + foirequestschema, + userid, + foirequestid, + ministryid, + filenumber, + version, + rawrequestid, + wfinstanceid, + ) + + def saverequestversion(self, foirequestschema, foirequestid, ministryid, userid): + nextstatename = FOIRequestStatus.getrequeststatusname( + foirequestschema["requeststatusid"] + ) + # foirequest = self.getrequest(foirequestid, ministryid) + # print("foirequest >>>>>>>> ", foirequest) + # currentstatus = ( + # foirequest["stateTransition"][0]["status"] + # if "stateTransition" in foirequest + # and len(foirequest["stateTransition"]) > 1 + # else None + # ) + # print("currentstatus >>>>>>>> ", currentstatus) + # rev_foirequestschema = foirequestschema + # if ( + # currentstatus not in (None, "") + # and currentstatus == StateName.onhold.value + # and nextstatename + # in (StateName.callforrecords.value, StateName.response.value) + # ): + # rev_foirequestschema = self.updateduedate( + # foirequestid, + # ministryid, + # datetimehandler().gettoday(), + # foirequestschema, + # nextstatename, + # ) + rev_foirequestschema = self.updateduedate( + foirequestid, + ministryid, + datetimehandler().gettoday(), + foirequestschema, + nextstatename, + ) + responseschema = requestservicecreate().saverequestversion( + rev_foirequestschema, foirequestid, ministryid, userid + ) + if "paymentExpiryDate" in foirequestschema and foirequestschema[ + "paymentExpiryDate" + ] not in (None, ""): + paymentservice().createpayment( + foirequestid, ministryid, foirequestschema, userid + ) return responseschema - def saveministryrequestversion(self,ministryrequestschema, foirequestid , ministryid, userid, usertype = None): - return requestservicecreate().saveministryrequestversion(ministryrequestschema, foirequestid , ministryid, userid, usertype) - - def updaterequest(self,foirequestschema,foirequestid,userid): - return requestserviceupdate().updaterequest(foirequestschema,foirequestid,userid) + def saveministryrequestversion( + self, ministryrequestschema, foirequestid, ministryid, userid, usertype=None + ): + return requestservicecreate().saveministryrequestversion( + ministryrequestschema, foirequestid, ministryid, userid, usertype + ) + + def updaterequest(self, foirequestschema, foirequestid, userid): + return requestserviceupdate().updaterequest( + foirequestschema, foirequestid, userid + ) def updateministryrequestduedate(self, ministryrequestid, duedate, userid): - return requestserviceupdate().updateministryrequestduedate(ministryrequestid, duedate, userid) - - def postpaymentstatetransition(self, requestid, ministryrequestid, nextstatename, paymentdate): + return requestserviceupdate().updateministryrequestduedate( + ministryrequestid, duedate, userid + ) + + def postpaymentstatetransition( + self, requestid, ministryrequestid, nextstatename, paymentdate + ): _foirequest = self.getrequest(requestid, ministryrequestid) - foirequest = self.updateduedate(requestid, ministryrequestid, paymentdate, _foirequest, nextstatename) - status = FOIRequestStatus().getrequeststatusid(nextstatename) - foirequest['requeststatusid'] = status['requeststatusid'] - return requestservicecreate().saverequestversion(foirequest, requestid , ministryrequestid, 'Online Payment') - - def updateduedate(self, requestid, ministryrequestid, offholddate, foirequestschema, nextstatename): + foirequest = self.updateduedate( + requestid, ministryrequestid, paymentdate, _foirequest, nextstatename + ) + status = FOIRequestStatus().getrequeststatusid(nextstatename) + foirequest["requeststatusid"] = status["requeststatusid"] + return requestservicecreate().saverequestversion( + foirequest, requestid, ministryrequestid, "Online Payment" + ) + + def updateduedate( + self, requestid, ministryrequestid, offholddate, foirequestschema, nextstatename + ): + print("foirequestschema >>>>> ", foirequestschema) + print("nextstatename >>>> ", nextstatename) + print("offholddate >>>> ", offholddate) foirequest = self.getrequest(requestid, ministryrequestid) - currentstatus = foirequest["stateTransition"][0]["status"] if "stateTransition" in foirequest and len(foirequest["stateTransition"]) > 1 else None - #Check for Off Hold - if currentstatus not in (None, "") and currentstatus == StateName.onhold.value and nextstatename != StateName.response.value: - skipcalculation = self.__skipduedatecalculation(ministryrequestid, offholddate) - #Skip multiple off hold in a day + print("foirequest >>>>>>>> ", foirequest) + currentstatus = ( + foirequest["stateTransition"][0]["status"] + if "stateTransition" in foirequest + and len(foirequest["stateTransition"]) > 1 + else None + ) + print("currentstatus >>>>>>>> ", currentstatus) + # Check for Off Hold + if ( + currentstatus not in (None, "") + and currentstatus == StateName.onhold.value + and nextstatename != StateName.response.value + ): + skipcalculation = self.__skipduedatecalculation( + ministryrequestid, offholddate + ) + # Skip multiple off hold in a day if skipcalculation == True: - calc_duedate, calc_cfrduedate = foirequest["dueDate"], foirequest["cfrDueDate"] + calc_duedate, calc_cfrduedate = ( + foirequest["dueDate"], + foirequest["cfrDueDate"], + ) else: - calc_duedate, calc_cfrduedate = self.calculateduedate(ministryrequestid, foirequest, offholddate) - foirequestschema['dueDate'] = calc_duedate - foirequestschema['cfrDueDate'] = calc_cfrduedate + calc_duedate, calc_cfrduedate = self.calculateduedate( + ministryrequestid, foirequest, offholddate + ) + foirequestschema["dueDate"] = calc_duedate + foirequestschema["cfrDueDate"] = calc_cfrduedate return foirequestschema - def getrequest(self,foirequestid,foiministryrequestid): + def getrequest(self, foirequestid, foiministryrequestid): return requestservicegetter().getrequest(foirequestid, foiministryrequestid) - - def getrequestdetailsforministry(self,foirequestid, foiministryrequestid, authmembershipgroups): - return requestservicegetter().getrequestdetailsforministry(foirequestid,foiministryrequestid, authmembershipgroups) - - def getrequestdetails(self,foirequestid, foiministryrequestid): - return requestservicegetter().getrequestdetails(foirequestid, foiministryrequestid) + + def getrequestdetailsforministry( + self, foirequestid, foiministryrequestid, authmembershipgroups + ): + return requestservicegetter().getrequestdetailsforministry( + foirequestid, foiministryrequestid, authmembershipgroups + ) + + def getrequestdetails(self, foirequestid, foiministryrequestid): + return requestservicegetter().getrequestdetails( + foirequestid, foiministryrequestid + ) def getrequestid(self, foiministryrequestid): - return FOIMinistryRequest.getrequest(foiministryrequestid)['foirequest_id'] - + return FOIMinistryRequest.getrequest(foiministryrequestid)["foirequest_id"] + def copywatchers(self, rawrequestid, ministries, userid): watchers = watcherservice().getrawrequestwatchers(int(rawrequestid)) - for ministry in ministries: + for ministry in ministries: for watcher in watchers: - watcherschema = {"ministryrequestid":ministry["id"],"watchedbygroup":watcher["watchedbygroup"],"watchedby":watcher["watchedby"],"isactive":True} - watcherservice().createministryrequestwatcher(watcherschema, userid, None) - + watcherschema = { + "ministryrequestid": ministry["id"], + "watchedbygroup": watcher["watchedbygroup"], + "watchedby": watcher["watchedby"], + "isactive": True, + } + watcherservice().createministryrequestwatcher( + watcherschema, userid, None + ) + def copycomments(self, rawrequestid, ministries, userid): comments = commentservice().getrawrequestcomments(int(rawrequestid)) - for ministry in ministries: + for ministry in ministries: commentservice().copyrequestcomment(ministry["id"], comments, userid) - - def copydocuments(self, rawrequestid,ministries,userid): - attachments = documentservice().getrequestdocuments(int(rawrequestid),"rawrequest") + + def copydocuments(self, rawrequestid, ministries, userid): + attachments = documentservice().getrequestdocuments( + int(rawrequestid), "rawrequest" + ) for ministry in ministries: documentservice().copyrequestdocuments(ministry["id"], attachments, userid) def copysubjectcode(self, subjectcode, ministries, userid): if subjectcode: for ministry in ministries: - subjectcodeservice().savesubjectcode(ministry["id"], subjectcode, userid) - + subjectcodeservice().savesubjectcode( + ministry["id"], subjectcode, userid + ) + def postopeneventtoworkflow(self, id, requestschema, ministries): - pid = workflowservice().syncwfinstance("rawrequest", requestschema['id']) - workflowservice().postunopenedevent(id, pid, requestschema, "Open", ministries) - - def postfeeeventtoworkflow(self, requestid, ministryrequestid, paymentstatus, nextstatename=None): - foirequestschema = self.getrequestdetails(requestid, ministryrequestid) - workflowservice().postfeeevent(requestid, ministryrequestid, foirequestschema, paymentstatus, nextstatename) - - def posteventtoworkflow(self, id, requestschema, data, usertype): - requeststatusid = requestschema.get("requeststatusid") if 'requeststatusid' in requestschema else None - status = requestserviceconfigurator().getstatusname(requeststatusid) if requeststatusid is not None else None + pid = workflowservice().syncwfinstance("rawrequest", requestschema["id"]) + workflowservice().postunopenedevent(id, pid, requestschema, "Open", ministries) + + def postfeeeventtoworkflow( + self, requestid, ministryrequestid, paymentstatus, nextstatename=None + ): + foirequestschema = self.getrequestdetails(requestid, ministryrequestid) + workflowservice().postfeeevent( + requestid, ministryrequestid, foirequestschema, paymentstatus, nextstatename + ) + + def posteventtoworkflow(self, id, requestschema, data, usertype): + requeststatusid = ( + requestschema.get("requeststatusid") + if "requeststatusid" in requestschema + else None + ) + status = ( + requestserviceconfigurator().getstatusname(requeststatusid) + if requeststatusid is not None + else None + ) pid = workflowservice().syncwfinstance("ministryrequest", id) - workflowservice().postopenedevent(id, pid, requestschema, data, status, usertype) - - def postcorrespondenceeventtoworkflow(self, requestid, ministryrequestid, applicantcorrespondenceid, attributes, templateid): + workflowservice().postopenedevent( + id, pid, requestschema, data, status, usertype + ) + + def postcorrespondenceeventtoworkflow( + self, + requestid, + ministryrequestid, + applicantcorrespondenceid, + attributes, + templateid, + ): foirequestschema = self.getrequestdetails(requestid, ministryrequestid) templatedetails = applicantcorrespondenceservice().gettemplatebyid(templateid) - wfinstanceid = workflowservice().syncwfinstance("ministryrequest", ministryrequestid, True) - workflowservice().postcorrenspodenceevent(wfinstanceid, ministryrequestid, foirequestschema, applicantcorrespondenceid, templatedetails.name, attributes) + wfinstanceid = workflowservice().syncwfinstance( + "ministryrequest", ministryrequestid, True + ) + workflowservice().postcorrenspodenceevent( + wfinstanceid, + ministryrequestid, + foirequestschema, + applicantcorrespondenceid, + templatedetails.name, + attributes, + ) - def calculateduedate(self, ministryrequestid, foirequest, paymentdate): + def calculateduedate(self, ministryrequestid, foirequest, paymentdate): duedate_includeoffhold, cfrduedate_includeoffhold = self.__isincludeoffhold() - onhold_extend_days = duecalculator().getbusinessdaysbetween(foirequest["onholdTransitionDate"], paymentdate) + onhold_extend_days = duecalculator().getbusinessdaysbetween( + foirequest["onholdTransitionDate"], paymentdate + ) isoffhold_businessday = duecalculator().isbusinessday(paymentdate) - duedate_extend_days = onhold_extend_days + 1 if isoffhold_businessday == True and duedate_includeoffhold == True else onhold_extend_days - cfrduedate_extend_days = onhold_extend_days + 1 if isoffhold_businessday == True and cfrduedate_includeoffhold == True else onhold_extend_days - calc_duedate = duecalculator().addbusinessdays(foirequest["dueDate"], duedate_extend_days) - calc_cfrduedate = duecalculator().addbusinessdays(foirequest["cfrDueDate"], cfrduedate_extend_days) + duedate_extend_days = ( + onhold_extend_days + 1 + if isoffhold_businessday == True and duedate_includeoffhold == True + else onhold_extend_days + ) + cfrduedate_extend_days = ( + onhold_extend_days + 1 + if isoffhold_businessday == True and cfrduedate_includeoffhold == True + else onhold_extend_days + ) + calc_duedate = duecalculator().addbusinessdays( + foirequest["dueDate"], duedate_extend_days + ) + calc_cfrduedate = duecalculator().addbusinessdays( + foirequest["cfrDueDate"], cfrduedate_extend_days + ) return calc_duedate, calc_cfrduedate - def __skipduedatecalculation(self, ministryrequestid, offholddate): + def __skipduedatecalculation( + self, ministryrequestid, offholddate, currentstatus="", nextstatename="" + ): previousoffholddate = FOIMinistryRequest.getlastoffholddate(ministryrequestid) - if previousoffholddate not in (None, ''): - previouspaymentdate_pst = datetimehandler().convert_to_pst(previousoffholddate) - if datetimehandler().getdate(previouspaymentdate_pst).date() == datetimehandler().getdate(offholddate).date(): + if ( + currentstatus not in (None, "") + and currentstatus == StateName.onhold.value + and nextstatename + in (StateName.callforrecords.value, StateName.response.value) + ): + return True + if previousoffholddate not in (None, ""): + previouspaymentdate_pst = datetimehandler().convert_to_pst( + previousoffholddate + ) + if ( + datetimehandler().getdate(previouspaymentdate_pst).date() + == datetimehandler().getdate(offholddate).date() + ): return True - return False + return False def __isincludeoffhold(self): - payment_config_str = os.getenv("PAYMENT_CONFIG",'') - if payment_config_str in (None, ''): + payment_config_str = os.getenv("PAYMENT_CONFIG", "") + if payment_config_str in (None, ""): return True, True _paymentconfig = json.loads(payment_config_str) - duedate_includeoffhold = True if _paymentconfig["duedate"]["includeoffhold"] == "Y" else False - cfrduedate_includeoffhold = True if _paymentconfig["cfrduedate"]["includeoffhold"] == "Y" else False + duedate_includeoffhold = ( + True if _paymentconfig["duedate"]["includeoffhold"] == "Y" else False + ) + cfrduedate_includeoffhold = ( + True if _paymentconfig["cfrduedate"]["includeoffhold"] == "Y" else False + ) return duedate_includeoffhold, cfrduedate_includeoffhold # intake in progress to open: create a restricted request record for each selected ministries - def createrestrictedrequests(self, ministries, type, isrestricted,userid): + def createrestrictedrequests(self, ministries, type, isrestricted, userid): for ministry in ministries: version = FOIMinistryRequest.getversionforrequest(ministry["id"]) - FOIRestrictedMinistryRequest.disablerestrictedrequests(ministry["id"], type, userid) - FOIRestrictedMinistryRequest.saverestrictedrequest(ministry["id"], type, isrestricted, version, userid) + FOIRestrictedMinistryRequest.disablerestrictedrequests( + ministry["id"], type, userid + ) + FOIRestrictedMinistryRequest.saverestrictedrequest( + ministry["id"], type, isrestricted, version, userid + ) - def saverestrictedrequest(self,ministryrequestid,type, isrestricted,userid): + def saverestrictedrequest(self, ministryrequestid, type, isrestricted, userid): version = FOIMinistryRequest.getversionforrequest(ministryrequestid) - FOIRestrictedMinistryRequest.disablerestrictedrequests(ministryrequestid,type,userid) - return FOIRestrictedMinistryRequest.saverestrictedrequest(ministryrequestid,type,isrestricted, version, userid) - + FOIRestrictedMinistryRequest.disablerestrictedrequests( + ministryrequestid, type, userid + ) + return FOIRestrictedMinistryRequest.saverestrictedrequest( + ministryrequestid, type, isrestricted, version, userid + ) From 322f8073fe5c9d3edb3115d2c66173c0dcc9bf70 Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Wed, 15 Nov 2023 13:55:19 -0500 Subject: [PATCH 65/78] refactored the code --- .../request_api/services/requestservice.py | 46 ++++--------------- 1 file changed, 9 insertions(+), 37 deletions(-) diff --git a/request-management-api/request_api/services/requestservice.py b/request-management-api/request_api/services/requestservice.py index 988fa3dca..29eb36305 100644 --- a/request-management-api/request_api/services/requestservice.py +++ b/request-management-api/request_api/services/requestservice.py @@ -65,36 +65,13 @@ def saverequestversion(self, foirequestschema, foirequestid, ministryid, userid) nextstatename = FOIRequestStatus.getrequeststatusname( foirequestschema["requeststatusid"] ) - # foirequest = self.getrequest(foirequestid, ministryid) - # print("foirequest >>>>>>>> ", foirequest) - # currentstatus = ( - # foirequest["stateTransition"][0]["status"] - # if "stateTransition" in foirequest - # and len(foirequest["stateTransition"]) > 1 - # else None - # ) - # print("currentstatus >>>>>>>> ", currentstatus) - # rev_foirequestschema = foirequestschema - # if ( - # currentstatus not in (None, "") - # and currentstatus == StateName.onhold.value - # and nextstatename - # in (StateName.callforrecords.value, StateName.response.value) - # ): - # rev_foirequestschema = self.updateduedate( - # foirequestid, - # ministryid, - # datetimehandler().gettoday(), - # foirequestschema, - # nextstatename, - # ) rev_foirequestschema = self.updateduedate( - foirequestid, - ministryid, - datetimehandler().gettoday(), - foirequestschema, - nextstatename, - ) + foirequestid, + ministryid, + datetimehandler().gettoday(), + foirequestschema, + nextstatename, + ) responseschema = requestservicecreate().saverequestversion( rev_foirequestschema, foirequestid, ministryid, userid ) @@ -139,18 +116,13 @@ def postpaymentstatetransition( def updateduedate( self, requestid, ministryrequestid, offholddate, foirequestschema, nextstatename ): - print("foirequestschema >>>>> ", foirequestschema) - print("nextstatename >>>> ", nextstatename) - print("offholddate >>>> ", offholddate) foirequest = self.getrequest(requestid, ministryrequestid) - print("foirequest >>>>>>>> ", foirequest) currentstatus = ( foirequest["stateTransition"][0]["status"] if "stateTransition" in foirequest and len(foirequest["stateTransition"]) > 1 else None ) - print("currentstatus >>>>>>>> ", currentstatus) # Check for Off Hold if ( currentstatus not in (None, "") @@ -158,7 +130,7 @@ def updateduedate( and nextstatename != StateName.response.value ): skipcalculation = self.__skipduedatecalculation( - ministryrequestid, offholddate + ministryrequestid, offholddate, currentstatus, nextstatename ) # Skip multiple off hold in a day if skipcalculation == True: @@ -306,8 +278,8 @@ def __skipduedatecalculation( if ( currentstatus not in (None, "") and currentstatus == StateName.onhold.value - and nextstatename - in (StateName.callforrecords.value, StateName.response.value) + and nextstatename not in (None, "") + and currentstatus == nextstatename["name"] ): return True if previousoffholddate not in (None, ""): From 099d9cf43d76cc93f120ca65c2ed62b1e1428b65 Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Wed, 15 Nov 2023 14:54:38 -0500 Subject: [PATCH 66/78] logs added --- request-management-api/request_api/services/requestservice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/request-management-api/request_api/services/requestservice.py b/request-management-api/request_api/services/requestservice.py index 29eb36305..e8a23c20a 100644 --- a/request-management-api/request_api/services/requestservice.py +++ b/request-management-api/request_api/services/requestservice.py @@ -274,6 +274,8 @@ def calculateduedate(self, ministryrequestid, foirequest, paymentdate): def __skipduedatecalculation( self, ministryrequestid, offholddate, currentstatus="", nextstatename="" ): + print("currentstatus >>>>> ", currentstatus) + print("nextstatename >>>>> ", nextstatename) previousoffholddate = FOIMinistryRequest.getlastoffholddate(ministryrequestid) if ( currentstatus not in (None, "") From 9961af5f77ad1e3ec89c7c24e66a7eb5541de6a8 Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Wed, 15 Nov 2023 15:52:41 -0500 Subject: [PATCH 67/78] fix for nextstatename check --- .../request_api/services/requestservice.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/request-management-api/request_api/services/requestservice.py b/request-management-api/request_api/services/requestservice.py index e8a23c20a..80238a978 100644 --- a/request-management-api/request_api/services/requestservice.py +++ b/request-management-api/request_api/services/requestservice.py @@ -280,8 +280,9 @@ def __skipduedatecalculation( if ( currentstatus not in (None, "") and currentstatus == StateName.onhold.value - and nextstatename not in (None, "") - and currentstatus == nextstatename["name"] + and isinstance(nextstatename, dict) + and nextstatename.get("name") not in (None, "") + and currentstatus == nextstatename.get("name") ): return True if previousoffholddate not in (None, ""): From 371869602dc86004c5b69775a4e8e552b5528491 Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Wed, 15 Nov 2023 15:57:47 -0500 Subject: [PATCH 68/78] fix for nextstatename check --- .../request_api/services/requestservice.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/request-management-api/request_api/services/requestservice.py b/request-management-api/request_api/services/requestservice.py index 80238a978..09dc3d766 100644 --- a/request-management-api/request_api/services/requestservice.py +++ b/request-management-api/request_api/services/requestservice.py @@ -62,9 +62,15 @@ def saverequest( ) def saverequestversion(self, foirequestschema, foirequestid, ministryid, userid): - nextstatename = FOIRequestStatus.getrequeststatusname( + nextstate = FOIRequestStatus.getrequeststatusname( foirequestschema["requeststatusid"] ) + nextstatename = ( + nextstate.get("name") + if isinstance(nextstatename, dict) + and nextstatename.get("name") not in (None, "") + else "" + ) rev_foirequestschema = self.updateduedate( foirequestid, ministryid, @@ -280,9 +286,8 @@ def __skipduedatecalculation( if ( currentstatus not in (None, "") and currentstatus == StateName.onhold.value - and isinstance(nextstatename, dict) - and nextstatename.get("name") not in (None, "") - and currentstatus == nextstatename.get("name") + and nextstatename not in (None, "") + and currentstatus == nextstatename ): return True if previousoffholddate not in (None, ""): From a14129e983a680e49f81714123dcef240f891057 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 15 Nov 2023 14:58:01 -0800 Subject: [PATCH 69/78] fix undeclared js variable error --- .../FOI/customComponents/Attachments/AttachmentModal.js | 1 + 1 file changed, 1 insertion(+) diff --git a/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js b/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js index 77204dfe1..4c471d339 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js +++ b/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js @@ -243,6 +243,7 @@ export default function AttachmentModal({ return {title: "Add Attachment", body: ""}; } case "replaceattachment": + let _message = {}; if (uploadFor === 'record') { _message = {title: "Replace Records", body:<>Replace the existing record with a reformatted or updated version of the same record.

    The original file that was uploaded will still be available for download. } } From 01a1a445914676985b69256de7fe58492a1bb9ae Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Thu, 16 Nov 2023 11:58:25 -0500 Subject: [PATCH 70/78] fixed log error --- request-management-api/request_api/services/requestservice.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/request-management-api/request_api/services/requestservice.py b/request-management-api/request_api/services/requestservice.py index 09dc3d766..6c76cce24 100644 --- a/request-management-api/request_api/services/requestservice.py +++ b/request-management-api/request_api/services/requestservice.py @@ -67,8 +67,7 @@ def saverequestversion(self, foirequestschema, foirequestid, ministryid, userid) ) nextstatename = ( nextstate.get("name") - if isinstance(nextstatename, dict) - and nextstatename.get("name") not in (None, "") + if isinstance(nextstate, dict) and nextstate.get("name") not in (None, "") else "" ) rev_foirequestschema = self.updateduedate( From 35faacc6fa9b4d7b29c960b8d95d039c5a589b89 Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Thu, 16 Nov 2023 13:21:46 -0500 Subject: [PATCH 71/78] removed logs --- request-management-api/request_api/services/requestservice.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/request-management-api/request_api/services/requestservice.py b/request-management-api/request_api/services/requestservice.py index 6c76cce24..d98d24cb3 100644 --- a/request-management-api/request_api/services/requestservice.py +++ b/request-management-api/request_api/services/requestservice.py @@ -279,8 +279,6 @@ def calculateduedate(self, ministryrequestid, foirequest, paymentdate): def __skipduedatecalculation( self, ministryrequestid, offholddate, currentstatus="", nextstatename="" ): - print("currentstatus >>>>> ", currentstatus) - print("nextstatename >>>>> ", nextstatename) previousoffholddate = FOIMinistryRequest.getlastoffholddate(ministryrequestid) if ( currentstatus not in (None, "") From bef117f76f435ee98381e1d20c3eb497954bff47 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 Nov 2023 11:31:26 -0800 Subject: [PATCH 72/78] fix undeclared js variable error 2 --- .../FOI/customComponents/Attachments/AttachmentModal.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js b/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js index 4c471d339..4b7a303e4 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js +++ b/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js @@ -233,6 +233,7 @@ export default function AttachmentModal({ } } const getMessage = () => { + let _message = {}; switch(modalFor.toLowerCase()) { case "add": if(isMCFMSDPersonal && !isMinistryCoordinator) { @@ -243,13 +244,11 @@ export default function AttachmentModal({ return {title: "Add Attachment", body: ""}; } case "replaceattachment": - let _message = {}; if (uploadFor === 'record') { _message = {title: "Replace Records", body:<>Replace the existing record with a reformatted or updated version of the same record.

    The original file that was uploaded will still be available for download. } } return _message; case "replace": - let _message = {}; if (uploadFor === 'record') { _message = {title: "Replace Records", body:<>Replace the existing record with a reformatted or updated version of the same record.

    The original file that was uploaded will still be available for download. } } else if (attachment) { From 3e0137d07dfc74603532d33eff7f8e4731b83010 Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Thu, 16 Nov 2023 14:32:19 -0500 Subject: [PATCH 73/78] build error fix _message --- .../Attachments/AttachmentModal.js | 1054 ++++++++++------- 1 file changed, 647 insertions(+), 407 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js b/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js index 77204dfe1..5ac12bd45 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js +++ b/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js @@ -1,46 +1,54 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState } from "react"; import { useSelector } from "react-redux"; -import Dialog from '@material-ui/core/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogContentText from '@material-ui/core/DialogContentText'; -import DialogTitle from '@material-ui/core/DialogTitle'; -import IconButton from '@material-ui/core/IconButton'; -import CloseIcon from '@material-ui/icons/Close'; -import TextField from '@material-ui/core/TextField'; -import '../ConfirmationModal/confirmationmodal.scss'; -import './attachmentmodal.scss'; -import FileUpload from '../FileUpload'; -import FileUploadForMCFPersonal from '../FileUpload/FileUploadForMCFPersonal'; -import FileUploadForMSDPersonal from '../FileUpload/FileUploadForMSDPersonal'; -import { makeStyles } from '@material-ui/core/styles'; -import { MimeTypeList, MaxFileSizeInMB, MCFPopularSections, MSDPopularSections, MinistryNeedsScanning } from "../../../../constants/FOI/enum"; -import { StateTransitionCategories, AttachmentCategories } from '../../../../constants/FOI/statusEnum'; +import Dialog from "@material-ui/core/Dialog"; +import DialogActions from "@material-ui/core/DialogActions"; +import DialogContent from "@material-ui/core/DialogContent"; +import DialogContentText from "@material-ui/core/DialogContentText"; +import DialogTitle from "@material-ui/core/DialogTitle"; +import IconButton from "@material-ui/core/IconButton"; +import CloseIcon from "@material-ui/icons/Close"; +import TextField from "@material-ui/core/TextField"; +import "../ConfirmationModal/confirmationmodal.scss"; +import "./attachmentmodal.scss"; +import FileUpload from "../FileUpload"; +import FileUploadForMCFPersonal from "../FileUpload/FileUploadForMCFPersonal"; +import FileUploadForMSDPersonal from "../FileUpload/FileUploadForMSDPersonal"; +import { makeStyles } from "@material-ui/core/styles"; +import { + MimeTypeList, + MaxFileSizeInMB, + MCFPopularSections, + MSDPopularSections, + MinistryNeedsScanning, +} from "../../../../constants/FOI/enum"; +import { + StateTransitionCategories, + AttachmentCategories, +} from "../../../../constants/FOI/statusEnum"; import { TOTAL_RECORDS_UPLOAD_LIMIT } from "../../../../constants/constants"; import FOI_COMPONENT_CONSTANTS from "../../../../constants/FOI/foiComponentConstants"; -import { ClickableChip } from '../../Dashboard/utils'; +import { ClickableChip } from "../../Dashboard/utils"; const useStyles = makeStyles((theme) => ({ root: { - width: '100%', - marginTop:'30px', - marginBottom:'50px' + width: "100%", + marginTop: "30px", + marginBottom: "50px", }, heading: { fontSize: theme.typography.pxToRem(15), fontWeight: theme.typography.fontWeightRegular, }, btndisabled: { - border: 'none', - backgroundColor: '#eceaea', - color: '#FFFFFF' + border: "none", + backgroundColor: "#eceaea", + color: "#FFFFFF", }, btnenabled: { - border: 'none', - backgroundColor: '#38598A', - color: '#FFFFFF' + border: "none", + backgroundColor: "#38598A", + color: "#FFFFFF", }, - })); export default function AttachmentModal({ @@ -55,379 +63,569 @@ export default function AttachmentModal({ handleRename, handleReclassify, isMinistryCoordinator, - uploadFor="attachment", + uploadFor = "attachment", maxNoFiles, bcgovcode, - existingDocuments=[], - divisions=[], - replacementfiletypes=[], - totalUploadedRecordSize=0, - requestType=FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_GENERAL + existingDocuments = [], + divisions = [], + replacementfiletypes = [], + totalUploadedRecordSize = 0, + requestType = FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_GENERAL, }) { - - let tagList = []; - if(uploadFor === 'attachment') { - tagList = AttachmentCategories.categorys.filter(category => category.type.includes("tag")); - if (isMinistryCoordinator) { - tagList = tagList.filter(tag => tag.name !== "applicant") - } - } else if (uploadFor === 'record') { - tagList = divisions.map(division => { - return { - name: division.divisionid, - display: division.divisionname, - } - }); + let tagList = []; + if (uploadFor === "attachment") { + tagList = AttachmentCategories.categorys.filter((category) => + category.type.includes("tag") + ); + if (isMinistryCoordinator) { + tagList = tagList.filter((tag) => tag.name !== "applicant"); } + } else if (uploadFor === "record") { + tagList = divisions.map((division) => { + return { + name: division.divisionid, + display: division.divisionname, + }; + }); + } - const recordFormats = useSelector((state) => state.foiRequests.recordFormats) - useEffect(() => { - setMimeTypes(multipleFiles ? - (uploadFor === 'attachment' ? [...recordFormats, ...MimeTypeList.additional] : (uploadFor === 'record' && (modalFor==="replace" || modalFor === "replaceattachment") ? replacementfiletypes: recordFormats)) - : MimeTypeList.stateTransition); - }, [recordFormats]) - const [mimeTypes, setMimeTypes] = useState(multipleFiles ? - (uploadFor === 'attachment' ? [...recordFormats, ...MimeTypeList.additional] : (uploadFor === 'record' && (modalFor==="replace" || modalFor === "replaceattachment") ? replacementfiletypes: recordFormats)) - : MimeTypeList.stateTransition); - const maxFileSize = uploadFor === 'record' ? MaxFileSizeInMB.totalFileSize : multipleFiles ? MaxFileSizeInMB.attachmentLog : MaxFileSizeInMB.stateTransition; - const totalFileSize = multipleFiles ? MaxFileSizeInMB.totalFileSize : MaxFileSizeInMB.stateTransition; - const classes = useStyles(); - const [files, setFiles] = useState([]); - const [newFilename, setNewFilename] = useState(""); - const [extension, setExtension] = useState(""); - const [errorMessage, setErrorMessage] = useState(); - const [tagValue, setTagValue] = useState(uploadFor === 'record' ? "" : "general"); - const attchmentFileNameList = attachmentsArray.map(_file => _file.filename.toLowerCase()); - const totalRecordUploadLimit= TOTAL_RECORDS_UPLOAD_LIMIT ; - const [isMCFMSDPersonal, setIsMCFMSDPersonal] = useState(MinistryNeedsScanning.includes(bcgovcode) && requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); + const recordFormats = useSelector((state) => state.foiRequests.recordFormats); + useEffect(() => { + setMimeTypes( + multipleFiles + ? uploadFor === "attachment" + ? [...recordFormats, ...MimeTypeList.additional] + : uploadFor === "record" && + (modalFor === "replace" || modalFor === "replaceattachment") + ? replacementfiletypes + : recordFormats + : MimeTypeList.stateTransition + ); + }, [recordFormats]); + const [mimeTypes, setMimeTypes] = useState( + multipleFiles + ? uploadFor === "attachment" + ? [...recordFormats, ...MimeTypeList.additional] + : uploadFor === "record" && + (modalFor === "replace" || modalFor === "replaceattachment") + ? replacementfiletypes + : recordFormats + : MimeTypeList.stateTransition + ); + const maxFileSize = + uploadFor === "record" + ? MaxFileSizeInMB.totalFileSize + : multipleFiles + ? MaxFileSizeInMB.attachmentLog + : MaxFileSizeInMB.stateTransition; + const totalFileSize = multipleFiles + ? MaxFileSizeInMB.totalFileSize + : MaxFileSizeInMB.stateTransition; + const classes = useStyles(); + const [files, setFiles] = useState([]); + const [newFilename, setNewFilename] = useState(""); + const [extension, setExtension] = useState(""); + const [errorMessage, setErrorMessage] = useState(); + const [tagValue, setTagValue] = useState( + uploadFor === "record" ? "" : "general" + ); + const attchmentFileNameList = attachmentsArray.map((_file) => + _file.filename.toLowerCase() + ); + const totalRecordUploadLimit = TOTAL_RECORDS_UPLOAD_LIMIT; + const [isMCFMSDPersonal, setIsMCFMSDPersonal] = useState( + MinistryNeedsScanning.includes(bcgovcode) && + requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL + ); - useEffect(() => { - parseFileName(attachment); - }, [attachment]) + useEffect(() => { + parseFileName(attachment); + }, [attachment]); - useEffect(() => { - setIsMCFMSDPersonal(MinistryNeedsScanning.includes(bcgovcode) && requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL); - }, [bcgovcode, requestType]) + useEffect(() => { + setIsMCFMSDPersonal( + MinistryNeedsScanning.includes(bcgovcode) && + requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL + ); + }, [bcgovcode, requestType]); - const parseFileName = (_attachment) => { - setNewFilename(""); - setExtension(""); - setErrorMessage(""); - if(_attachment && _attachment.filename) { - let lastIndex = _attachment.filename.lastIndexOf("."); - setNewFilename(lastIndex>0?_attachment.filename.substr(0, lastIndex):_attachment.filename); - setExtension(lastIndex>0?_attachment.filename.substr(lastIndex+1):""); - } + const parseFileName = (_attachment) => { + setNewFilename(""); + setExtension(""); + setErrorMessage(""); + if (_attachment && _attachment.filename) { + let lastIndex = _attachment.filename.lastIndexOf("."); + setNewFilename( + lastIndex > 0 + ? _attachment.filename.substr(0, lastIndex) + : _attachment.filename + ); + setExtension( + lastIndex > 0 ? _attachment.filename.substr(lastIndex + 1) : "" + ); } + }; - const checkInvalidCharacters = (fname) => { - let rg1 = /^[^\/:*?"<>|]+$/; // forbidden characters / : * ? " < > | - return !fname || rg1.test(fname); - }; + const checkInvalidCharacters = (fname) => { + let rg1 = /^[^\/:*?"<>|]+$/; // forbidden characters / : * ? " < > | + return !fname || rg1.test(fname); + }; - const validateFilename = (fname) => { - let rg1 = /^[^\/:*?"<>|]+$/; // forbidden characters / : * ? " < > | - let rg2 = /^\./; // cannot start with dot (.) - //let rg3 = /^(nul|prn|con|lpt\d|com\d)(.|$)/i; // forbidden file names + const validateFilename = (fname) => { + let rg1 = /^[^\/:*?"<>|]+$/; // forbidden characters / : * ? " < > | + let rg2 = /^\./; // cannot start with dot (.) + //let rg3 = /^(nul|prn|con|lpt\d|com\d)(.|$)/i; // forbidden file names - return fname && rg1.test(fname) && !rg2.test(fname); - }; + return fname && rg1.test(fname) && !rg2.test(fname); + }; - const containDuplicate = (fname) => { - if(attachment.filename !== (fname+"."+extension)) { - return attchmentFileNameList.includes((fname+"."+extension).toLocaleLowerCase()); - } else { - return false; - } + const containDuplicate = (fname) => { + if (attachment.filename !== fname + "." + extension) { + return attchmentFileNameList.includes( + (fname + "." + extension).toLocaleLowerCase() + ); + } else { + return false; + } + }; + + const updateFilename = (e) => { + if (checkInvalidCharacters(e.target.value)) { + setNewFilename(e.target.value); + setErrorMessage(""); + } else { + setErrorMessage( + `File name cannot contain these characters, / : * ? " < > |` + ); + } + }; + + const saveNewCategory = () => { + handleReclassify(attachment, tagValue); + }; + + useEffect(() => { + if (attachment && attachment.category && modalFor == "reclassify") { + setTagValue(attachment.category?.toLowerCase()); } + }, [modalFor, attachment]); - const updateFilename = (e) => { - if(checkInvalidCharacters(e.target.value)) { - setNewFilename(e.target.value); + const saveNewFilename = () => { + if (validateFilename(newFilename)) { + if (!containDuplicate(newFilename)) { setErrorMessage(""); + handleRename(attachment, newFilename + "." + extension); } else { - setErrorMessage(`File name cannot contain these characters, / : * ? " < > |`); + setErrorMessage( + `File name "${newFilename}.${extension}" already exists` + ); } - }; - - const saveNewCategory = () => { - handleReclassify(attachment, tagValue); + } else { + setErrorMessage( + `File name cannot be empty and cannot contain these characters, / : * ? " < > |` + ); } + }; - useEffect(() => { - if (attachment && attachment.category && modalFor == "reclassify") { - setTagValue(attachment.category?.toLowerCase()) + const updateFilesCb = (_files, _errorMessage) => { + setFiles(_files); + }; + const handleClose = () => { + if ( + (files.length > 0 && files !== existingDocuments) || + (modalFor === "rename" && + attachment.filename !== newFilename + "." + extension) + ) { + if ( + window.confirm( + "Are you sure you want to leave? Your changes will be lost." + ) + ) { + setFiles([]); + handleModal(false); + parseFileName(attachment); } - }, [modalFor, attachment]) + } else { + handleModal(false); + parseFileName(attachment); + } + if (uploadFor === "record") setTagValue(""); + }; + + const handleTagChange = (_tagValue) => { + setTagValue(_tagValue); + }; - const saveNewFilename = () => { - if(validateFilename(newFilename)) { - if(!containDuplicate(newFilename)) { - setErrorMessage(""); - handleRename(attachment, newFilename+"."+extension); + const handleSave = () => { + if (modalFor.toLowerCase() === "delete") { + handleModal(true, null, null); + } else { + let fileInfoList = []; + + let fileStatusTransition = ""; + if (modalFor === "replace" || modalFor === "replaceattachment") { + fileStatusTransition = attachment?.category; + } else if (uploadFor === "record") { + if ( + bcgovcode == "MCF" && + requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL + ) { + fileStatusTransition = + divisions.find((division) => division.divisionid === tagValue) + ?.divisionname || + MCFSections?.sections?.find( + (division) => division.divisionid === tagValue + )?.name; + } else if ( + bcgovcode == "MSD" && + requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL + ) { + fileStatusTransition = MSDSections?.sections?.find( + (division) => division.divisionid === tagValue + ).name; } else { - setErrorMessage(`File name "${newFilename}.${extension}" already exists`); + fileStatusTransition = divisions.find( + (division) => division.divisionid === tagValue + ).divisionname; } } else { - setErrorMessage(`File name cannot be empty and cannot contain these characters, / : * ? " < > |`); + fileStatusTransition = tagValue; } - }; + fileInfoList = files?.map((file) => { + return { + ministrycode: uploadFor === "record" ? bcgovcode : "Misc", + requestnumber: requestNumber ? requestNumber : `U-00${requestId}`, + filestatustransition: fileStatusTransition, + filename: file.filename ? file.filename : file.name, + filesize: file.size, + ...(uploadFor === "record" && { divisionid: tagValue }), + }; + }); - const updateFilesCb = (_files, _errorMessage) => { - setFiles(_files); + handleModal(true, fileInfoList, files); + setFiles([]); + if (uploadFor === "record") setTagValue(""); } - const handleClose = () => { - if ((files.length > 0 && files !== existingDocuments) || (modalFor === 'rename' && attachment.filename !== (newFilename+"."+extension))) { - if (window.confirm("Are you sure you want to leave? Your changes will be lost.")) { - setFiles([]); - handleModal(false); - parseFileName(attachment); - } + }; + const getMessage = () => { + let _message = {}; + switch (modalFor.toLowerCase()) { + case "add": + if (isMCFMSDPersonal && !isMinistryCoordinator) { + return { title: "Add Scanned Records", body: "" }; + } else { + return { title: "Add Attachment", body: "" }; } - else { - handleModal(false); - parseFileName(attachment); + case "replaceattachment": + if (uploadFor === "record") { + _message = { + title: "Replace Records", + body: ( + <> + Replace the existing record with a reformatted or updated + version of the same record.

    The original file that was + uploaded will still be available for download. + + ), + }; } - if (uploadFor === 'record') setTagValue(""); - }; - - const handleTagChange = (_tagValue) => { - setTagValue(_tagValue); - }; - - const handleSave = () => { - if (modalFor.toLowerCase() === "delete") { - handleModal(true, null, null); - } - else { - let fileInfoList = []; - - let fileStatusTransition = ""; - if (modalFor === 'replace' || modalFor === "replaceattachment") { - fileStatusTransition = attachment?.category; - } else if (uploadFor === "record") { - if(bcgovcode == "MCF" && requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) { - fileStatusTransition = divisions.find(division => division.divisionid === tagValue)?.divisionname || MCFSections?.sections?.find(division => division.divisionid === tagValue)?.name; - } else if(bcgovcode == "MSD" && requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) { - fileStatusTransition = MSDSections?.sections?.find(division => division.divisionid === tagValue).name; - } else { - fileStatusTransition = divisions.find(division => division.divisionid === tagValue).divisionname; + return _message; + case "replace": + if (uploadFor === "record") { + _message = { + title: "Replace Records", + body: ( + <> + Replace the existing record with a reformatted or updated + version of the same record.

    The original file that was + uploaded will still be available for download. + + ), + }; + } else if (attachment) { + switch (attachment.category.toLowerCase()) { + case StateTransitionCategories.cfrreview.name: + _message = { + title: "Replace Attachment", + body: ( + <> + This attachment must be replaced as it was uploaded during + the state change. Please replace attachment with document + from Request #{requestNumber} changing from{" "} + {StateTransitionCategories.cfrreview.fromState} to{" "} + {StateTransitionCategories.cfrreview.toState}. + + ), + }; + break; + case StateTransitionCategories.cfrfeeassessed.name: + _message = { + title: "Replace Attachment", + body: ( + <> + This attachment must be replaced as it was uploaded during + the state change. Please replace attachment with document + from Request #{requestNumber} changing from{" "} + + {" "} + {StateTransitionCategories.cfrfeeassessed.fromState}{" "} + {" "} + to{" "} + {StateTransitionCategories.cfrfeeassessed.toState} . + + ), + }; + break; + case StateTransitionCategories.signoffresponse.name: + _message = { + title: "Replace Attachment", + body: ( + <> + This attachment must be replaced as it was uploaded during + the state change. Please replace attachment with document + from Request #{requestNumber} changing from{" "} + {StateTransitionCategories.signoffresponse.fromState}{" "} + to{" "} + {StateTransitionCategories.signoffresponse.toState}. + + ), + }; + break; + case StateTransitionCategories.harmsreview.name: + _message = { + title: "Replace Attachment", + body: ( + <> + This attachment must be replaced as it was uploaded during + the state change. Please replace attachment with document + from Request #{requestNumber} changing from{" "} + {StateTransitionCategories.harmsreview.fromState} to{" "} + {StateTransitionCategories.harmsreview.toState}. + + ), + }; + break; + case StateTransitionCategories.responsereview.name: + _message = { + title: "Replace Attachment", + body: ( + <> + This attachment must be replaced as it was uploaded during + the state change. Please replace attachment with document + from Request #{requestNumber} changing from{" "} + {StateTransitionCategories.responsereview.fromState}{" "} + to {StateTransitionCategories.responsereview.toState} + . + + ), + }; + break; + case StateTransitionCategories.signoffreview.name: + _message = { + title: "Replace Attachment", + body: ( + <> + This attachment must be replaced as it was uploaded during + the state change. Please replace attachment with document + from Request #{requestNumber} changing from{" "} + {StateTransitionCategories.signoffreview.fromState}{" "} + to {StateTransitionCategories.signoffreview.toState}. + + ), + }; + break; + default: + _message = { + title: "Replace Attachment", + body: `This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #${requestNumber}`, + }; + break; } - } else { - fileStatusTransition = tagValue } - fileInfoList = files?.map(file => { + return _message; + case "rename": + return { title: "Rename Attachment", body: "" }; + case "reclassify": + return { title: "Reclassify Attachment", body: "" }; + case "delete": + if (uploadFor === "record") { return { - ministrycode: uploadFor === "record" ? bcgovcode : "Misc", - requestnumber: requestNumber ? requestNumber : `U-00${requestId}`, - filestatustransition: fileStatusTransition, - filename: file.filename? file.filename : file.name, - filesize: file.size, - ...(uploadFor === "record") && {divisionid: tagValue} - } - }); - - handleModal(true, fileInfoList, files); - setFiles([]); - if (uploadFor === 'record') setTagValue(""); - } - } - const getMessage = () => { - switch(modalFor.toLowerCase()) { - case "add": - if(isMCFMSDPersonal && !isMinistryCoordinator) { - return {title: "Add Scanned Records", body: ""}; - } - else - { - return {title: "Add Attachment", body: ""}; - } - case "replaceattachment": - if (uploadFor === 'record') { - _message = {title: "Replace Records", body:<>Replace the existing record with a reformatted or updated version of the same record.

    The original file that was uploaded will still be available for download. } - } - return _message; - case "replace": - let _message = {}; - if (uploadFor === 'record') { - _message = {title: "Replace Records", body:<>Replace the existing record with a reformatted or updated version of the same record.

    The original file that was uploaded will still be available for download. } - } else if (attachment) { - switch(attachment.category.toLowerCase()) { - case StateTransitionCategories.cfrreview.name: - _message = {title: "Replace Attachment", body: <>This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #{requestNumber} changing from {StateTransitionCategories.cfrreview.fromState} to {StateTransitionCategories.cfrreview.toState}.}; - break; - case StateTransitionCategories.cfrfeeassessed.name: - _message = {title: "Replace Attachment", body: <>This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #{requestNumber} changing from {StateTransitionCategories.cfrfeeassessed.fromState} to {StateTransitionCategories.cfrfeeassessed.toState} .}; - break; - case StateTransitionCategories.signoffresponse.name: - _message = {title: "Replace Attachment", body: <>This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #{requestNumber} changing from {StateTransitionCategories.signoffresponse.fromState} to {StateTransitionCategories.signoffresponse.toState}.}; - break; - case StateTransitionCategories.harmsreview.name: - _message = {title: "Replace Attachment", body: <>This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #{requestNumber} changing from {StateTransitionCategories.harmsreview.fromState} to {StateTransitionCategories.harmsreview.toState}.}; - break; - case StateTransitionCategories.responsereview.name: - _message = {title: "Replace Attachment", body: <>This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #{requestNumber} changing from {StateTransitionCategories.responsereview.fromState} to {StateTransitionCategories.responsereview.toState}.}; - break; - case StateTransitionCategories.signoffreview.name: - _message = {title: "Replace Attachment", body: <>This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #{requestNumber} changing from {StateTransitionCategories.signoffreview.fromState} to {StateTransitionCategories.signoffreview.toState}.}; - break; - default: - _message = {title: "Replace Attachment", body:`This attachment must be replaced as it was uploaded during the state change. Please replace attachment with document from Request #${requestNumber}` } - break; - } - } - return _message; - case "rename": - return {title: "Rename Attachment", body: ""}; - case "reclassify": - return {title: "Reclassify Attachment", body: ""} - case "delete": - if (uploadFor === 'record') { - return {title: "Delete Record", body: <>Are you sure you want to delete this record?

    If you delete this record, the record will not appear in the redaction app for review by IAO.}; - } else { - return {title: "Delete Attachment", body: "Are you sure you want to delete the attachment?"}; - } - default: - return {title: "", body: ""}; - } + title: "Delete Record", + body: ( + <> + Are you sure you want to delete this record?

    + + If you delete this record, the record will not appear in the + redaction app for review by IAO. + + + ), + }; + } else { + return { + title: "Delete Attachment", + body: "Are you sure you want to delete the attachment?", + }; + } + default: + return { title: "", body: "" }; } - let message = getMessage(); + }; + let message = getMessage(); - const isSaveDisabled = () => { - if (modalFor === 'delete') { - return false; - } else if (files.length === 0 && existingDocuments.length === 0) { - return true; - } else if (modalFor === 'add') { - return tagValue === ""; - } else if (modalFor === 'replace' || modalFor === 'replaceattachment') { - return false; - } + const isSaveDisabled = () => { + if (modalFor === "delete") { + return false; + } else if (files.length === 0 && existingDocuments.length === 0) { + return true; + } else if (modalFor === "add") { + return tagValue === ""; + } else if (modalFor === "replace" || modalFor === "replaceattachment") { + return false; } - - const MCFSections = useSelector((state) => state.foiRequests.foiPersonalSections); - const MSDSections = useSelector((state) => state.foiRequests.foiPersonalDivisionsAndSections); + }; + + const MCFSections = useSelector( + (state) => state.foiRequests.foiPersonalSections + ); + const MSDSections = useSelector( + (state) => state.foiRequests.foiPersonalDivisionsAndSections + ); - return ( -
    - + + - -

    {message.title}

    - - - -
    - - -
    - - {message.body} - -
    - {modalFor === 'reclassify' && +

    {message.title}

    + + + +
    + + +
    + {message.body} +
    + {modalFor === "reclassify" && (
    - Select the tag that you would like to reclassify this document with + + Select the tag that you would like to reclassify this + document with +
    - {tagList.map(tag => + {tagList.map((tag) => ( {handleTagChange(tag.name)}} + onClick={() => { + handleTagChange(tag.name); + }} clicked={tagValue == tag.name} /> - )} + ))}
    - } - { - (['replaceattachment','replace','add'].includes(modalFor)) ? - (requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL) ? - (bcgovcode == "MCF") ? - - : - (bcgovcode == "MSD" && MSDSections?.divisions?.length > 0) ? - - : - - : - + ) : bcgovcode == "MSD" && MSDSections?.divisions?.length > 0 ? ( + + ) : ( + - : - - } -
    -
    - - { - modalFor === 'reclassify' && - - } - { - modalFor === 'rename' && - - } - { - modalFor !== 'rename' && modalFor !== 'reclassify' && - - } - - -
    -
    - ); + )} + {modalFor === "rename" && ( + + )} + {modalFor !== "rename" && modalFor !== "reclassify" && ( + + )} + + + +
    + ); } -const ModalForRename = ({modalFor, newFilename, updateFilename, errorMessage, extension}) => { - - return( - modalFor === 'rename'? -
    -
    -
    - -
    -
    - .{extension} -
    -
    -
    - : null - ) -} +const ModalForRename = ({ + modalFor, + newFilename, + updateFilename, + errorMessage, + extension, +}) => { + return modalFor === "rename" ? ( +
    +
    +
    + +
    +
    .{extension}
    +
    +
    + ) : null; +}; From 01635e80ca0f41721636259bfa264580036cba35 Mon Sep 17 00:00:00 2001 From: divyav-aot <79858022+divyav-aot@users.noreply.github.com> Date: Fri, 17 Nov 2023 14:30:11 -0500 Subject: [PATCH 74/78] Update fee_service.py added logs to test the paybc response --- request-management-api/request_api/services/fee_service.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/request-management-api/request_api/services/fee_service.py b/request-management-api/request_api/services/fee_service.py index d85585a51..97ed4ac7f 100644 --- a/request-management-api/request_api/services/fee_service.py +++ b/request-management-api/request_api/services/fee_service.py @@ -126,6 +126,8 @@ def check_if_paid(self): def _validate_with_paybc(self, trn_approved): paybc_status = None paybc_response = self.get_paybc_transaction_details() + print("<<<<<<<<< paybc_response >>>>>>>>>>>>>>") + print(paybc_response) if trn_approved and (paybc_status := paybc_response.get('paymentstatus')) != 'PAID': raise BusinessException(Error.INVALID_INPUT) if paybc_status == 'PAID' and self.payment.total != float(paybc_response.get('trnamount')): From 4166929f279e71090b4d4761fc6062d0778f7cee Mon Sep 17 00:00:00 2001 From: divyav-aot Date: Fri, 17 Nov 2023 16:55:54 -0500 Subject: [PATCH 75/78] Added response in the onhold state dropdown --- .../FOI/customComponents/StateDropDown.js | 101 +++--- .../src/constants/FOI/statusEnum.js | 310 +++++++++++++----- 2 files changed, 293 insertions(+), 118 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js b/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js index 459aa806b..c2a637b52 100644 --- a/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js +++ b/forms-flow-web/src/components/FOI/customComponents/StateDropDown.js @@ -21,13 +21,17 @@ const StateDropDown = ({ stateTransition, updateStateDropDown, requestType, - isDivisionalCoordinator + isDivisionalCoordinator, }) => { const _isMinistryCoordinator = isMinistryCoordinator; const [status, setStatus] = useState(requestState); - const cfrFeeData = useSelector((reduxState) => reduxState.foiRequests.foiRequestCFRForm.feedata); - const cfrStatus = useSelector((reduxState) => reduxState.foiRequests.foiRequestCFRForm.status); + const cfrFeeData = useSelector( + (reduxState) => reduxState.foiRequests.foiRequestCFRForm.feedata + ); + const cfrStatus = useSelector( + (reduxState) => reduxState.foiRequests.foiRequestCFRForm.status + ); let requestDetails = useSelector( (state) => state.foiRequests.foiRequestDetail @@ -94,9 +98,12 @@ const StateDropDown = ({ if (_isMinistryCoordinator) { _stateList = MinistryStateList; } - const personalRequest = requestType?.toLowerCase() === FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL; + const personalRequest = + requestType?.toLowerCase() === + FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL; const personalIAO = !_isMinistryCoordinator && personalRequest; - + const previousState = + stateTransition?.length > 0 && stateTransition[1]?.status; switch (_state.toLowerCase()) { case StateEnum.unopened.name.toLowerCase(): return _stateList.unopened; @@ -104,27 +111,24 @@ const StateDropDown = ({ if (personalIAO) { return _stateList.intakeinprogressforpersonals; } else { - return _stateList.intakeinprogress; + return _stateList.intakeinprogress; } case StateEnum.peerreview.name.toLowerCase(): - if(!isMinistryCoordinator){ - //const currentStatusVersion = stateTransition[0]?.version; - const previousState = stateTransition?.length > 0 && stateTransition[1]?.status; - if(previousState === StateEnum.intakeinprogress.name){ + if (!isMinistryCoordinator) { + //const currentStatusVersion = stateTransition[0]?.version; + if (previousState === StateEnum.intakeinprogress.name) { return _stateList.intakeinprogress; - } - else if(previousState === StateEnum.open.name) + } else if (previousState === StateEnum.open.name) return _stateList.open; - else if(previousState === StateEnum.review.name) + else if (previousState === StateEnum.review.name) return _stateList.review; - else if(previousState === StateEnum.consult.name) + else if (previousState === StateEnum.consult.name) return _stateList.consult; - else if(previousState === StateEnum.response.name) + else if (previousState === StateEnum.response.name) return _stateList.response; - else if(previousState === StateEnum.appfeeowing.name) - return _stateList.appfeeowing - } - else{ + else if (previousState === StateEnum.appfeeowing.name) + return _stateList.appfeeowing; + } else { return _stateList.peerreview; } case StateEnum.open.name.toLowerCase(): @@ -136,50 +140,69 @@ const StateDropDown = ({ case StateEnum.callforrecords.name.toLowerCase(): if (_isMinistryCoordinator && personalRequest) return _stateList.callforrecordsforpersonal; - if(personalIAO && (requestDetails.bcgovcode.toLowerCase() === "mcf" || requestDetails.bcgovcode.toLowerCase() === "msd")) - return _stateList.callforrecordscfdmsdpersonal + if ( + personalIAO && + (requestDetails.bcgovcode.toLowerCase() === "mcf" || + requestDetails.bcgovcode.toLowerCase() === "msd") + ) + return _stateList.callforrecordscfdmsdpersonal; return _stateList.callforrecords; case StateEnum.tagging.name.toLowerCase(): - return _stateList.tagging; + return _stateList.tagging; case StateEnum.readytoscan.name.toLowerCase(): - return _stateList.readytoscan; + return _stateList.readytoscan; case StateEnum.review.name.toLowerCase(): - if(personalIAO && (requestDetails.bcgovcode.toLowerCase() === "mcf" || requestDetails.bcgovcode.toLowerCase() === "msd")) - return _stateList.reviewcfdmsdpersonal + if ( + personalIAO && + (requestDetails.bcgovcode.toLowerCase() === "mcf" || + requestDetails.bcgovcode.toLowerCase() === "msd") + ) + return _stateList.reviewcfdmsdpersonal; return _stateList.review; case StateEnum.onhold.name.toLowerCase(): + if (previousState === StateEnum.response.name) { + return _stateList.onhold.filter( + (_state) => + _state.status.toLowerCase() !== + StateEnum.callforrecords.name.toLowerCase() + ); + } else if (previousState === StateEnum.feeassessed.name) { + return _stateList.onhold.filter( + (_state) => + _state.status.toLowerCase() !== + StateEnum.response.name.toLowerCase() + ); + } return _stateList.onhold; case StateEnum.consult.name.toLowerCase(): return _stateList.consult; case StateEnum.signoff.name.toLowerCase(): return _stateList.signoff; case StateEnum.feeassessed.name.toLowerCase(): - if (personalIAO) - return _stateList.feeassessedforpersonal; + if (personalIAO) return _stateList.feeassessedforpersonal; return _stateList.feeassessed; - case StateEnum.onhold.name.toLowerCase(): - return _stateList.onhold; case StateEnum.deduplication.name.toLowerCase(): return _stateList.deduplication; case StateEnum.harms.name.toLowerCase(): return _stateList.harms; case StateEnum.response.name.toLowerCase(): - if (personalIAO) - return _stateList.responseforpersonal; - else if (cfrFeeData?.balanceremaining > 0 && cfrStatus === 'approved') { + if (personalIAO) return _stateList.responseforpersonal; + else if (cfrFeeData?.balanceremaining > 0 && cfrStatus === "approved") { return _stateList.response; - } - else { - return _stateList.response.filter(val => val.status.toLowerCase() !== StateEnum.onhold.name.toLowerCase()); + } else { + return _stateList.response.filter( + (val) => + val.status.toLowerCase() !== StateEnum.onhold.name.toLowerCase() + ); } case StateEnum.section5pending.name.toLowerCase(): if (personalIAO) { return _stateList.section5pending; - } - break + } + break; case StateEnum.appfeeowing.name.toLowerCase(): return _stateList.appfeeowing; - + default: return []; } @@ -217,7 +240,7 @@ const StateDropDown = ({ label="Status" className="foi-state-dropdown" InputLabelProps={{ shrink: false }} - inputProps={{'aria-labelledby': 'foi-status-dropdown-label'}} + inputProps={{ "aria-labelledby": "foi-status-dropdown-label" }} select value={status} onChange={handleChange} diff --git a/forms-flow-web/src/constants/FOI/statusEnum.js b/forms-flow-web/src/constants/FOI/statusEnum.js index 67f6bed93..aae8ef2ae 100644 --- a/forms-flow-web/src/constants/FOI/statusEnum.js +++ b/forms-flow-web/src/constants/FOI/statusEnum.js @@ -1,74 +1,214 @@ const StateList = Object.freeze({ - unopened: [{status: "Unopened", isSelected: false}, {status:"Intake in Progress", isSelected: false}], - intakeinprogress: [{status:"Intake in Progress", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "App Fee Owing", isSelected: false}, {status: "Closed", isSelected: false}], - intakeinprogressforpersonals: [{status:"Intake in Progress", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "Section 5 Pending", isSelected: false}, {status: "Closed", isSelected: false}], - redirect: [{status: "Redirect", isSelected: false}, {status:"Intake in Progress", isSelected: false}, {status: "Closed", isSelected: false}], - open: [{status: "Open", isSelected: false}, {status: "Call For Records", isSelected: false}, {status:"Peer Review", isSelected: false},{status: "Closed", isSelected: false}], - callforrecords: [{status: "Call For Records", isSelected: false}, {status: "Open", isSelected: false}, {status: "Closed", isSelected: false}], - callforrecordscfdmsdpersonal: [{status: "Call For Records", isSelected: false}, {status: "Open", isSelected: false}, {status: "Tagging", isSelected: false},{status: "Ready to Scan", isSelected: false}, {status: "Closed", isSelected: false}], - tagging :[{status: "Tagging", isSelected: true},{status: "Call For Records", isSelected: false}, {status: "Ready to Scan", isSelected: false},{status: "Records Review", isSelected: false}, {status: "Closed", isSelected: false}], - readytoscan : [{status: "Ready to Scan", isSelected: true},{status: "Call For Records", isSelected: false}, {status: "Tagging", isSelected: false},{status: "Records Review", isSelected: false}, {status: "Closed", isSelected: false}], - feeassessed: [{status: "Fee Estimate", isSelected: false}, {status: "On Hold", isSelected: false}, {status: "Call For Records", isSelected: false}, {status: "Closed", isSelected: false}], - feeassessedforpersonal: [{status: "Fee Estimate", isSelected: false}, {status: "Call For Records", isSelected: false}, {status: "Closed", isSelected: false}], - onhold: [{status: "On Hold", isSelected: false}, {status: "Call For Records", isSelected: false}, {status: "Closed", isSelected: false}], - deduplication: [{status: "Deduplication", isSelected: false}, {status: "Harms Assessment", isSelected: false}, {status: "Records Review", isSelected: false}, {status: "Closed", isSelected: false}], - harms: [{status: "Harms Assessment", isSelected: false}, {status: "Closed", isSelected: false}], - consult: [{status: "Consult", isSelected: false}, {status: "Records Review", isSelected: false}, {status: "Ministry Sign Off", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Closed", isSelected: false}], - review: [{status: "Records Review", isSelected: false}, {status: "Call For Records", isSelected: false}, {status: "Consult", isSelected: false}, {status: "Ministry Sign Off", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Response", isSelected: false}, {status: "Closed", isSelected: false}], - reviewcfdmsdpersonal: [{status: "Records Review", isSelected: false}, {status: "Call For Records", isSelected: false},{status: "Tagging", isSelected: false}, {status: "Consult", isSelected: false}, {status: "Ministry Sign Off", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Response", isSelected: false}, {status: "Closed", isSelected: false}], - signoff: [{status: "Ministry Sign Off", isSelected: false}, {status: "Closed", isSelected: false}], - response: [{status: "Response", isSelected: false}, {status: "On Hold", isSelected: false}, {status: "Records Review", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Closed", isSelected: false}], - responseforpersonal: [{status: "Response", isSelected: false}, {status: "Records Review", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Closed", isSelected: false}], - //peerreview: [{status:"Peer Review", isSelected: false},{status:"Intake in Progress", isSelected: false}, {status: "Open", isSelected: false},{status: "Records Review", isSelected: false},{status: "Consult", isSelected: false},{status: "Response", isSelected: false}], - peerreview: [{status:"Peer Review", isSelected: false}], - section5pending: [{status: "Section 5 Pending", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "Closed", isSelected: false}], - appfeeowing: [{status: "App Fee Owing", isSelected: false}, {status: "Open", isSelected: false}, {status:"Peer Review", isSelected: false}, {status: "Redirect", isSelected: false}, {status: "Closed", isSelected: false}] - }); + unopened: [ + { status: "Unopened", isSelected: false }, + { status: "Intake in Progress", isSelected: false }, + ], + intakeinprogress: [ + { status: "Intake in Progress", isSelected: false }, + { status: "Open", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Redirect", isSelected: false }, + { status: "App Fee Owing", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + intakeinprogressforpersonals: [ + { status: "Intake in Progress", isSelected: false }, + { status: "Open", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Redirect", isSelected: false }, + { status: "Section 5 Pending", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + redirect: [ + { status: "Redirect", isSelected: false }, + { status: "Intake in Progress", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + open: [ + { status: "Open", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + callforrecords: [ + { status: "Call For Records", isSelected: false }, + { status: "Open", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + callforrecordscfdmsdpersonal: [ + { status: "Call For Records", isSelected: false }, + { status: "Open", isSelected: false }, + { status: "Tagging", isSelected: false }, + { status: "Ready to Scan", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + tagging: [ + { status: "Tagging", isSelected: true }, + { status: "Call For Records", isSelected: false }, + { status: "Ready to Scan", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + readytoscan: [ + { status: "Ready to Scan", isSelected: true }, + { status: "Call For Records", isSelected: false }, + { status: "Tagging", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + feeassessed: [ + { status: "Fee Estimate", isSelected: false }, + { status: "On Hold", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + feeassessedforpersonal: [ + { status: "Fee Estimate", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + onhold: [ + { status: "On Hold", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Response", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + deduplication: [ + { status: "Deduplication", isSelected: false }, + { status: "Harms Assessment", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + harms: [ + { status: "Harms Assessment", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + consult: [ + { status: "Consult", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Ministry Sign Off", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + review: [ + { status: "Records Review", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Consult", isSelected: false }, + { status: "Ministry Sign Off", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Response", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + reviewcfdmsdpersonal: [ + { status: "Records Review", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Tagging", isSelected: false }, + { status: "Consult", isSelected: false }, + { status: "Ministry Sign Off", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Response", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + signoff: [ + { status: "Ministry Sign Off", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + response: [ + { status: "Response", isSelected: false }, + { status: "On Hold", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + responseforpersonal: [ + { status: "Response", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + //peerreview: [{status:"Peer Review", isSelected: false},{status:"Intake in Progress", isSelected: false}, {status: "Open", isSelected: false},{status: "Records Review", isSelected: false},{status: "Consult", isSelected: false},{status: "Response", isSelected: false}], + peerreview: [{ status: "Peer Review", isSelected: false }], + section5pending: [ + { status: "Section 5 Pending", isSelected: false }, + { status: "Open", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Redirect", isSelected: false }, + { status: "Closed", isSelected: false }, + ], + appfeeowing: [ + { status: "App Fee Owing", isSelected: false }, + { status: "Open", isSelected: false }, + { status: "Peer Review", isSelected: false }, + { status: "Redirect", isSelected: false }, + { status: "Closed", isSelected: false }, + ], +}); const MinistryStateList = Object.freeze({ - unopened: [{status: "Unopened", isSelected: false}], - intakeinprogress: [{status:"Intake in Progress", isSelected: false}], - redirect: [{status: "Redirect", isSelected: false}], - open: [{status: "Open", isSelected: false}], - callforrecords: [{status: "Call For Records", isSelected: false}, {status: "Fee Estimate", isSelected: false}, {status: "Harms Assessment", isSelected: false}, {status: "Deduplication", isSelected: false}, {status: "Records Review", isSelected: false}, {status: "Ministry Sign Off", isSelected: false}], - callforrecordsforpersonal: [{status: "Call For Records", isSelected: false}, {status: "Harms Assessment", isSelected: false}, {status: "Deduplication", isSelected: false}, {status: "Records Review", isSelected: false}, {status: "Ministry Sign Off", isSelected: false}], - feeassessed: [{status: "Fee Estimate", isSelected: false}], - onhold: [{status: "On Hold", isSelected: false}], - deduplication: [{status: "Deduplication", isSelected: false}], - harms: [{status: "Harms Assessment", isSelected: false}, {status: "Call For Records", isSelected: false}, {status: "Records Review", isSelected: false}], - consult: [{status: "Consult", isSelected: false}], - review: [{status: "Records Review", isSelected: false}], - signoff: [{status: "Ministry Sign Off", isSelected: false}, {status: "Records Review", isSelected: false}, {status: "Response", isSelected: false}], - response: [{status: "Response", isSelected: false}], - closed: [{status: "Closed", isSelected: false}], - peerreview: [{status: "Peer Review", isSelected: false}], - tagging :[{status: "Tagging", isSelected: true}], - readytoscan : [{status: "Ready to Scan", isSelected: true}] + unopened: [{ status: "Unopened", isSelected: false }], + intakeinprogress: [{ status: "Intake in Progress", isSelected: false }], + redirect: [{ status: "Redirect", isSelected: false }], + open: [{ status: "Open", isSelected: false }], + callforrecords: [ + { status: "Call For Records", isSelected: false }, + { status: "Fee Estimate", isSelected: false }, + { status: "Harms Assessment", isSelected: false }, + { status: "Deduplication", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Ministry Sign Off", isSelected: false }, + ], + callforrecordsforpersonal: [ + { status: "Call For Records", isSelected: false }, + { status: "Harms Assessment", isSelected: false }, + { status: "Deduplication", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Ministry Sign Off", isSelected: false }, + ], + feeassessed: [{ status: "Fee Estimate", isSelected: false }], + onhold: [{ status: "On Hold", isSelected: false }], + deduplication: [{ status: "Deduplication", isSelected: false }], + harms: [ + { status: "Harms Assessment", isSelected: false }, + { status: "Call For Records", isSelected: false }, + { status: "Records Review", isSelected: false }, + ], + consult: [{ status: "Consult", isSelected: false }], + review: [{ status: "Records Review", isSelected: false }], + signoff: [ + { status: "Ministry Sign Off", isSelected: false }, + { status: "Records Review", isSelected: false }, + { status: "Response", isSelected: false }, + ], + response: [{ status: "Response", isSelected: false }], + closed: [{ status: "Closed", isSelected: false }], + peerreview: [{ status: "Peer Review", isSelected: false }], + tagging: [{ status: "Tagging", isSelected: true }], + readytoscan: [{ status: "Ready to Scan", isSelected: true }], }); // This corresponds to rows in the FOIRequestStatuses table on the backend const StateEnum = Object.freeze({ - open: {name: "Open", id: 1}, - callforrecords: {name: "Call For Records", id: 2}, - callforrecordsoverdue: {name: "Call For Records Overdue", id: -100}, - closed: {name: "Closed", id: 3}, - redirect: {name: "Redirect", id: 4}, - unopened: {name: "Unopened", id: 5}, - intakeinprogress: {name: "Intake in Progress", id: 6}, - review: {name: "Records Review", id: 7}, - feeassessed: {name: "Fee Estimate", id: 8}, - consult: {name: "Consult", id: 9}, - signoff: {name: "Ministry Sign Off", id: 10}, - onhold: {name: "On Hold", id: 11}, - deduplication: {name: "Deduplication", id: 12}, - harms: {name: "Harms Assessment", id: 13}, - response: {name: "Response", id: 14}, - archived: {name: "Archived", id: 15}, - peerreview: {name: "Peer Review", id: 16}, - tagging: {name: "Tagging", id: 17}, - readytoscan: {name: "Ready to Scan", id: 18}, - appfeeowing: {name: "App Fee Owing", id: 19}, - section5pending: {name: "Section 5 Pending", id: 20}, + open: { name: "Open", id: 1 }, + callforrecords: { name: "Call For Records", id: 2 }, + callforrecordsoverdue: { name: "Call For Records Overdue", id: -100 }, + closed: { name: "Closed", id: 3 }, + redirect: { name: "Redirect", id: 4 }, + unopened: { name: "Unopened", id: 5 }, + intakeinprogress: { name: "Intake in Progress", id: 6 }, + review: { name: "Records Review", id: 7 }, + feeassessed: { name: "Fee Estimate", id: 8 }, + consult: { name: "Consult", id: 9 }, + signoff: { name: "Ministry Sign Off", id: 10 }, + onhold: { name: "On Hold", id: 11 }, + deduplication: { name: "Deduplication", id: 12 }, + harms: { name: "Harms Assessment", id: 13 }, + response: { name: "Response", id: 14 }, + archived: { name: "Archived", id: 15 }, + peerreview: { name: "Peer Review", id: 16 }, + tagging: { name: "Tagging", id: 17 }, + readytoscan: { name: "Ready to Scan", id: 18 }, + appfeeowing: { name: "App Fee Owing", id: 19 }, + section5pending: { name: "Section 5 Pending", id: 20 }, }); const StateTransitionCategories = Object.freeze({ @@ -172,14 +312,16 @@ const AttachmentCategories = Object.freeze({ bgcolor: "#04596C", type: ["transition"], }, - { // tag: Add Attachment Modal + { + // tag: Add Attachment Modal name: "applicant", tags: ["applicant"], display: "Applicant", bgcolor: "#F99F16", type: ["tag"], }, - { // transition: Fee estimate -> On hold + { + // transition: Fee estimate -> On hold name: "feeassessed-onhold", tags: ["applicant", "feeassessed-onhold"], display: "Applicant", @@ -229,11 +371,11 @@ const AttachmentCategories = Object.freeze({ type: ["tag"], }, { - name: "ministrysignoff", - tags: ["ministrysignoff"], - display: "Ministry Sign Off", - bgcolor: "#4B296B", - type: ["tag"], + name: "ministrysignoff", + tags: ["ministrysignoff"], + display: "Ministry Sign Off", + bgcolor: "#4B296B", + type: ["tag"], }, { name: "response", @@ -249,28 +391,31 @@ const AttachmentCategories = Object.freeze({ bgcolor: "#595959", type: ["tag"], }, - { // transition: Response -> On hold + { + // transition: Response -> On hold name: "response-onhold", tags: ["response-onhold"], display: "Response > On Hold", bgcolor: "#F99F16", type: ["transition"], }, - { // transition: Records Review -> Response + { + // transition: Records Review -> Response name: "response-review", tags: ["response-review"], display: "Response > Review", bgcolor: "#04596C", type: ["transition"], }, - { // transition: Records Review -> Response + { + // transition: Records Review -> Response name: "signoff-review", tags: ["signoff-review"], display: "Sign Off > Review", bgcolor: "#04596C", type: ["transition"], }, - ] + ], }); const AttachmentLetterCategories = Object.freeze({ @@ -284,17 +429,24 @@ const AttachmentLetterCategories = Object.freeze({ name: "fee estimate - successful", }, feeestimatepaymentreceipt: { - name: "fee estimate - payment receipt" + name: "fee estimate - payment receipt", }, feeestimatepaymentcorrespondencesuccessful: { - name: "fee estimate - payment success" + name: "fee estimate - payment success", }, feeestimatepaymentcorrespondencefailed: { - name: "fee estimate - payment success - correspondence failed" + name: "fee estimate - payment success - correspondence failed", }, feeestimateoutstandingletter: { name: "fee balance outstanding - letter", }, }); -export { StateList, MinistryStateList, StateEnum, StateTransitionCategories, AttachmentCategories, AttachmentLetterCategories }; \ No newline at end of file +export { + StateList, + MinistryStateList, + StateEnum, + StateTransitionCategories, + AttachmentCategories, + AttachmentLetterCategories, +}; From e6dcb5448720fbb3ab4e288b69b1e6283ff15b0e Mon Sep 17 00:00:00 2001 From: divyav-aot <79858022+divyav-aot@users.noreply.github.com> Date: Fri, 17 Nov 2023 20:15:26 -0500 Subject: [PATCH 76/78] Update fee_service.py --- request-management-api/request_api/services/fee_service.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/request-management-api/request_api/services/fee_service.py b/request-management-api/request_api/services/fee_service.py index 97ed4ac7f..a8c5a25a2 100644 --- a/request-management-api/request_api/services/fee_service.py +++ b/request-management-api/request_api/services/fee_service.py @@ -208,7 +208,8 @@ def get_paybc_transaction_details(self): }, timeout=current_app.config.get('CONNECT_TIMEOUT') ) - + print("<<<<<<< response >>>>>>>>>") + print(response) return response.json() def get_paybc_token(self): From 18d071620b483b48d46f4ed73c7ce569ea63d7f7 Mon Sep 17 00:00:00 2001 From: divyav-aot <79858022+divyav-aot@users.noreply.github.com> Date: Fri, 17 Nov 2023 20:37:23 -0500 Subject: [PATCH 77/78] Update fee_service.py --- request-management-api/request_api/services/fee_service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/request-management-api/request_api/services/fee_service.py b/request-management-api/request_api/services/fee_service.py index a8c5a25a2..a2b5eff59 100644 --- a/request-management-api/request_api/services/fee_service.py +++ b/request-management-api/request_api/services/fee_service.py @@ -200,6 +200,8 @@ def get_paybc_transaction_details(self): paybc_ref_number: str = current_app.config.get('PAYBC_REF_NUMBER') endpoint = f'{paybc_transaction_url}/paybc/payment/{paybc_ref_number}/{self.payment.transaction_number}' + print("endpoint >>>>> ", endpoint) + print("access_token >>> ", access_token) response = requests.get( endpoint, headers={ @@ -216,6 +218,7 @@ def get_paybc_token(self): """Generate oauth token from payBC which will be used for all communication.""" current_app.logger.debug('>>> ", token_url) basic_auth_encoded = base64.b64encode( bytes(current_app.config.get('PAYBC_API_CLIENT') + ':' + current_app.config.get( 'PAYBC_API_SECRET'), 'utf-8')).decode('utf-8') @@ -229,7 +232,8 @@ def get_paybc_token(self): }, timeout=current_app.config.get('CONNECT_TIMEOUT') ) - + print("response >>>> ") + print(response) current_app.logger.debug('>Getting token') return response From 45ef695f4d0ac6c402e7c8a14ca4d811c1e55ccc Mon Sep 17 00:00:00 2001 From: divyav-aot <79858022+divyav-aot@users.noreply.github.com> Date: Tue, 21 Nov 2023 10:46:50 -0500 Subject: [PATCH 78/78] Update fee_service.py Removed all logs from fee_service --- .../request_api/services/fee_service.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/request-management-api/request_api/services/fee_service.py b/request-management-api/request_api/services/fee_service.py index a2b5eff59..a68a6dd31 100644 --- a/request-management-api/request_api/services/fee_service.py +++ b/request-management-api/request_api/services/fee_service.py @@ -126,8 +126,6 @@ def check_if_paid(self): def _validate_with_paybc(self, trn_approved): paybc_status = None paybc_response = self.get_paybc_transaction_details() - print("<<<<<<<<< paybc_response >>>>>>>>>>>>>>") - print(paybc_response) if trn_approved and (paybc_status := paybc_response.get('paymentstatus')) != 'PAID': raise BusinessException(Error.INVALID_INPUT) if paybc_status == 'PAID' and self.payment.total != float(paybc_response.get('trnamount')): @@ -200,8 +198,6 @@ def get_paybc_transaction_details(self): paybc_ref_number: str = current_app.config.get('PAYBC_REF_NUMBER') endpoint = f'{paybc_transaction_url}/paybc/payment/{paybc_ref_number}/{self.payment.transaction_number}' - print("endpoint >>>>> ", endpoint) - print("access_token >>> ", access_token) response = requests.get( endpoint, headers={ @@ -210,15 +206,12 @@ def get_paybc_transaction_details(self): }, timeout=current_app.config.get('CONNECT_TIMEOUT') ) - print("<<<<<<< response >>>>>>>>>") - print(response) return response.json() def get_paybc_token(self): """Generate oauth token from payBC which will be used for all communication.""" current_app.logger.debug('>>> ", token_url) basic_auth_encoded = base64.b64encode( bytes(current_app.config.get('PAYBC_API_CLIENT') + ':' + current_app.config.get( 'PAYBC_API_SECRET'), 'utf-8')).decode('utf-8') @@ -232,8 +225,6 @@ def get_paybc_token(self): }, timeout=current_app.config.get('CONNECT_TIMEOUT') ) - print("response >>>> ") - print(response) current_app.logger.debug('>Getting token') return response