Skip to content

Commit

Permalink
Merge pull request #372 from fujaba/fix/remove-telemetry
Browse files Browse the repository at this point in the history
Remove Telemetry
  • Loading branch information
Clashsoft authored Oct 27, 2023
2 parents e06f4d5 + 8898670 commit 90d4eb0
Show file tree
Hide file tree
Showing 31 changed files with 270 additions and 442 deletions.
2 changes: 0 additions & 2 deletions frontend/src/app/assignment/assignment.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {TokenInterceptor} from "./services/token.interceptor";
import {AssignmentService} from "./services/assignment.service";
import {TokenService} from "./services/token.service";
import {SolutionService} from "./services/solution.service";
import {TelemetryService} from "./services/telemetry.service";
import {CourseService} from "./services/course.service";
import {SelectionService} from "./services/selection.service";
import {SolutionContainerService} from "./services/solution-container.service";
Expand Down Expand Up @@ -70,7 +69,6 @@ import {KeycloakBearerInterceptor} from "keycloak-angular";
ConfigService,
AssignmentService,
SolutionService,
TelemetryService,
CourseService,
SelectionService,
SolutionContainerService,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/assignment/model/evaluation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class Evaluation {
author: string;
remark: string;
points: number;
duration?: number;
snippets: Snippet[];

codeSearch?: CodeSearchInfo;
Expand Down
15 changes: 0 additions & 15 deletions frontend/src/app/assignment/model/telemetry.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@
routerLink="/assignments/{{assignment?._id}}/solutions/{{solution._id}}"
queryParamsHandling="merge"
ngbTooltip="View Solution"
(click)="telemetry(solution, 'openSolution')"
></a>
<div
*ngIf="assignment && assignment?.classroom?.org && assignment?.classroom?.prefix && solution.author.github"
Expand All @@ -172,15 +171,13 @@
[href]="assignment|githubLink:solution:true"
target="_blank"
ngbTooltip="View {{solution.commit ? 'Commit' : 'Repository'}} on GitHub"
(click)="telemetry(solution, 'showGithub')"
></a>
</div>
<a
class="btn btn-primary me-1 bi-check-circle"
ngbTooltip="Submit Feedback"
[routerLink]="['submit', solution._id]"
queryParamsHandling="preserve"
(click)="telemetry(solution, 'openFeedback')"
></a>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Solution, {AuthorInfo, authorInfoProperties} from '../../../model/solutio
import {AssignmentService} from '../../../services/assignment.service';
import {SolutionService} from '../../../services/solution.service';
import {TaskService} from '../../../services/task.service';
import {TelemetryService} from '../../../services/telemetry.service';
import {SubmitService} from "../submit.service";
import {UserService} from "../../../../user/user.service";
import {AssigneeService} from "../../../services/assignee.service";
Expand Down Expand Up @@ -56,7 +55,6 @@ export class SolutionTableComponent implements OnInit {
private assigneeService: AssigneeService,
private evaluationService: EvaluationService,
private router: Router,
private telemetryService: TelemetryService,
private activatedRoute: ActivatedRoute,
private toastService: ToastService,
private taskService: TaskService,
Expand Down Expand Up @@ -192,13 +190,6 @@ export class SolutionTableComponent implements OnInit {
return [...valueSet].sort();
}

telemetry(solution: Solution, action: string, timestamp = new Date()) {
this.telemetryService.create(solution.assignment, solution._id!, {
action,
timestamp,
}).subscribe();
}

copyPoints() {
this.clipboardService.copy(this.solutions!.map(s => s.points ?? '').join('\n'));
this.toastService.success('Copy Points', `Copied ${this.solutions.length} rows to clipboard`);
Expand Down Expand Up @@ -235,16 +226,13 @@ export class SolutionTableComponent implements OnInit {
return;
}

const timestamp = new Date();
const result = await Promise.all(this.solutions
.filter(s => this.selected[s._id!] && s.author.github)
.map(async solution => {
const issue = await this.submitService.createIssue(assignment, solution);
await this.submitService.postIssueToGitHub(assignment, solution, issue, userToken);
solution.points = issue._points;

this.telemetry(solution, 'submitFeedback', timestamp);

return solution;
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ <h2>
</div>
<app-statistic-value
[label]="weightedEvaluations ? '∅ per Point' : '∅ per Evaluation'"
[value]="(weightedEvaluations ? stats.time.pointsAvg : stats.time.evaluationAvg) / 1000 | duration"
[value]="(weightedEvaluations ? stats.time.pointsAvg : stats.time.evaluationAvg) | duration"
></app-statistic-value>
<div class="border-end mx-3 align-self-stretch"></div>
<app-statistic-value label="Spent" [value]="stats.time.evaluationTotal / 1000 | duration"></app-statistic-value>
<app-statistic-value label="Spent" [value]="stats.time.evaluationTotal | duration"></app-statistic-value>
<div class="border-end mx-3 align-self-stretch"></div>
<app-statistic-value label="of Total" [value]="(stats.time.evaluationTotal / (stats.time.codeSearchSavings + stats.time.evaluationTotal)) | percent:'0.0'"></app-statistic-value>
</li>
Expand All @@ -97,7 +97,7 @@ <h2>
popoverTitle="Code Search Time Savings Explained"
></i>
</div>
<app-statistic-value label="Saved" [value]="stats.time.codeSearchSavings / 1000 | duration"></app-statistic-value>
<app-statistic-value label="Saved" [value]="stats.time.codeSearchSavings | duration"></app-statistic-value>
<div class="border-end mx-3 align-self-stretch"></div>
<app-statistic-value label="of Total" [value]="(stats.time.codeSearchSavings / (stats.time.codeSearchSavings + stats.time.evaluationTotal)) | percent:'0.0'"></app-statistic-value>
</li>
Expand Down Expand Up @@ -167,7 +167,7 @@ <h2 class="me-auto">
</li>
<li>
The task took
<b>{{ taskStats.timeAvg / 1000 | duration }}</b>
<b>{{ taskStats.timeAvg | duration }}</b>
on average to evaluate.
</li>
<li>
Expand Down Expand Up @@ -213,7 +213,7 @@ <h2 class="me-auto">
</li>
<li>
Code Search saved approximately
<b>{{ taskStats._codeSearchTimeSavings / 1000 | duration }}</b>
<b>{{ taskStats._codeSearchTimeSavings | duration }}</b>
of grading time for this task.
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class StatisticsComponent implements OnInit {
title: 'Average Evaluation Time',
label: 'per Evaluation',
get: t => t.timeAvg,
render: n => this.durationPipe.transform(n / 1000),
render: n => this.durationPipe.transform(n),
},
codeSearchEffectiveness: {
title: 'Code Search Effectiveness',
Expand All @@ -49,7 +49,7 @@ export class StatisticsComponent implements OnInit {
title: 'Code Search Time Savings',
label: 'Saved by Code Search',
get: t => t._codeSearchTimeSavings,
render: n => this.durationPipe.transform(n / 1000),
render: n => this.durationPipe.transform(n),
},
} as const;
visibleProps = new Set<TaskStatisticsKey>(['score', 'codeSearchTimeSavings']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {ReadAssignmentDto} from '../../../model/assignment';
import Solution from '../../../model/solution';
import {AssignmentService} from '../../../services/assignment.service';
import {SolutionService} from '../../../services/solution.service';
import {TelemetryService} from '../../../services/telemetry.service';
import {IssueDto, SubmitService} from '../submit.service';

@Component({
Expand All @@ -30,7 +29,6 @@ export class SubmitModalComponent implements OnInit {
constructor(
public route: ActivatedRoute,
private assignmentService: AssignmentService,
private telemetryService: TelemetryService,
private solutionService: SolutionService,
private submitService: SubmitService,
private toastService: ToastService,
Expand Down Expand Up @@ -73,10 +71,6 @@ export class SubmitModalComponent implements OnInit {
}

const {assignment, _id} = this.solution!;
this.telemetryService.create(assignment, _id!, {
action: 'submitFeedback',
timestamp: new Date(),
}).subscribe();

this.submitting = true;
this.solutionService.update(assignment, _id!, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@
[class.bi-robot]="evaluation.author === 'Code Search'"
[ngbTooltip]="evaluation.remark + ' ~ ' + evaluation.author"
[routerLink]="[task._id]"
(click)="openTelemetry(task)"
></a>
<a
*ngIf="editable && !evaluations[task._id]"
ngbTooltip="Create Evaluation"
role="button"
class="bi-plus-circle link-primary ms-1"
[routerLink]="[task._id]"
(click)="openTelemetry(task)"
></a>
</ng-container>
<app-task-list
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import {switchMap} from 'rxjs/operators';
import {CreateEvaluationDto, Evaluation} from '../../../model/evaluation';
import Task from '../../../model/task';
import {ConfigService} from '../../../services/config.service';
import {SolutionService} from '../../../services/solution.service';
import {TelemetryService} from '../../../services/telemetry.service';
import {EvaluationService} from "../../../services/evaluation.service";

@Component({
Expand All @@ -21,23 +19,13 @@ export class TaskListComponent {
@Input() points?: Record<string, number>;

constructor(
private telemetryService: TelemetryService,
private evaluationService: EvaluationService,
private configService: ConfigService,
private toastService: ToastService,
private route: ActivatedRoute,
) {
}

openTelemetry(task: Task) {
const {aid, sid} = this.route.snapshot.params;
this.telemetryService.create(aid, sid, {
task: task._id,
timestamp: new Date(),
action: 'openEvaluation',
}).subscribe();
}

givePoints(task: Task, points: number) {
const {aid, sid} = this.route.snapshot.params;
this.evaluationService.findByTask(aid, sid, task._id).pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Component, EventEmitter, Input, Output} from '@angular/core';
import {merge, OperatorFunction, Subject} from 'rxjs';
import {debounceTime, distinctUntilChanged, map} from 'rxjs/operators';
import {Snippet} from '../../../model/evaluation';
import {selectionComment} from '../evaluation-modal/evaluation-modal.component';
import {selectionComment} from '../snippet-list/snippet-list.component';

@Component({
selector: 'app-edit-snippet',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,63 +17,14 @@
</a>
.
</div>
<app-evaluation-form [dto]="dto" [task]="task"></app-evaluation-form>
<label class="form-label" for="snippets">
Snippets
</label>
<div class="alert alert-info" *ngIf="evaluation && derivedSolutionCount">
Code Search derived {{ derivedSolutionCount }} evaluations from this.
<a routerLink="../../.." [queryParams]="{q: 'origin:' + evaluation._id}">
View in Table
</a>
</div>
<div *ngIf="searchSummary" class="alert alert-{{searchSummary.level}}">
Code Search found
<b>{{ searchSummary.hits }}</b>
hits in
<b>{{ searchSummary.files }}</b>
files from
<b>{{ searchSummary.solutions }}</b>
solutions for this snippet.
{{ searchSummary.message }}
<a [routerLink]="['/assignments', route.snapshot.params.aid, 'search']"
[queryParams]="{q: searchSummary.code, glob: task?.glob}">
View Results
</a>
</div>
<ul class="list-group" id="snippets">
<li *ngFor="let snippet of dto.snippets; let index=index" class="list-group-item"
[class.list-group-item-warning]="snippet.comment === selectionComment">
<app-edit-snippet
[snippet]="snippet" [index]="index" [comments]="comments"
(deleted)="deleteSnippet(index)"
></app-edit-snippet>
<app-snippet [snippet]="snippet" wildcard="***" (updated)="snippetUpdates$.next($event)"></app-snippet>
</li>
</ul>
<div class="form-text">
Use
<a href="https://marketplace.visualstudio.com/items?itemName=fulib.fulibFeedback" target="_blank">
fulibFeedback
</a>
to add code snippets from within your IDE.
<span *ngIf="task && task.glob" class="text-info">
Code Search will only look for files matching the glob pattern <code>{{ task.glob }}</code>.
</span>
</div>
<ng-container *ngIf="snippetSuggestionsEnabled && embeddingSnippets.length">
<label class="form-label" for="embedding-snippets">
Snippet Suggestions
<span class="badge bg-gradient-primary">New</span>
&nbsp;
<i class="bi-question-circle" [ngbTooltip]='"Code Search suggests code that is related to the task \"" + task?.description + "\"" '></i>
</label>
<ul class="list-group" id="embedding-snippets">
<li *ngFor="let snippet of embeddingSnippets; let first=first" class="list-group-item">
<app-snippet [snippet]="snippet" [expanded]="first" (confirmed)="confirmEmbedding(snippet)"></app-snippet>
</li>
</ul>
</ng-container>
<app-evaluation-form [dto]="dto" [task]="task"></app-evaluation-form>
<app-snippet-list [dto]="dto" [task]="task"></app-snippet-list>
</ng-container>
<ng-container modal-footer>
<div class="form-check" *ngIf="codeSearchEnabled">
Expand Down
Loading

0 comments on commit 90d4eb0

Please sign in to comment.