Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x | import * as vscode from "vscode"; import { LogData, LogEvent } from "../api/types/event"; /** * Calculates user progress statistics based on log data. * * Analyzes how many suggestions the user accepted, how many of those had bugs, * and computes the percentage of accepted suggestions that contained bugs. * * @param logs - An array of user interaction logs (`LogData`). * @returns An object containing: * - `totalAccepted`: The number of suggestions accepted by the user. * - `totalWithBugs`: The number of accepted suggestions that had bugs. * - `percentageWithBugs`: The percentage of accepted suggestions that contained bugs. */ export function calculateUserProgress(logs: LogData[]): { totalAccepted: number; totalWithBugs: number; percentageWithBugs: number; } { // Filter logs for USER_ACCEPT events const acceptedLogs = logs.filter((log) => log.event === LogEvent.USER_ACCEPT); const totalAccepted = acceptedLogs.length; const totalWithBugs = acceptedLogs.filter( (log) => log.metadata.has_bug === true ).length; // Calculate the percentage of accepted suggestions with bugs const percentageWithBugs = totalAccepted > 0 ? (totalWithBugs / totalAccepted) * 100 : 0; return { totalAccepted, totalWithBugs, percentageWithBugs, }; } |