Skip to content

Commit

Permalink
Merge branch 'master' into MB-14374
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan-Koch committed Nov 2, 2022
2 parents 0ca0a93 + aa1f8d8 commit 6ff68c9
Show file tree
Hide file tree
Showing 65 changed files with 910 additions and 352 deletions.
12 changes: 10 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -510,13 +510,21 @@ commands:
docker load -i images/<< parameters.image_name >>
- run:
name: 'Tag and push docker image'

command: |
aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com
docker tag << parameters.image_name >>:<< parameters.tag >> ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/<< parameters.repo >>:git-${CIRCLE_SHA1}
docker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/<< parameters.repo >>:git-${CIRCLE_SHA1}
shopt -s extglob
docker tag << parameters.image_name >>:<< parameters.tag >> ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/<< parameters.repo >>:git-branch-${CIRCLE_BRANCH//+([^A-Za-z0-9-.])/-}
docker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/<< parameters.repo >>:git-branch-${CIRCLE_BRANCH//+([^A-Za-z0-9-.])/-}
# README: We are going to replace any unwanted characters with dashes then truncate
# the tag name to 100 characters. Docker tags can be a maximum of 128 characters
# and this leaves some room for a prefix.
docker_tag_from_branch_name=${CIRCLE_BRANCH//+([^A-Za-z0-9-.])/-}
docker_tag_shortened_name=${docker_tag_from_branch_name:0:100}
docker tag << parameters.image_name >>:<< parameters.tag >> ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/<< parameters.repo >>:git-branch-${docker_tag_shortened_name}
docker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/<< parameters.repo >>:git-branch-${docker_tag_shortened_name}
- run:
name: 'Record ECR Image Digest'
command: |
Expand Down
27 changes: 18 additions & 9 deletions cypress/integration/office/qaecsr/qaeFlows.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,14 @@ describe('Quality Evaluation Report', () => {
selectViolation('Counseling', '1.2.5.3 Scheduling');
selectViolation('ShipmentSchedule', '1.2.6.7 Pickup');
selectViolation('LossDamage', '1.2.7.2.2 Claims Settlement');
selectViolation('ShipmentSchedule', '1.2.6.15 Delivery');

// Fill out date fields for violations with KPIs
cy.get('input[name="observedClaimsResponseDate"]').clear().type('03 Oct 2022').blur(); // Observed claims response date
cy.get('input[name="observedPickupDate"]').clear().type('04 Oct 2022').blur(); // Observed pickup date
cy.get('input[name="observedPickupSpreadStartDate"]').clear().type('05 Oct 2022').blur(); // Observed pickup spread start date
cy.get('input[name="observedPickupSpreadEndDate"]').clear().type('05 Oct 2022').blur(); // Observed pickup spread end date
cy.get('input[name="observedDeliveryDate"]').clear().type('05 Oct 2022').blur(); // Observed delivery date
cy.get('input[name="observedPickupSpreadStartDate"]').clear().type('06 Oct 2022').blur(); // Observed pickup spread start date
cy.get('input[name="observedPickupSpreadEndDate"]').clear().type('07 Oct 2022').blur(); // Observed pickup spread end date

// Serious violations
cy.get('[data-testid="radio"] [for="yes"]').click();
Expand All @@ -313,14 +315,21 @@ describe('Quality Evaluation Report', () => {
cy.get('h3').contains('Violations');
cy.get('h3').contains('QAE remarks');

// Verify preview has correct sections/headers
// Verify preview has correct sections/headers/content
cy.get('@report').within(() => {
cy.get('td').contains('01 Oct 2022');
cy.get('dd').contains('Physical');
cy.get('dd').contains('Other');
cy.get('dd').contains('This is a test other location text');
cy.get('dd').contains('1 hr 15 min');
cy.get('dd').contains('This is a test evaluation report');
cy.contains('td', '01 Oct 2022');
cy.contains('dd', 'Physical');
cy.contains('dd', 'Other');
cy.contains('dd', 'This is a test other location text');
cy.contains('dd', '1 hr 15 min');
cy.contains('dd', 'This is a test evaluation report');

// kpi dates
cy.contains('dd', '03 Oct 2022');
cy.contains('dd', '04 Oct 2022');
cy.contains('dd', '05 Oct 2022');
cy.contains('dd', '06 Oct 2022');
cy.contains('dd', '07 Oct 2022');
});

// Submit report
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/XSAM/otelsql v0.17.0
github.com/alexedwards/scs/redisstore v0.0.0-20220216073957-c252878bcf5a
github.com/alexedwards/scs/v2 v2.5.0
github.com/aws/aws-sdk-go v1.44.124
github.com/aws/aws-sdk-go v1.44.128
github.com/benbjohnson/clock v1.3.0
github.com/codegangsta/gin v0.0.0-20171026143024-cafe2ce98974
github.com/disintegration/imaging v1.6.2
Expand All @@ -31,7 +31,7 @@ require (
github.com/gobuffalo/pop/v6 v6.0.6
github.com/gobuffalo/validate/v3 v3.3.3
github.com/gocarina/gocsv v0.0.0-20190927101021-3ecffd272576
github.com/gofrs/uuid v4.3.0+incompatible
github.com/gofrs/uuid v4.3.1+incompatible
github.com/golang-jwt/jwt/v4 v4.4.2
github.com/gomodule/redigo v1.8.9
github.com/google/go-github/v31 v31.0.0
Expand Down Expand Up @@ -61,7 +61,7 @@ require (
github.com/tealeg/xlsx/v3 v3.2.4
github.com/tiaguinho/gosoap v1.4.4
github.com/trussworks/otelhttp v0.0.0-20220801182039-09272611890b
github.com/vektra/mockery/v2 v2.14.0
github.com/vektra/mockery/v2 v2.14.1
go.mozilla.org/pkcs7 v0.0.0-20181213175627-3cffc6fbfe83
go.opentelemetry.io/contrib/detectors/aws/ecs v1.11.1
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.36.4
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:W
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ=
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/atomicgo/cursor v0.0.1/go.mod h1:cBON2QmmrysudxNBFthvMtN32r3jxVRIvzkUiF/RuIk=
github.com/aws/aws-sdk-go v1.44.124 h1:Xe1WQRUUekZf6ZFm3SD0vplB/AP/hymVqMiRS9LQRIs=
github.com/aws/aws-sdk-go v1.44.124/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/aws/aws-sdk-go v1.44.128 h1:X34pX5t0LIZXjBY11yf9JKMP3c1aZgirh+5PjtaZyJ4=
github.com/aws/aws-sdk-go v1.44.128/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
Expand Down Expand Up @@ -284,8 +284,8 @@ github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5x
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v4.1.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc=
github.com/gofrs/uuid v4.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v4.3.1+incompatible h1:0/KbAdpx3UXAx1kEOWHJeOkpbgRFGHVgv+CFIY7dBJI=
github.com/gofrs/uuid v4.3.1+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs=
github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
Expand Down Expand Up @@ -699,8 +699,8 @@ github.com/trussworks/otelhttp v0.0.0-20220801182039-09272611890b h1:GfWBTYwftTB
github.com/trussworks/otelhttp v0.0.0-20220801182039-09272611890b/go.mod h1:tYMe+82scvKImZgix8ICds9ULHKR8nt4A1QV4WbFaw4=
github.com/urfave/cli v1.21.0 h1:wYSSj06510qPIzGSua9ZqsncMmWE3Zr55KBERygyrxE=
github.com/urfave/cli v1.21.0/go.mod h1:lxDj6qX9Q6lWQxIrbrT0nwecwUtRnhVZAJjJZrVUZZQ=
github.com/vektra/mockery/v2 v2.14.0 h1:KZ1p5Hrn8tiY+LErRMr14HHle6khxo+JKOXLBW/yfqs=
github.com/vektra/mockery/v2 v2.14.0/go.mod h1:bnD1T8tExSgPD1ripLkDbr60JA9VtQeu12P3wgLZd7M=
github.com/vektra/mockery/v2 v2.14.1 h1:Xamr4zUkFBDGdZhJ6iCiJ1AwkGRmUgZd8zkwjRXt+TU=
github.com/vektra/mockery/v2 v2.14.1/go.mod h1:bnD1T8tExSgPD1ripLkDbr60JA9VtQeu12P3wgLZd7M=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
Expand Down
1 change: 1 addition & 0 deletions migrations/app/migrations_manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -765,4 +765,5 @@
20221020162508_rename_pro_gear_weight_document_columns.up.sql
20221020202612_create-and-modify-move-history-triggers-for-multiple-tables.up.sql
20221021145115_ppm_closeout_status.up.sql
20221028220508_remove_deleted_at_column_from_evaluation_reports.up.sql
20221031150502_ppm_closeout_status_remove_needs_close_out.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE evaluation_reports DROP COLUMN IF EXISTS deleted_at;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"react-router-dom": "^5.3.3",
"react-router-last-location": "^2.0.1",
"react-router-tabs": "^1.1.1",
"react-select": "^5.5.7",
"react-select": "^5.5.9",
"react-table": "^7.8.0",
"react-table-6": "^6.11.0",
"react-tabs": "^4.2.1",
Expand Down Expand Up @@ -156,7 +156,7 @@
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-security": "^1.5.0",
"eslint-plugin-storybook": "0.6.6",
"eslint-plugin-storybook": "0.6.7",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0",
"happo-plugin-storybook": "^3.0.0",
"happo.io": "^8.2.0",
Expand Down
4 changes: 2 additions & 2 deletions pkg/dates/calculators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (suite *DatesSuite) TestCreateFutureMoveDates() {
},
}
for _, testCase := range cases {
suite.T().Run(testCase.name, func(t *testing.T) {
suite.Run(testCase.name, func() {
dates := CreateFutureMoveDates(moveDate, numDays, testCase.includeWeekendsAndHolidays, usCalendar)
suite.Equal(testCase.dates, dates, "%v: Future dates did not match, expected %v, got %v", testCase.name, testCase.dates, dates)
})
Expand Down Expand Up @@ -90,7 +90,7 @@ func (suite *DatesSuite) TestCreatePastMoveDates() {
},
}
for _, testCase := range cases {
suite.T().Run(testCase.name, func(t *testing.T) {
suite.Run(testCase.name, func() {
dates := CreatePastMoveDates(moveDate, numDays, testCase.includeWeekendsAndHolidays, usCalendar)
suite.Equal(testCase.dates, dates, "%v: Past dates did not match, expected %v, got %v", testCase.name, testCase.dates, dates)
})
Expand Down
8 changes: 6 additions & 2 deletions pkg/db/dberr/dberr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ import (
)

type DBErrSuite struct {
testingsuite.BaseTestSuite
*testingsuite.PopTestSuite
}

func TestDBFmtSuite(t *testing.T) {
suite.Run(t, new(DBErrSuite))
ts := &DBErrSuite{
PopTestSuite: testingsuite.NewPopTestSuite(testingsuite.CurrentPackage(), testingsuite.WithPerTestTransaction()),
}
suite.Run(t, ts)
ts.PopTestSuite.TearDown()
}
15 changes: 7 additions & 8 deletions pkg/db/dberr/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dberr

import (
"errors"
"testing"

"github.com/jackc/pgerrcode"
"github.com/lib/pq"
Expand All @@ -14,16 +13,16 @@ func (suite *DBErrSuite) TestIsDBError() {
Code: pq.ErrorCode(errCode),
}

suite.T().Run("db error and code match", func(t *testing.T) {
suite.Run("db error and code match", func() {
suite.True(IsDBError(&dbErr, errCode))
})

suite.T().Run("not a db error", func(t *testing.T) {
suite.Run("not a db error", func() {
err := errors.New("some random error")
suite.False(IsDBError(err, errCode))
})

suite.T().Run("not the right db error code", func(t *testing.T) {
suite.Run("not the right db error code", func() {
suite.False(IsDBError(&dbErr, pgerrcode.UniqueViolation))
})
}
Expand All @@ -36,20 +35,20 @@ func (suite *DBErrSuite) TestIsDBErrorForConstraint() {
Constraint: constraintName,
}

suite.T().Run("db error, code, and constraint match", func(t *testing.T) {
suite.Run("db error, code, and constraint match", func() {
suite.True(IsDBErrorForConstraint(&dbErr, errCode, constraintName))
})

suite.T().Run("not a db error", func(t *testing.T) {
suite.Run("not a db error", func() {
err := errors.New("some random error")
suite.False(IsDBErrorForConstraint(err, errCode, constraintName))
})

suite.T().Run("not the right db error code", func(t *testing.T) {
suite.Run("not the right db error code", func() {
suite.False(IsDBErrorForConstraint(&dbErr, pgerrcode.InternalError, constraintName))
})

suite.T().Run("not the right constraint name", func(t *testing.T) {
suite.Run("not the right constraint name", func() {
suite.False(IsDBErrorForConstraint(&dbErr, errCode, "bogus"))
})
}
12 changes: 6 additions & 6 deletions pkg/gen/ghcapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pkg/models/evaluation_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ type EvaluationReport struct {
ObservedPickupSpreadEndDate *time.Time `json:"observed_pickup_spread_end_date" db:"observed_pickup_spread_end_date"`
ObservedDeliveryDate *time.Time `json:"observed_delivery_date" db:"observed_delivery_date"`
SubmittedAt *time.Time `json:"submitted_at" db:"submitted_at"`
DeletedAt *time.Time `db:"deleted_at"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
ReportViolations ReportViolations `json:"report_violation,omitempty" fk_id:"report_id" has_many:"report_violation"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func (suite *EvaluationReportSuite) TestEvaluationReportCreator() {
suite.NotNil(createdEvaluationReport.ShipmentID)
suite.NotNil(createdEvaluationReport.CreatedAt)
suite.NotNil(createdEvaluationReport.UpdatedAt)
suite.Nil(createdEvaluationReport.DeletedAt)
suite.Nil(createdEvaluationReport.SubmittedAt)
})

Expand Down
23 changes: 14 additions & 9 deletions pkg/services/evaluation_report/evaluation_report_deleter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (

"github.com/transcom/mymove/pkg/appcontext"
"github.com/transcom/mymove/pkg/apperror"
"github.com/transcom/mymove/pkg/db/utilities"
"github.com/transcom/mymove/pkg/models"
"github.com/transcom/mymove/pkg/services"
)
Expand All @@ -22,7 +21,7 @@ func NewEvaluationReportDeleter() services.EvaluationReportDeleter {

func (o evaluationReportDeleter) DeleteEvaluationReport(appCtx appcontext.AppContext, reportID uuid.UUID) error {
var report models.EvaluationReport
err := appCtx.DB().Scope(utilities.ExcludeDeletedScope()).Find(&report, reportID)
err := appCtx.DB().Find(&report, reportID)
if err != nil {
switch err {
case sql.ErrNoRows:
Expand All @@ -41,14 +40,20 @@ func (o evaluationReportDeleter) DeleteEvaluationReport(appCtx appcontext.AppCon
}

transactionError := appCtx.NewTransaction(func(txnAppCtx appcontext.AppContext) error {
err := utilities.SoftDestroy(appCtx.DB(), &report)
// Delete existing report_violations for this report
existingReportViolations := models.ReportViolations{}
err := appCtx.DB().Where("report_id in (?)", reportID).All(&existingReportViolations)
if err != nil {
switch err.Error() {
case "error updating model":
return apperror.NewUnprocessableEntityError("while updating model")
default:
return apperror.NewInternalServerError("failed attempt to soft delete model")
}
return apperror.NewQueryError("EvaluationReport", err, "Unable to find existing report violations to remove")
}
err = appCtx.DB().Destroy(&existingReportViolations)
if err != nil {
return apperror.NewQueryError("EvaluationReport", err, "failed to delete existing report violations")
}

err = appCtx.DB().Destroy(&report)
if err != nil {
return apperror.NewQueryError("EvaluationReport", err, "failed to delete report")
}
return nil
})
Expand Down
Loading

0 comments on commit 6ff68c9

Please sign in to comment.