Skip to content

Commit

Permalink
Add whether squash merge is invoked
Browse files Browse the repository at this point in the history
  • Loading branch information
tidy-dev committed Jun 8, 2021
1 parent 7ccd6ac commit 9ada3db
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/src/lib/stats/stats-database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,9 @@ export interface IDailyMeasures {

/** The number of times a successful squash merge occurs */
readonly squashMergeSuccessfulCount: number

/** The number of times a squash merge is initiated */
readonly squashMergeInvokedCount: number
}

export class StatsDatabase extends Dexie {
Expand Down
7 changes: 7 additions & 0 deletions app/src/lib/stats/stats-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ const DefaultDailyMeasures: IDailyMeasures = {
squashMergeIntoCurrentBranchMenuCount: 0,
squashMergeSuccessfulWithConflictsCount: 0,
squashMergeSuccessfulCount: 0,
squashMergeInvokedCount: 0,
}

interface IOnboardingStats {
Expand Down Expand Up @@ -1679,6 +1680,12 @@ export class StatsStore implements IStatsStore {
}))
}

public recordSquashMergeInvokedCount(): Promise<void> {
return this.updateDailyMeasures(m => ({
squashMergeInvokedCount: m.squashMergeInvokedCount + 1,
}))
}

/** Post some data to our stats endpoint. */
private post(body: object): Promise<Response> {
const options: RequestInit = {
Expand Down
4 changes: 4 additions & 0 deletions app/src/lib/stores/app-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4474,6 +4474,10 @@ export class AppStore extends TypedBaseStore<IAppState> {
): Promise<void> {
const gitStore = this.gitStoreCache.get(repository)

if (isSquash) {
this.statsStore.recordSquashMergeInvokedCount()
}

if (mergeStatus !== null) {
if (mergeStatus.kind === ComputedAction.Clean) {
this.statsStore.recordMergeHintSuccessAndUserProceeded()
Expand Down

0 comments on commit 9ada3db

Please sign in to comment.