Skip to content

Conversation

@jakubka
Copy link

@jakubka jakubka commented Jan 23, 2026

No description provided.

Copilot AI review requested due to automatic review settings January 23, 2026 14:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an initial version of an activities statistics tracking system with two main programs: a simple stub implementation (p1.js) and a comprehensive statistics calculator (p2/).

Changes:

  • Added package.json with scripts to run both programs
  • Implemented a full-featured activity statistics system in p2/ with data loading, validation, aggregation, and formatting capabilities
  • Created a stub implementation in p1.js with placeholder functions for basic activity queries

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
package.json Defines project metadata and npm scripts for running both programs
p2/services/stats-calculator.js Implements statistical calculations for activity data including averages, personal bests, and rankings
p2/services/aggregator.js Provides utility functions for grouping, filtering, and aggregating activity data
p2/reports/formatter.js Contains formatting functions to display statistics in various text formats
p2/index.js Main entry point that loads data, validates it, generates statistics, and outputs formatted reports
p2/data/loader.js Handles loading and validation of activity and activity type data from JSON files
p2/data/activities.json Sample activity data for testing the statistics system
p2/config/activity-types.json Configuration defining activity types with metadata like calorie rates and display names
p1.js Stub implementation with placeholder functions for basic activity queries
README.md Updated with repository description and link to internal documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

export function generateStatistics(activities, activityTypes) {
const types = getUniqueValues(activities, 'type');
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The activityTypes parameter is accepted but never used in this function. It should either be removed or utilized if it's intended for future functionality.

Suggested change
const types = getUniqueValues(activities, 'type');
const types =
Array.isArray(activityTypes) && activityTypes.length > 0
? activityTypes
: getUniqueValues(activities, 'type');

Copilot uses AI. Check for mistakes.
avgDistance: aggregate(personActivities, 'distance', 'avg'),
avgDuration: aggregate(personActivities, 'duration', 'avg'),
avgHeartRate: aggregate(personActivities, 'heartRate', 'avg'),
totalElevation: aggregate(personActivities, 'elevation', 'sum'),
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field name 'elevation' is inconsistent with the activity data structure which uses 'elevationGain' as seen in loader.js validation and activities.json. This will cause incorrect aggregation results.

Suggested change
totalElevation: aggregate(personActivities, 'elevation', 'sum'),
totalElevation: aggregate(personActivities, 'elevationGain', 'sum'),

Copilot uses AI. Check for mistakes.
{ person: 'Eve', distance: 2.5, type: 'swim', week: 'W03' },
];

function getTotalRunDistanceForPerson(personName) {
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The personName parameter is unused in this placeholder implementation. Consider adding a comment indicating this is a stub that needs implementation.

Suggested change
function getTotalRunDistanceForPerson(personName) {
function getTotalRunDistanceForPerson(personName) {
// TODO: Implement this function to use `personName` and calculate the total run distance from ACTIVITIES.
// Currently this is a stub implementation that ignores `personName` and returns a placeholder value.

Copilot uses AI. Check for mistakes.
return 123;
}

function getTopRunnerForGivenWeek(week) {
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The week parameter is unused in this placeholder implementation. Consider adding a comment indicating this is a stub that needs implementation.

Suggested change
function getTopRunnerForGivenWeek(week) {
function getTopRunnerForGivenWeek(week) {
// TODO: Placeholder implementation; `week` is currently unused and should be
// used to determine the top runner for the specified week.

Copilot uses AI. Check for mistakes.
}]
}
}

Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The startingWeek and endingWeek parameters are unused in this placeholder implementation. Consider adding a comment indicating this is a stub that needs implementation.

Suggested change
// TODO: This is a stub implementation; use startingWeek and endingWeek to calculate the most improved runner.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant