Skip to content

Commit

Permalink
fix: archived flags without metrics do not count towards onboarding (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus authored Oct 14, 2024
1 parent 735e6f0 commit 39fb1b5
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/lib/features/onboarding/onboarding-read-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,6 @@ export class OnboardingReadModel implements IOnboardingReadModel {
return null;
}

const feature = await this.db('features')
.select('name')
.where('project', projectId)
.first();

if (!feature) {
return { status: 'onboarding-started' };
}

const db = this.db;
const lastSeen = await db
.select(db.raw('1'))
Expand All @@ -117,8 +108,17 @@ export class OnboardingReadModel implements IOnboardingReadModel {

if (lastSeen) {
return { status: 'onboarded' };
} else {
return { status: 'first-flag-created', feature: feature.name };
}

const feature = await this.db('features')
.select('name')
.where('project', projectId)
.where('archived_at', null)
.first();

if (!feature) {
return { status: 'onboarding-started' };
}
return { status: 'first-flag-created', feature: feature.name };
}
}

0 comments on commit 39fb1b5

Please sign in to comment.