Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 0b5ea01
Merge: 53922f8 d9ac78c
Author: Daniel Gopar <gopar@users.noreply.github.com>
Date:   Tue Mar 30 15:07:24 2021 -0700

    Merge pull request #266 from adhocteam/TTAHUB-57-screen-reader-update

    Screen reader update

commit d9ac78c
Author: Daniel Riquiac Gopar <danielriquiacgopar@danielrrmacbook.lan>
Date:   Tue Mar 30 14:34:19 2021 -0700

    TTAHUB-57 Fix wording for grantee prompt

commit 3660e10
Merge: 48bda03 53922f8
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Tue Mar 30 17:01:27 2021 -0400

    Merge branch 'main' into TTAHUB-57-screen-reader-update

commit 53922f8
Merge: 8d514e2 8b99f94
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Tue Mar 30 11:36:48 2021 -0400

    Merge pull request #258 from adhocteam/cm-60-add-nightly-reconcilliation

    Cm 60 add nightly reconcilliation

commit 48bda03
Author: Daniel Riquiac Gopar <danielriquiacgopar@danielrrmacbook.lan>
Date:   Tue Mar 30 08:26:46 2021 -0700

    TTAHUB-57 Fix wording

commit 52000b0
Author: Daniel Riquiac Gopar <danielriquiacgopar@danielrrmacbook.lan>
Date:   Tue Mar 30 05:56:40 2021 -0700

    TTAHUB-57 Add more screen reader info

commit 8b99f94
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Fri Mar 26 17:01:03 2021 -0400

    reenable new relic and remove catch block from src/worker.js

commit 274c644
Merge: 30b7c6a 8d514e2
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 16:49:29 2021 -0400

    Merge branch 'adhoc-main' into cm-60-add-nightly-reconcilliation

    * adhoc-main:
      Remove early exit from reconcile CLI script

commit 8d514e2
Merge: 2d20135 f0dba5c
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 16:45:17 2021 -0400

    Merge pull request #264 from adhocteam/reconcile-script-exit

    Remove early exit from reconcile CLI script

commit 30b7c6a
Merge: 857b86d 2d20135
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Fri Mar 26 16:29:46 2021 -0400

    Merge branch 'main' into cm-60-add-nightly-reconcilliation

commit f0dba5c
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 15:49:51 2021 -0400

    Remove early exit from reconcile CLI script

commit 0b2e663
Merge: c5acb18 2d20135
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 13:12:55 2021 -0400

    Merge pull request #412 from adhocteam/main

    Upload scan file size to 30MB

commit 2d20135
Merge: b5298a2 3a48108
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 12:54:49 2021 -0400

    Merge pull request #263 from HHS/clamav-file-size-fix

    Increase max file size for scanned files

commit 3a48108
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 11:47:35 2021 -0400

    Increase max file size for scanning files to 30MB.

    Largest file uploaded in Smartsheet was 25.2MB

commit c5acb18
Merge: 6a735e3 b5298a2
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 10:13:34 2021 -0400

    Merge pull request #411 from adhocteam/main

    Smartsheet reconciliation & attachments

commit b5298a2
Merge: 87cac4a 2baf59f
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 09:57:13 2021 -0400

    Merge pull request #262 from adhocteam/cfignore-legacy-scripts

    Prevent legacy scripts from deploying

commit 2baf59f
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 09:39:56 2021 -0400

    Deploy to sandbox to verify cfignore behavior

commit db7dfee
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 09:37:47 2021 -0400

    Don't deploy smartsheet_scripts

commit 87cac4a
Merge: af74b8e 7612222
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 09:21:06 2021 -0400

    Merge pull request #257 from adhocteam/legacy-comment-file-upload

    Legacy report comments and file upload

commit 7612222
Merge: a69be99 af74b8e
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 09:13:05 2021 -0400

    Merge branch 'adhoc-main' into legacy-comment-file-upload

    * adhoc-main:
      fix apiDirectory.test.js
      update activityReports.test.js
      update activityReports.test.js
      update usernames to be unique
      update legacyreport.test.js
      update legacyreport.test.js
      more debugging
      more tmp debug
      temp debug
      Update legacyreport.test.js
      remove temp debugging
      add temp debugging
      revert UserInfo.js
      update frontend UserInfo.js
      update users.test.js
      fix frontend UserInfo.js test
      add missing hsesUserId
      add unique hsesUsername to tests

commit 857b86d
Merge: 8989d9e af74b8e
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Fri Mar 26 09:06:11 2021 -0400

    Merge branch 'main' into cm-60-add-nightly-reconcilliation

commit af74b8e
Merge: cd700ad b3223a8
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 26 09:04:41 2021 -0400

    Merge pull request #260 from adhocteam/cm-fix-ci-backend-tests

    Cm fix ci backend tests

commit b3223a8
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Thu Mar 25 17:04:48 2021 -0400

    fix apiDirectory.test.js

commit 21db847
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 21:02:12 2021 -0400

    update activityReports.test.js

commit 01e3c05
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 20:56:47 2021 -0400

    update activityReports.test.js

commit 3f16fa1
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 20:53:26 2021 -0400

    update usernames to be unique

commit 83490c0
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 15:56:17 2021 -0400

    update legacyreport.test.js

commit 2664ef0
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 14:32:53 2021 -0400

    update legacyreport.test.js

commit 3e98748
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 14:26:18 2021 -0400

    more debugging

commit 2d1bac6
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 14:19:30 2021 -0400

    more tmp debug

commit f917992
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 14:13:45 2021 -0400

    temp debug

commit 33fe0c5
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 14:04:09 2021 -0400

    Update legacyreport.test.js

commit 282362e
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 13:58:31 2021 -0400

    remove temp debugging

commit d6084e8
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 13:45:34 2021 -0400

    add temp debugging

commit 15f4180
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 13:41:53 2021 -0400

    revert UserInfo.js

commit 2158d8f
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 13:33:23 2021 -0400

    update frontend UserInfo.js

commit 2b54448
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 13:29:01 2021 -0400

    update users.test.js

commit 4561c9f
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 13:20:01 2021 -0400

    fix frontend UserInfo.js test

commit 3bdb4e0
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 13:18:03 2021 -0400

    add missing hsesUserId

commit 5da4fe7
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 13:03:59 2021 -0400

    add unique hsesUsername to tests

commit a69be99
Merge: aeec8a0 cd700ad
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Wed Mar 24 11:33:10 2021 -0400

    Merge branch 'main' into legacy-comment-file-upload

commit 8989d9e
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Wed Mar 24 11:33:05 2021 -0400

    Squashed commit of the following:

    commit cd700ad
    Merge: 9497312 af81eaa
    Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
    Date:   Wed Mar 24 11:32:17 2021 -0400

        Merge pull request #255 from adhocteam/cm-60-reconcile-legacy-reports

        Cm 60 reconcile legacy reports

    commit af81eaa
    Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
    Date:   Wed Mar 24 11:19:00 2021 -0400

        remove babel-node from reconcile:legacy

    commit d2b329a
    Merge: 2951bc8 2e994a9
    Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
    Date:   Wed Mar 24 11:06:52 2021 -0400

        Merge branch 'cm-60-reconcile-legacy-reports' of github.com:adhocteam/Head-Start-TTADP into cm-60-reconcile-legacy-reports

    commit 2951bc8
    Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
    Date:   Wed Mar 24 11:06:50 2021 -0400

        add catch to tools/reconcileLegacyReports.js and reconcile:legacy:local command to package.json

    commit 2e994a9
    Merge: d8f1d2e 9497312
    Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
    Date:   Tue Mar 23 17:32:11 2021 -0400

        Merge branch 'main' into cm-60-reconcile-legacy-reports

    commit 9497312
    Merge: 6c28851 80c4049
    Author: kryswisnaskas <krystyna@adhocteam.us>
    Date:   Tue Mar 23 16:03:16 2021 -0400

        Merge pull request #256 from adhocteam/kw-ie-keyboard-nav

        IE keyboard navigation fix

    commit 80c4049
    Merge: e2bf1fe 6c28851
    Author: kryswisnaskas <krystyna.wisnaskas@gmail.com>
    Date:   Tue Mar 23 14:45:41 2021 -0400

        Merge branch 'main' of https://github.com/adhocteam/Head-Start-TTADP into kw-ie-keyboard-nav

    commit e2bf1fe
    Author: kryswisnaskas <krystyna.wisnaskas@gmail.com>
    Date:   Tue Mar 23 09:58:49 2021 -0400

        Deploy to sandbox

    commit 8c42486
    Author: kryswisnaskas <krystyna.wisnaskas@gmail.com>
    Date:   Mon Mar 22 11:47:15 2021 -0400

        Redirect focus after date pick

commit aeec8a0
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Wed Mar 24 11:22:20 2021 -0400

    coerceReportId now works with either string or number regions

commit ce3be5f
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Wed Mar 24 11:11:28 2021 -0400

    Linter fixes

commit 1b31acf
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Wed Mar 24 09:59:04 2021 -0400

    Include attchment transition script in full repo

commit 26e2b08
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Tue Mar 23 17:31:13 2021 -0400

    Add recurring event to reconcile legacy reports

commit 6a735e3
Merge: 982e021 9497312
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Tue Mar 23 16:24:49 2021 -0400

    Merge pull request #408 from adhocteam/main

    IE keyboard navigation fix

commit dfc5633
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Tue Mar 23 16:03:34 2021 -0400

    Ensure legacy AR ids have a 2 digit region number

commit 44b789e
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Tue Mar 23 12:00:29 2021 -0400

    Linter fixes

commit f867c8e
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Tue Mar 23 11:53:20 2021 -0400

    Add general SCANNING_FAILED status to capture other failure reasons

    Such as: "[ERR_FR_MAX_BODY_LENGTH_EXCEEDED]: Request body larger than maxBodyLength"

commit 803ba2b
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Tue Mar 23 10:48:24 2021 -0400

    Display comments and attachments in legacy reports

commit 4856195
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Mon Mar 22 16:19:36 2021 -0400

    Allow admins to upload files on any report

commit be00f49
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 19 14:44:31 2021 -0400

    Allow legacy AR comments to be updated

commit 982e021
Merge: 13fff8b 6c28851
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Mon Mar 22 13:21:10 2021 -0400

    Merge pull request #405 from adhocteam/main

    External Dialog Link

commit 13fff8b
Merge: 8caa9af f7074ce
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Fri Mar 19 08:47:37 2021 -0400

    Merge pull request #403 from adhocteam/main

    Edit next steps in-place; Fix warnings in tests

commit 8caa9af
Merge: 99ab32e 576adbf
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Wed Mar 17 13:15:51 2021 -0400

    Merge pull request #402 from adhocteam/main

    Fix layout stacking in print styles

commit 99ab32e
Merge: 3777c68 dd9b1aa
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Wed Mar 17 11:22:30 2021 -0400

    Merge pull request #400 from adhocteam/main

    Small frontend fixes

commit 3777c68
Merge: 8d085d0 23f4978
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Wed Mar 17 10:05:29 2021 -0400

    Merge pull request #399 from adhocteam/main

    Fix read region access issue on first login

commit 8d085d0
Merge: 57e3152 81e876f
Author: Ryan Ahearn <ryan.ahearn@gsa.gov>
Date:   Tue Mar 16 15:26:01 2021 -0400

    Merge pull request #395 from adhocteam/main

    Rolling deploys
  • Loading branch information
dcmcand committed Mar 31, 2021
1 parent cebc7ed commit 5526368
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const SPECIALIST_INPUT = 'specialistNextSteps-input';
const SPECIALIST_BUTTON = 'specialistNextSteps-button';
const SPECIALIST_CANCEL_BUTTON = 'specialistNextSteps-cancel-button';

const GRANTEE_NEXT_STEPS = 'Grantees Next Steps';
const GRANTEE_NEXT_STEPS = "Grantee's Next Steps";
const GRANTEE_INPUT = 'granteeNextSteps-input';
const GRANTEE_BUTTON = 'granteeNextSteps-button';
const GRANTEE_CANCEL_BUTTON = 'granteeNextSteps-cancel-button';
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/pages/ActivityReport/Pages/nextSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,14 @@ const NoteEntries = ({ name, humanName, label }) => {
: (
<Button type="button" unstyled onClick={() => onEdit(notes.length)}>
<FontAwesomeIcon icon={faPlusCircle} />
<span className="padding-left-05">Add New Next Step</span>
<span className="padding-left-05">
Add New
{' '}
<span className="usa-sr-only">
{humanName}
</span>
Next Step
</span>
</Button>
)}

Expand All @@ -183,7 +190,7 @@ const NextSteps = () => (
<NoteEntries name="specialistNextSteps" humanName="Specialist" label="What have you agreed to do next?" />
</div>

<NoteEntries name="granteeNextSteps" humanName="Grantees" label="What has the grantee agreed to do next?" />
<NoteEntries name="granteeNextSteps" humanName="Grantee's" label="What has the grantee agreed to do next?" />

</>
);
Expand Down
38 changes: 38 additions & 0 deletions src/lib/queue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import Queue from 'bull';

const generateRedisConfig = () => {
if (process.env.VCAP_SERVICES) {
const {
'aws-elasticache-redis': [{
credentials: {
host,
port,
password,
},
}],
} = JSON.parse(process.env.VCAP_SERVICES);
return {
host,
port,
// TLS needs to be set to an empty object for redis on cloud.gov
// eslint-disable-next-line no-empty-pattern
redisOpts: { redis: { password, tls: {} } },
};
}
const { REDIS_HOST: host, REDIS_PASS: password } = process.env;
return {
host,
port: (process.env.REDIS_PORT || 6379),
redisOpts: { redis: { password } },
};
};

const {
host,
port,
redisOpts,
} = generateRedisConfig();

export default function newQueue(queName) {
return new Queue(queName, `redis://${host}:${port}`, redisOpts);
}
69 changes: 47 additions & 22 deletions src/services/legacyreports.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Op } from 'sequelize';
import { userByEmail } from './users';
import { ActivityReport, ActivityReportCollaborator } from '../models';
import { logger } from '../logger';
import { auditLogger, logger } from '../logger';
import newQueue from '../lib/queue';

/*
* Returns all legacy reports that either:
Expand Down Expand Up @@ -121,29 +122,53 @@ export const reconcileCollaborators = async (report) => {
};

export default async function reconcileLegacyReports() {
logger.info('Starting legacy report reconciliation');
// Get all reports that might need reconciliation
const reports = await getLegacyReports();
logger.info(`found ${reports.length} reports that may need reconciliation`);
// Array to help promises from reports that are getting reconciled
const updates = [];
try {
reports.forEach((report) => {
// if there is no author, try to reconcile the author
if (!report.userId) {
updates.push(reconcileAuthors(report));
}
// if there is no approving manager, try to reconcile the approving manager
if (!report.approvingManagerId) {
updates.push(reconcileApprovingManagers(report));
}
// if the report has collaborators, check if collaborators need reconcilliation.
if (report.imported.otherSpecialists !== '') {
updates.push(reconcileCollaborators(report));
}
});
// let all promises resolve
await Promise.all(updates);
} catch (err) {
logger.error(err);
throw err;
if (reports) {
const updates = [];
try {
reports.forEach((report) => {
// if there is no author, try to reconcile the author
if (!report.userId) {
updates.push(reconcileAuthors(report));
}
// if there is no approving manager, try to reconcile the approving manager
if (!report.approvingManagerId) {
updates.push(reconcileApprovingManagers(report));
}
// if the report has collaborators, check if collaborators need reconcilliation.
if (report.imported.otherSpecialists !== '') {
updates.push(reconcileCollaborators(report));
}
});
// let all promises resolve
await Promise.all(updates);
} catch (err) {
logger.error(err);
throw err;
}
}
return 'done';
}

export const reconciliationQueue = newQueue('reconcile');

// Checks if this job is already queued and adds it if it isn't
const populateReconciliationQueue = async () => {
try {
const depth = await reconciliationQueue.count();
if (depth < 1) {
// To test, uncomment the following line and comment out the one below.
// that will make it run every minute instead of every day at 2 am.
// await reconciliationQueue.add('legacyReports', {}, { repeat: { cron: '* * * * *' } });
await reconciliationQueue.add('legacyReports', {}, { repeat: { cron: '0 2 * * *' } });
}
} catch (e) {
auditLogger.error(e);
}
};

populateReconciliationQueue();
38 changes: 2 additions & 36 deletions src/services/scanQueue.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,6 @@
import Queue from 'bull';

const generateRedisConfig = () => {
if (process.env.VCAP_SERVICES) {
const {
'aws-elasticache-redis': [{
credentials: {
host,
port,
password,
},
}],
} = JSON.parse(process.env.VCAP_SERVICES);
return {
host,
port,
// TLS needs to be set to an empty object for redis on cloud.gov
// eslint-disable-next-line no-empty-pattern
redisOpts: { redis: { password, tls: {} } },
};
}
const { REDIS_HOST: host, REDIS_PASS: password } = process.env;
return {
host,
port: (process.env.REDIS_PORT || 6379),
redisOpts: { redis: { password } },
};
};

const {
host,
port,
redisOpts,
} = generateRedisConfig();

const scanQueue = new Queue('scan', `redis://${host}:${port}`, redisOpts);
import newQueue from '../lib/queue';

const scanQueue = newQueue('scan');
const addToScanQueue = (fileKey) => {
const retries = process.env.FILE_SCAN_RETRIES || 5;
const delay = process.env.FILE_SCAN_BACKOFF_DELAY || 10000;
Expand Down
10 changes: 10 additions & 0 deletions src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ require('newrelic');
import {} from 'dotenv/config';
import throng from 'throng';
import { logger, auditLogger } from './logger';
import reconcileLegacyReports, { reconciliationQueue } from './services/legacyreports';
import { scanQueue } from './services/scanQueue';
import processFile from './workers/files';

Expand All @@ -23,6 +24,15 @@ function start() {
}
});
scanQueue.process(maxJobsPerWorker, (job) => processFile(job.data.key));

reconciliationQueue.on('failed', (job, error) => auditLogger
.error(`${job.data.key}: Legacy report reconciliation failed with error ${error}`));
reconciliationQueue.on('completed', () => logger
.info('Legacy report reconciliation completed successfully'));
reconciliationQueue.process('legacyReports', async (job) => {
logger.info(`starting ${job}`);
await reconcileLegacyReports();
});
}

// spawn workers and start them
Expand Down

0 comments on commit 5526368

Please sign in to comment.