Skip to content

Commit b92dc33

Browse files
ISSUE #1617: Streaks widget not displaying streaks correctly
1 parent b943588 commit b92dc33

File tree

4 files changed

+4
-17
lines changed

4 files changed

+4
-17
lines changed

config/reference.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,17 +1098,6 @@
10981098
* doctrine?: DoctrineConfig,
10991099
* doctrine_migrations?: DoctrineMigrationsConfig,
11001100
* twig?: TwigConfig,
1101-
* "when@dev"?: array{
1102-
* imports?: ImportsConfig,
1103-
* parameters?: ParametersConfig,
1104-
* services?: ServicesConfig,
1105-
* framework?: FrameworkConfig,
1106-
* flysystem?: FlysystemConfig,
1107-
* monolog?: MonologConfig,
1108-
* doctrine?: DoctrineConfig,
1109-
* doctrine_migrations?: DoctrineMigrationsConfig,
1110-
* twig?: TwigConfig,
1111-
* },
11121101
* "when@prod"?: array{
11131102
* imports?: ImportsConfig,
11141103
* parameters?: ParametersConfig,
@@ -1211,7 +1200,6 @@ public static function config(array $config): array
12111200
* deprecated?: array{package:string, version:string, message?:string},
12121201
* }
12131202
* @psalm-type RoutesConfig = array{
1214-
* "when@dev"?: array<string, RouteConfig|ImportConfig|AliasConfig>,
12151203
* "when@prod"?: array<string, RouteConfig|ImportConfig|AliasConfig>,
12161204
* "when@test"?: array<string, RouteConfig|ImportConfig|AliasConfig>,
12171205
* ...<string, RouteConfig|ImportConfig|AliasConfig>

src/Domain/Rewind/FindStreaks/FindStreaksQueryHandler.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
final readonly class FindStreaksQueryHandler implements QueryHandler
1717
{
1818
private const string FIRST_DAY_OF_THE_WEEK = 'monday this week';
19-
private const string FIRST_DAY_OF_THE_MONTH = 'first day of this month';
2019

2120
public function __construct(
2221
private Connection $connection,
@@ -84,7 +83,7 @@ private function computeStreaks(array $days): FindStreaksResponse
8483
$longestMonthStreak = $runningMonthStreak = 1;
8584

8685
$previousDay = array_first($days);
87-
$keepTrackOfCurrentDayStreak = $today->diff($previousDay)->days < 2;
86+
$keepTrackOfCurrentDayStreak = $today->diff($previousDay)->days < 2;
8887
$currentDayStreak = $keepTrackOfCurrentDayStreak ? 1 : 0;
8988

9089
$keepTrackOfCurrentWeekStreak = $today->diff($previousDay)->days < 7;
@@ -93,7 +92,7 @@ private function computeStreaks(array $days): FindStreaksResponse
9392
$monthDiff =
9493
(($today->getYear() - $previousDay->getYear()) * 12)
9594
+ ($today->getMonthWithoutLeadingZero() - $previousDay->getMonthWithoutLeadingZero());
96-
$keepTrackOfCurrentMonthStreak = $monthDiff <= 1;
95+
$keepTrackOfCurrentMonthStreak = $monthDiff <= 1;
9796
$currentMonthStreak = $keepTrackOfCurrentMonthStreak ? 1 : 0;
9897

9998
for ($i = 1; $i < count($days); ++$i) {

tests/Application/Build/BuildDashboardHtml/__snapshots__/BuildDashboardHtmlCommandHandlerTest--testHandle--dashboard-html.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3688,7 +3688,7 @@ <h3 class="text-lg font-semibold"> Current streaks</h3>
36883688
</div>
36893689
<div class="grow py-5 border border-gray-200 border-t-4 border-t-strava-orange rounded-sm">
36903690
<div class="text-3xl font-extrabold">
3691-
0
3691+
3
36923692
</div>
36933693
<div class="text-sm">months</div>
36943694
</div>

tests/Domain/Rewind/FindStreaks/FindStreaksQueryHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public static function provideData(): iterable
8686
{
8787
return [
8888
[
89-
PausedClock::fromString('2025-01-10'),
89+
PausedClock::fromString('2025-01-11'),
9090
new FindStreaksResponse(
9191
longestDayStreak: 5,
9292
currentDayStreak: 4,

0 commit comments

Comments
 (0)