Split out ComplianceDistrict view for creating new compliance reports
The idea here is that we'll make compliance reports two different ways, The first is if the user navigates to /district/:slug/compliance, the second if they open a QR code from a mailer. In both cases we create the report then feed them into a flow for updating the data on that report.
This commit is contained in:
parent
8eae73eefb
commit
f927b0a911
7 changed files with 154 additions and 241 deletions
|
|
@ -265,11 +265,13 @@ func publicReportCreate(ctx context.Context, setter_report models.PublicreportRe
|
|||
}
|
||||
defer txn.Rollback(ctx)
|
||||
|
||||
public_id, err := GenerateReportID()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("create public ID: %w", err)
|
||||
if setter_report.PublicID.IsUnset() {
|
||||
public_id, err := GenerateReportID()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("create public ID: %w", err)
|
||||
}
|
||||
setter_report.PublicID = omit.From(public_id)
|
||||
}
|
||||
setter_report.PublicID = omit.From(public_id)
|
||||
|
||||
var addr *models.Address
|
||||
if address != nil && address.GID != "" {
|
||||
|
|
@ -305,7 +307,7 @@ func publicReportCreate(ctx context.Context, setter_report models.PublicreportRe
|
|||
publicReportUpdateLocation(ctx, txn, result.ID, l)
|
||||
}
|
||||
}
|
||||
log.Info().Str("public_id", public_id).Int32("id", result.ID).Msg("Created base report")
|
||||
log.Info().Str("public_id", setter_report.PublicID.GetOr("")).Int32("id", result.ID).Msg("Created base report")
|
||||
|
||||
if len(saved_images) > 0 {
|
||||
setters := make([]*models.PublicreportReportImageSetter, 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue