Skip to content

Commit 13c83c2

Browse files
committed
fixed some calcs on the targeting page.
1 parent 758cd23 commit 13c83c2

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

backend/src/__tests__/__mock__/seats-gen/mockSeatsGenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ import { randomInt } from 'crypto';
6969

7070

7171

72-
if ( Math.random() < (0.05 + Math.random() * .15 )) {
72+
if ( Math.random() < (0.08 + Math.random() * .15 )) {
7373
seat.last_activity_editor = this.getRandomEditor();
7474

7575
console.log('last_activity_at \n', seat.last_activity_at);

backend/src/__tests__/services/calendarClockServiceTests.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ const metricsMockConfig: MockConfig = {
4141
trend: 'grow'
4242
},
4343
code_suggestions: {
44-
baseValue: 1000,
45-
range: { min: 150, max: 1200 },
44+
baseValue: 700,
45+
range: { min: 150, max: 1000 },
4646
trend: 'grow'
4747
},
4848
code_acceptances: {
@@ -56,8 +56,8 @@ const metricsMockConfig: MockConfig = {
5656
trend: 'stable'
5757
},
5858
code_lines_accepted: {
59-
baseValue: 900,
60-
range: { min: 750, max: 955 },
59+
baseValue: 1200,
60+
range: { min: 750, max: 1955 },
6161
trend: 'stable'
6262
},
6363
chats: {
@@ -81,8 +81,8 @@ const metricsMockConfig: MockConfig = {
8181
trend: 'grow'
8282
},
8383
total_code_reviews: {
84-
baseValue: 100,
85-
range: { min: 50, max: 100 },
84+
baseValue: 50,
85+
range: { min: 25, max: 100 },
8686
trend: 'grow'
8787
},
8888
total_code_review_comments: {

frontend/src/app/main/copilot/value-modeling/value-modeling.component.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,23 +389,23 @@ export class ValueModelingComponent implements OnInit, AfterViewInit {
389389
this.gridObject.max.percentMaxAdopted = this.calculatePercentage(this.gridObject.max.adoptedDevs as number, this.gridObject.max.seats as number);
390390
this.gridObject.max.annualTimeSavingsDollars = this.calculateAnnualTimeSavingsDollars(this.gridObject.max.weeklyTimeSaved as number, this.gridObject.max.adoptedDevs as number);
391391
this.gridObject.max.monthlyTimeSavings = this.calculateMonthlyTimeSavings(this.gridObject.max.adoptedDevs as number, this.gridObject.max.weeklyTimeSaved as number);
392-
this.gridObject.max.productivityBoost = this.calculateProductivityBoost(this.gridObject.max.dailySuggestions as number, this.gridObject.max.dailyChatTurns as number);
392+
this.gridObject.max.productivityBoost = this.calculateProductivityBoost(this.gridObject.max.weeklyTimeSaved as number, this.gridObject.max.seats as number, this.gridObject.max.adoptedDevs as number);
393393

394394
// 2. Calculate Current column percentages and then Impacts
395395
this.gridObject.current.percentSeatsAdopted = this.calculatePercentage(this.gridObject.current.adoptedDevs as number, this.gridObject.current.seats as number);
396396
this.gridObject.current.percentSeatsReportingTimeSavings = this.calculatePercentage(this.gridObject.current.monthlyDevsReportingTimeSavings as number, this.gridObject.current.seats as number);
397397
this.gridObject.current.percentMaxAdopted = this.calculatePercentage(this.gridObject.current.adoptedDevs as number, this.gridObject.max.seats as number);
398398
this.gridObject.current.annualTimeSavingsDollars = this.calculateAnnualTimeSavingsDollars(this.gridObject.current.weeklyTimeSaved as number, this.gridObject.current.adoptedDevs as number);
399399
this.gridObject.current.monthlyTimeSavings = this.calculateMonthlyTimeSavings(this.gridObject.current.adoptedDevs as number, this.gridObject.current.weeklyTimeSaved as number);
400-
this.gridObject.current.productivityBoost = this.calculateProductivityBoost(this.gridObject.current.dailySuggestions as number, this.gridObject.current.dailyChatTurns as number);
400+
this.gridObject.current.productivityBoost = this.calculateProductivityBoost(this.gridObject.current.weeklyTimeSaved as number, this.gridObject.current.seats as number, this.gridObject.current.adoptedDevs as number);
401401

402402
// 3. Calculate Target column values (percentages and then impacts)
403403
this.gridObject.target.percentSeatsAdopted = this.calculatePercentage(this.gridObject.target.adoptedDevs as number, this.gridObject.target.seats as number);
404404
this.gridObject.target.percentSeatsReportingTimeSavings = this.calculatePercentage(this.gridObject.target.monthlyDevsReportingTimeSavings as number, this.gridObject.target.seats as number);
405405
this.gridObject.target.percentMaxAdopted = this.calculatePercentage(this.gridObject.target.adoptedDevs as number, this.gridObject.target.seats as number);
406406
this.gridObject.target.annualTimeSavingsDollars = this.calculateAnnualTimeSavingsDollars(this.gridObject.target.weeklyTimeSaved as number, this.gridObject.target.adoptedDevs as number);
407407
this.gridObject.target.monthlyTimeSavings = this.calculateMonthlyTimeSavings(this.gridObject.target.adoptedDevs as number, this.gridObject.target.weeklyTimeSaved as number);
408-
this.gridObject.target.productivityBoost = this.calculateProductivityBoost(this.gridObject.target.dailySuggestions as number, this.gridObject.target.dailyChatTurns as number);
408+
this.gridObject.target.productivityBoost = this.calculateProductivityBoost(this.gridObject.target.weeklyTimeSaved as number, this.gridObject.target.seats as number, this.gridObject.target.adoptedDevs as number);
409409

410410
// 4. Update the form values
411411
console.log('4. modelCalc: Updated gridObject:', this.gridObject);
@@ -425,17 +425,22 @@ export class ValueModelingComponent implements OnInit, AfterViewInit {
425425
}
426426

427427
private calculateAnnualTimeSavingsDollars(weeklyTimeSaved: number, adoptedDevs: number): number {
428-
const weeksInYear = 50; // TO DO: needs to come from settings
429-
const hourlyRate = 50; // TO DO: needs to come from settings
428+
const weeksInYear = 50;
429+
const hoursPerWeek = this.hoursPerYear / weeksInYear;
430+
const hourlyRate = this.devCostPerYear / this.hoursPerYear;
430431
return weeklyTimeSaved * weeksInYear * hourlyRate * adoptedDevs;
431432
}
432433

433-
private calculateProductivityBoost(dailySuggestions: number, dailyChatTurns: number): number {
434-
return dailySuggestions + dailyChatTurns; // Example calculation
435-
}
434+
private calculateProductivityBoost(weeklyTimeSaved: number, adoptedDevs: number, maxDevs: number): number {
435+
436+
return weeklyTimeSaved * adoptedDevs * 50 / (this.hoursPerYear * maxDevs || 1);
437+
}
436438

437439
private calculateMonthlyTimeSavings(adoptedDevs: number, weeklyTimeSaved: number): number {
438-
return adoptedDevs * weeklyTimeSaved * 4;
440+
const weeksInYear = 50;
441+
const weeksInMonth = 4;
442+
const hoursPerWeek = this.hoursPerYear / weeksInYear;
443+
return weeklyTimeSaved * weeksInMonth * adoptedDevs;
439444
}
440445

441446
toggleInputs(disable: boolean) {

0 commit comments

Comments
 (0)