fix(demo): advance seeded candidates past onboarding and show the express summary in Russian
This commit is contained in:
1 parent
41206abbcf
commit
945ab6d6a9
9 files changed
+296
-10
No files matched your search
@@ -234,6 +234,9 @@ func ExecuteSeed(ctx context.Context, seeder Seeder, input seedusecase.Input, ou
|
||||
for _, item := range report.Created {
|
||||
fmt.Fprintf(&text, "created: %s\n", item)
|
||||
}
|
||||
for _, item := range report.Updated {
|
||||
fmt.Fprintf(&text, "updated: %s\n", item)
|
||||
}
|
||||
for _, login := range report.Logins {
|
||||
fmt.Fprintf(&text, "login: %s (%s)\n", login.Email, login.Role)
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5"
|
||||
@@ -204,6 +205,33 @@ func insertTrainingBinding(ctx context.Context, tx pgx.Tx, binding outbound.Demo
|
||||
return nil
|
||||
}
|
||||
|
||||
// AdvanceCandidateOnboarding moves a verified candidate with a saved
|
||||
// questionnaire from an earlier candidate step to candidate_assessment. The
|
||||
// statement is the questionnaire transition of the product repository,
|
||||
// widened to the earlier steps, and it touches no later step. It bumps the
|
||||
// account version as the product transitions do.
|
||||
func (store *DemoSeedStore) AdvanceCandidateOnboarding(ctx context.Context, userID uuid.UUID, at time.Time) (bool, error) {
|
||||
const location = "DemoSeedStore.AdvanceCandidateOnboarding"
|
||||
result, err := store.pool.Exec(ctx, `
|
||||
UPDATE users
|
||||
SET
|
||||
onboarding_step = 'candidate_assessment',
|
||||
version = users.version + 1,
|
||||
updated_at = GREATEST(users.updated_at, $2::timestamptz)
|
||||
WHERE users.id = $1
|
||||
AND users.scenario = 'candidate'
|
||||
AND users.email_verified_at IS NOT NULL
|
||||
AND users.onboarding_step IN ('candidate_consents', 'candidate_profile', 'candidate_questionnaire')
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM candidate_questionnaires AS questionnaire
|
||||
WHERE questionnaire.user_id = users.id
|
||||
)`, userID, at)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("%s - advance onboarding: %w", location, sanitizeConnectError(err))
|
||||
}
|
||||
return result.RowsAffected() == 1, nil
|
||||
}
|
||||
|
||||
// Inventory counts the records of synthetic accounts and of the seed's bank
|
||||
// categories in one read-only statement.
|
||||
func (store *DemoSeedStore) Inventory(
|
||||
|
||||
Reference in new issue
Block a user