Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update survey titles and labels for clarity: reflect focus on Copilot impact and time savings #73

Merged
merged 18 commits into from
Dec 6, 2024
Merged
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8dac4c6
Update survey titles and labels for clarity: reflect focus on Copilot…
MattG57 Nov 30, 2024
06fbc6e
added scrolling reasons from colleagues
MattG57 Nov 30, 2024
71497fd
Tweaks
MattG57 Nov 30, 2024
9fbfe6b
Merge branch 'main' into Nomenclature-for-Developer-Estimates-plus-Fo…
austenstone Dec 3, 2024
2e8b1c9
Add recent surveys retrieval with good reasons and kudos feature
MattG57 Dec 3, 2024
3085220
Add GitHub survey update functionality and new survey route
austenstone Dec 3, 2024
04408a3
Add kudos field to Survey model
austenstone Dec 3, 2024
8dc6e25
Refactor backend entry point, update Docker and compose configuration…
MattG57 Dec 3, 2024
1611030
Merge branch 'Nomenclature-for-Developer-Estimates-plus-Form-behavior…
MattG57 Dec 3, 2024
3d5a946
Implement member retrieval by login, enhance recent surveys query, an…
MattG57 Dec 4, 2024
5cbd8cd
Refactor chart labels and settings form, implement thousand separator…
MattG57 Dec 4, 2024
e8a2522
Remove VSCode settings, update logging level in database configuratio…
austenstone Dec 5, 2024
dfdc06e
Add Value Modeling component, update & routing change
MattG57 Dec 5, 2024
338b2f5
Refactor survey component headers, update layout styles, and enhance …
austenstone Dec 6, 2024
4b6d442
Merge branch 'Nomenclature-for-Developer-Estimates-plus-Form-behavior…
austenstone Dec 6, 2024
50fc071
Remove ThousandSeparatorPipe and SharedModule; update settings compon…
austenstone Dec 6, 2024
4e4b5d3
Fix type assertion in survey controller and service for improved type…
austenstone Dec 6, 2024
00e92ca
Refactor type assertions in survey controller and service to use Wher…
austenstone Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 61 additions & 64 deletions backend/src/models/survey.model.ts
Original file line number Diff line number Diff line change
@@ -29,71 +29,68 @@ class Survey extends Model<SurveyType> {
declare percentTimeSaved: number;
declare timeUsedFor: string;
declare reason: string;
declare createdAt: CreationOptional<Date>;
declare updatedAt: CreationOptional<Date>;
declare kudos?: number; // Add kudos property
declare createdAt?: Date;
declare updatedAt?: Date;
}

Survey.init({
id: {
type: DataTypes.INTEGER,
autoIncrement: true,
primaryKey: true,
},
status: {
type: DataTypes.STRING,
allowNull: true,
},
hits: {
type: DataTypes.INTEGER,
allowNull: true,
},
userId: {
type: DataTypes.STRING,
allowNull: true,
},
usedCopilot: {
type: DataTypes.BOOLEAN,
allowNull: false,
},
percentTimeSaved: {
type: DataTypes.INTEGER,
allowNull: false,
set(value: number) {
this.setDataValue('percentTimeSaved', !this.usedCopilot ? 0 : value);
}
},
reason: {
type: DataTypes.STRING(4096),
allowNull: true,
},
timeUsedFor: {
type: DataTypes.STRING,
allowNull: false,
},
owner: {
type: DataTypes.STRING,
allowNull: false,
},
repo: {
type: DataTypes.STRING,
allowNull: false,
},
prNumber: {
type: DataTypes.INTEGER,
allowNull: true,
},
kudos: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 0,
},
createdAt: DataTypes.DATE,
updatedAt: DataTypes.DATE
}, {
sequelize,
modelName: 'Survey',
timestamps: true,
});
static initModel(sequelize: Sequelize) {
Survey.init({
id: {
type: DataTypes.INTEGER,
autoIncrement: true,
primaryKey: true,
},
status: {
type: DataTypes.STRING,
allowNull: true,
},
hits: {
type: DataTypes.INTEGER,
allowNull: true,
},
userId: {
type: DataTypes.STRING,
allowNull: true,
},
usedCopilot: {
type: DataTypes.BOOLEAN,
allowNull: false,
},
percentTimeSaved: {
type: DataTypes.INTEGER,
allowNull: false,
set(value: number) {
this.setDataValue('percentTimeSaved', !this.usedCopilot ? 0 : value);
}
},
reason: {
type: DataTypes.STRING(4096),
allowNull: true,
},
timeUsedFor: {
type: DataTypes.STRING,
allowNull: false,
},
org: {
type: DataTypes.STRING,
allowNull: false,
},
repo: {
type: DataTypes.STRING,
allowNull: false,
},
prNumber: {
type: DataTypes.INTEGER,
allowNull: true,
},
createdAt: DataTypes.DATE,
updatedAt: DataTypes.DATE
}, {
sequelize,
modelName: 'Survey',
timestamps: true,
});
}
}

export { Survey, SurveyType };
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, forwardRef, OnInit } from '@angular/core';
import { AppModule } from '../../../../app.module';
import { FormBuilder, FormControl, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms';
import { CopilotSurveyService, Survey } from '../../../../services/copilot-survey.service';
import { CopilotSurveyService, Survey } from '../../../../services/api/copilot-survey.service';
import { ActivatedRoute, Params } from '@angular/router';

@Component({
27 changes: 17 additions & 10 deletions frontend/src/app/main/main.component.html
Original file line number Diff line number Diff line change
@@ -47,17 +47,24 @@
</mat-sidenav>
<mat-sidenav-content>
<mat-toolbar color="primary">
<ng-container *ngIf="isHandset$ | async">
<button type="button" aria-label="Toggle sidenav" mat-icon-button (click)="drawer.toggle()">
<mat-icon aria-label="Side nav toggle icon">menu</mat-icon>
</button>
</ng-container>
<ng-container *ngIf="installation.owner as owner">
<div class="header">
<div class="mat-card-avatar" mat-card-avatar style="background-size: cover;" [style.background-image]="'url(' + owner.avatar_url + ')'"></div>
<h1>{{owner.login}}</h1>
@if (isHandset$ | async) {
<button type="button" aria-label="Toggle sidenav" mat-icon-button (click)="drawer.toggle()">
<mat-icon aria-label="Side nav toggle icon">menu</mat-icon>
</button>
}
<div class="header">
<div *ngIf="installationsService.currentInstallation.asObservable() | async as installation" class="mat-card-avatar" mat-card-avatar style="background-size: cover;"
[style.background-image]="'url(' + installation?.account?.avatar_url + ')'">
</div>
</ng-container>
<h1>
<mat-select [ngModel]="(installationsService.currentInstallation.asObservable() | async)?.id || 1" (ngModelChange)="installationsService.setInstallation($event)">
<mat-option [value]="1">Enterprise</mat-option>
@for (installation of installationsService.getInstallations() | async; track installation.id) {
<mat-option [value]="installation.id">{{ installation.account?.login }}</mat-option>
}
</mat-select>
</h1>
</div>
<span class="spacer"></span>
</mat-toolbar>
<div class="sidenav-content">
17 changes: 9 additions & 8 deletions frontend/src/app/services/api/copilot-survey.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { HttpClient, HttpParams } from '@angular/common/http';

Check failure

Code scanning / ESLint

Disallow unused variables Error

'HttpParams' is defined but never used.

Copilot Autofix AI 3 months ago

To fix the problem, we need to remove the unused HttpParams import from the file frontend/src/app/services/api/copilot-survey.service.ts. This will resolve the ESLint error and clean up the code by eliminating unnecessary imports.

  • Locate the import statement on line 1.
  • Remove HttpParams from the import statement.
Suggested changeset 1
frontend/src/app/services/api/copilot-survey.service.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/frontend/src/app/services/api/copilot-survey.service.ts b/frontend/src/app/services/api/copilot-survey.service.ts
--- a/frontend/src/app/services/api/copilot-survey.service.ts
+++ b/frontend/src/app/services/api/copilot-survey.service.ts
@@ -1,2 +1,2 @@
-import { HttpClient, HttpParams } from '@angular/common/http';
+import { HttpClient } from '@angular/common/http';
 import { Injectable } from '@angular/core';
EOF
@@ -1,2 +1,2 @@
import { HttpClient, HttpParams } from '@angular/common/http';
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
Copilot is powered by AI and may make mistakes. Always verify output.

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

import { Injectable } from '@angular/core';
import { serverUrl } from './server.service';
import { Observable } from 'rxjs';
import { serverUrl } from '../server.service';

export interface Survey {
id?: number;
@@ -28,28 +27,30 @@ export class CopilotSurveyService {

constructor(private http: HttpClient) { }

createSurvey(survey: Survey): Observable<Survey> {
createSurvey(survey: Survey) {
return this.http.post<Survey>(this.apiUrl, survey);
}

getAllSurveys(): Observable<Survey[]> {
return this.http.get<Survey[]>(this.apiUrl);
getAllSurveys(org?: string) {
return this.http.get<Survey[]>(this.apiUrl, {
params: org ? { org } : undefined
});
}

getRecentSurveysWithGoodReasons(minReasonLength: number = 20): Observable<Survey[]> {
getRecentSurveysWithGoodReasons(minReasonLength: number = 20){
//const params = new HttpParams().set('minReasonLength', minReasonLength.toString());
return this.http.get<Survey[]>(`${this.apiUrl}/recent-good-reasons/${minReasonLength}`);
}

getSurveyById(id: number): Observable<Survey> {
getSurveyById(id: number) {
return this.http.get<Survey>(`${this.apiUrl}/${id}`);
}

deleteSurvey(id: number) {
return this.http.delete(`${this.apiUrl}/${id}`);
}

updateSurvey(survey: Survey): Observable<Survey> {
updateSurvey(survey: Survey) {
return this.http.put<Survey>(`${this.apiUrl}/${survey.id}`, survey);
}
}