Skip to content

v1.1.0 Enhance workout features and fix layout inconsistencies#72

Merged
FalkenDev merged 16 commits into
mainfrom
v1.1.0
May 8, 2026
Merged

v1.1.0 Enhance workout features and fix layout inconsistencies#72
FalkenDev merged 16 commits into
mainfrom
v1.1.0

Conversation

@FalkenDev

Copy link
Copy Markdown
Owner

This pull request introduces the "streak freeze" feature to the user streak system, allowing users to protect their workout streaks from being reset under certain conditions. It also includes related schema changes, API updates, and improvements to user statistics tracking. Additionally, there are minor updates to package versions and some formatting changes.

Streak Freeze Feature and Streak System Enhancements:

  • Added new columns to the user table: streakFreezes (number of available freezes), streakFreezeUsedWeek (tracks which week a freeze was used), and completedGoalWeeksCount (tracks completed goal weeks). Includes migration and entity updates. [1] [2]
  • Implemented logic to award a streak freeze every two completed goal weeks (up to a maximum of 2), and to consume a freeze to protect a streak if the weekly goal is not met. Streak freeze usage and awarding are now handled in the streak update logic.
  • Added helper method getISOWeekKey for week identification, and exposed streak freeze information in the streak info API response. [1] [2] [3]

API Changes:

  • Added a new endpoint POST /user/streak/freeze to allow users to consume a streak freeze for the current week.
  • Updated the user data export endpoint and related code for improved formatting and maintainability. [1] [2] [3]

Statistics and Service Layer Improvements:

  • Refactored statistics and workout session services to support passing a custom EntityManager, improving transaction support and code flexibility. [1] [2] [3] [4] [5] [6] [7] [8] [9]

Package and Dependency Updates:

  • Bumped backend and frontend package versions from 1.0.0 to 1.1.0 and made minor adjustments to the frontend package-lock file regarding dev and optional dependencies. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

@FalkenDev FalkenDev requested a review from Copilot May 8, 2026 22:02
@FalkenDev FalkenDev self-assigned this May 8, 2026
@github-actions github-actions Bot added platform: backend For issues concerning the REST API, server logic, database interactions, or authentication. client: web-mobile For issues related to the web app UI/UX, including its responsive mobile views. labels May 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Introduces a “streak freeze” mechanic into the streak system (backend persistence + API + frontend UI), along with related calendar/home visual updates and some service-layer refactors to support transactional statistics updates.

Changes:

  • Added streak-freeze persistence (new user columns + migration) and exposed freeze status in streak APIs.
  • Implemented POST /users/streak/freeze and integrated frontend UI flows (Calendar freeze card/dialog + home icon/status).
  • Refactored statistics record upsert to accept an optional EntityManager and wired it through workout-session transaction paths.

Reviewed changes

Copilot reviewed 17 out of 19 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
frontend/src/services/user.service.ts Adds client call for the streak-freeze endpoint.
frontend/src/pages/WorkoutDetails.vue Adjusts layout by removing sticky start button styling.
frontend/src/pages/Session.vue Minor spacing adjustment in session header container.
frontend/src/pages/index.vue Updates weekly-goal card to reflect freeze state visually.
frontend/src/pages/Calendar.vue Adds freeze UI + calendar badge redesign + monthly stats card changes.
frontend/src/locales/sv.ts Adds Swedish strings for freeze UI/labels.
frontend/src/locales/en.ts Adds English strings for freeze UI/labels.
frontend/src/interfaces/User.interface.ts Extends StreakInfo with freeze-related fields.
frontend/src/components/Session/WorkoutExerciseCard.vue Adds quick “add set” icon and refines details toggle behavior/styling.
frontend/package.json Bumps frontend version to 1.1.0.
frontend/package-lock.json Updates lockfile version metadata and dependency flags.
backend/src/v1/workoutSession/workoutSession.service.ts Passes transaction EntityManager into statistics record upsert calls.
backend/src/v1/user/user.service.ts Implements freeze logic, awarding/consumption, and enriches streak info response.
backend/src/v1/user/user.entity.ts Adds new user columns for freeze tracking and goal-week counters.
backend/src/v1/user/user.controller.ts Adds POST /users/streak/freeze endpoint and export formatting changes.
backend/src/v1/statistics/statistics.service.ts Allows record upsert to use a provided EntityManager for transactional consistency.
backend/src/v1/migrations/1775000000000-AddStreakFreezesToUser.ts Creates the new streak-freeze and goal-week tracking columns.
backend/package.json Bumps backend version to 1.1.0.
backend/package-lock.json Updates backend lockfile version metadata.
Files not reviewed (2)
  • backend/package-lock.json: Language not supported
  • frontend/package-lock.json: Language not supported

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

Comment on lines +280 to 289
} else {
// Goal met for exactly last week — award a freeze if earned
user.completedGoalWeeksCount = (user.completedGoalWeeksCount || 0) + 1;
if (
user.completedGoalWeeksCount % 2 === 0 &&
(user.streakFreezes || 0) < 2
) {
user.streakFreezes = (user.streakFreezes || 0) + 1;
}
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed in commit 5763d77. Added user.lastStreakCheckDate = currentWeekMonday inside checkAndResetWeeklyProgress after the week rollover logic runs. This ensures that subsequent calls (e.g. repeated getStreakInfo calls within the same new week) see lastStreakCheckDate already pointing to the current week's Monday and skip the rollover, preventing completedGoalWeeksCount from being incremented multiple times and duplicate freeze awards.

Comment on lines +401 to +408
const now = new Date();
const currentWeekKey = this.getISOWeekKey(now);
const targetDate = new Date(date + 'T12:00:00');
const targetWeekKey = this.getISOWeekKey(targetDate);

if (targetWeekKey !== currentWeekKey) {
throw new BadRequestException('Can only freeze the current week');
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed in commit 422854f. Added a Number.isNaN(targetDate.getTime()) guard that returns a clear 400 "Invalid date format" error for unparseable date strings (defence-in-depth for direct service calls that bypass the HTTP pipeline). The redundant !date null check was omitted since the DTO's @IsDateString() already enforces presence at the controller layer.

Comment thread frontend/src/services/user.service.ts Outdated
Comment thread frontend/src/pages/Calendar.vue Outdated
Comment thread frontend/src/pages/Calendar.vue Outdated
Comment on lines +152 to +162
@Post('streak/freeze')
@ApiOperation({ summary: 'Use a streak freeze to protect the current week' })
@ApiOkResponse({
description: 'Updated streak info after consuming the freeze',
})
useStreakFreeze(@Req() req: RequestWithUser, @Body() body: { date: string }) {
if (!req.user?.id) {
throw new UnauthorizedException('User not authenticated');
}
return this.userService.useStreakFreeze(+req.user.id, body.date);
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fixed in commit 422854f. Created UseStreakFreezeDto with @IsDateString() and @ApiProperty in backend/src/v1/user/dto/UseStreakFreeze.dto.ts, and updated the controller to accept @Body() body: UseStreakFreezeDto so the global ValidationPipe now validates and rejects invalid/missing date values, and Swagger reflects the schema.

FalkenDev and others added 4 commits May 9, 2026 00:10
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…vent repeated rollover

Agent-Logs-Url: https://github.com/FalkenDev/Grindify/sessions/e0e89066-dcb4-45d7-9fd2-9ff9dccc179a

Co-authored-by: FalkenDev <88202349+FalkenDev@users.noreply.github.com>

Copilot AI commented May 8, 2026

Copy link
Copy Markdown
Contributor

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • scarf.sh
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./report.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI and others added 2 commits May 8, 2026 22:15

Copilot AI commented May 8, 2026

Copy link
Copy Markdown
Contributor

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • scarf.sh
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./report.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@FalkenDev FalkenDev merged commit 5270b67 into main May 8, 2026
4 checks passed
@FalkenDev FalkenDev deleted the v1.1.0 branch May 8, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client: web-mobile For issues related to the web app UI/UX, including its responsive mobile views. platform: backend For issues concerning the REST API, server logic, database interactions, or authentication.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants