Skip to content

Commit 288d069

Browse files
ISSUE #1486: Add 50k, 100k, and 100miles to running best efforts
1 parent 101a4db commit 288d069

File tree

5 files changed

+268
-0
lines changed

5 files changed

+268
-0
lines changed

config/reference.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,17 @@
10951095
* doctrine?: DoctrineConfig,
10961096
* doctrine_migrations?: DoctrineMigrationsConfig,
10971097
* twig?: TwigConfig,
1098+
* "when@dev"?: array{
1099+
* imports?: ImportsConfig,
1100+
* parameters?: ParametersConfig,
1101+
* services?: ServicesConfig,
1102+
* framework?: FrameworkConfig,
1103+
* flysystem?: FlysystemConfig,
1104+
* monolog?: MonologConfig,
1105+
* doctrine?: DoctrineConfig,
1106+
* doctrine_migrations?: DoctrineMigrationsConfig,
1107+
* twig?: TwigConfig,
1108+
* },
10981109
* "when@prod"?: array{
10991110
* imports?: ImportsConfig,
11001111
* parameters?: ParametersConfig,
@@ -1197,6 +1208,7 @@ public static function config(array $config): array
11971208
* deprecated?: array{package:string, version:string, message?:string},
11981209
* }
11991210
* @psalm-type RoutesConfig = array{
1211+
* "when@dev"?: array<string, RouteConfig|ImportConfig|AliasConfig>,
12001212
* "when@prod"?: array<string, RouteConfig|ImportConfig|AliasConfig>,
12011213
* "when@test"?: array<string, RouteConfig|ImportConfig|AliasConfig>,
12021214
* ...<string, RouteConfig|ImportConfig|AliasConfig>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DoctrineMigrations;
6+
7+
use App\Domain\Activity\ActivityType;
8+
use Doctrine\DBAL\ArrayParameterType;
9+
use Doctrine\DBAL\Schema\Schema;
10+
use Doctrine\Migrations\AbstractMigration;
11+
12+
/**
13+
* Auto-generated Migration: Please modify to your needs!
14+
*/
15+
final class Version20251205074138 extends AbstractMigration
16+
{
17+
public function getDescription(): string
18+
{
19+
return '';
20+
}
21+
22+
public function up(Schema $schema): void
23+
{
24+
// this up() migration is auto-generated, please modify it to your needs
25+
$activityIds = $this->connection->fetchFirstColumn(
26+
<<<'SQL'
27+
SELECT activityId FROM Activity WHERE activityType = :activityType
28+
SQL,
29+
[
30+
'activityType' => ActivityType::RUN->value,
31+
]
32+
);
33+
34+
if (0 === count($activityIds)) {
35+
return;
36+
}
37+
38+
$this->addSql(<<<'SQL'
39+
DELETE FROM ActivityBestEffort
40+
WHERE activityId IN(:activityIds)
41+
SQL,
42+
[
43+
'activityIds' => $activityIds,
44+
],
45+
[
46+
'activityIds' => ArrayParameterType::STRING,
47+
],
48+
);
49+
}
50+
51+
public function down(Schema $schema): void
52+
{
53+
// this down() migration is auto-generated, please modify it to your needs
54+
}
55+
}

src/Domain/Activity/ActivityType.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ public function getDistancesForBestEffortCalculation(): array
133133
Kilometer::from(21.097),
134134
Kilometer::from(30),
135135
Kilometer::from(42.194),
136+
Kilometer::from(50),
137+
Kilometer::from(100),
138+
Mile::from(100),
136139
],
137140
default => [],
138141
};

tests/Domain/Activity/BestEffort/__snapshots__/DbalActivityBestEffortRepositoryTest__testFindBestEffortHistory__2.json

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,5 +778,185 @@
778778
"sportType": "Run",
779779
"distanceInMeter": 42194,
780780
"timeInSeconds": 10
781+
},
782+
{
783+
"activityId": "activity-Run-50000-1",
784+
"sportType": "Run",
785+
"distanceInMeter": 50000,
786+
"timeInSeconds": 1
787+
},
788+
{
789+
"activityId": "activity-Run-50000-2",
790+
"sportType": "Run",
791+
"distanceInMeter": 50000,
792+
"timeInSeconds": 2
793+
},
794+
{
795+
"activityId": "activity-Run-50000-3",
796+
"sportType": "Run",
797+
"distanceInMeter": 50000,
798+
"timeInSeconds": 3
799+
},
800+
{
801+
"activityId": "activity-Run-50000-4",
802+
"sportType": "Run",
803+
"distanceInMeter": 50000,
804+
"timeInSeconds": 4
805+
},
806+
{
807+
"activityId": "activity-Run-50000-5",
808+
"sportType": "Run",
809+
"distanceInMeter": 50000,
810+
"timeInSeconds": 5
811+
},
812+
{
813+
"activityId": "activity-Run-50000-6",
814+
"sportType": "Run",
815+
"distanceInMeter": 50000,
816+
"timeInSeconds": 6
817+
},
818+
{
819+
"activityId": "activity-Run-50000-7",
820+
"sportType": "Run",
821+
"distanceInMeter": 50000,
822+
"timeInSeconds": 7
823+
},
824+
{
825+
"activityId": "activity-Run-50000-8",
826+
"sportType": "Run",
827+
"distanceInMeter": 50000,
828+
"timeInSeconds": 8
829+
},
830+
{
831+
"activityId": "activity-Run-50000-9",
832+
"sportType": "Run",
833+
"distanceInMeter": 50000,
834+
"timeInSeconds": 9
835+
},
836+
{
837+
"activityId": "activity-Run-50000-10",
838+
"sportType": "Run",
839+
"distanceInMeter": 50000,
840+
"timeInSeconds": 10
841+
},
842+
{
843+
"activityId": "activity-Run-100000-1",
844+
"sportType": "Run",
845+
"distanceInMeter": 100000,
846+
"timeInSeconds": 1
847+
},
848+
{
849+
"activityId": "activity-Run-100000-2",
850+
"sportType": "Run",
851+
"distanceInMeter": 100000,
852+
"timeInSeconds": 2
853+
},
854+
{
855+
"activityId": "activity-Run-100000-3",
856+
"sportType": "Run",
857+
"distanceInMeter": 100000,
858+
"timeInSeconds": 3
859+
},
860+
{
861+
"activityId": "activity-Run-100000-4",
862+
"sportType": "Run",
863+
"distanceInMeter": 100000,
864+
"timeInSeconds": 4
865+
},
866+
{
867+
"activityId": "activity-Run-100000-5",
868+
"sportType": "Run",
869+
"distanceInMeter": 100000,
870+
"timeInSeconds": 5
871+
},
872+
{
873+
"activityId": "activity-Run-100000-6",
874+
"sportType": "Run",
875+
"distanceInMeter": 100000,
876+
"timeInSeconds": 6
877+
},
878+
{
879+
"activityId": "activity-Run-100000-7",
880+
"sportType": "Run",
881+
"distanceInMeter": 100000,
882+
"timeInSeconds": 7
883+
},
884+
{
885+
"activityId": "activity-Run-100000-8",
886+
"sportType": "Run",
887+
"distanceInMeter": 100000,
888+
"timeInSeconds": 8
889+
},
890+
{
891+
"activityId": "activity-Run-100000-9",
892+
"sportType": "Run",
893+
"distanceInMeter": 100000,
894+
"timeInSeconds": 9
895+
},
896+
{
897+
"activityId": "activity-Run-100000-10",
898+
"sportType": "Run",
899+
"distanceInMeter": 100000,
900+
"timeInSeconds": 10
901+
},
902+
{
903+
"activityId": "activity-Run-160934-1",
904+
"sportType": "Run",
905+
"distanceInMeter": 160934,
906+
"timeInSeconds": 1
907+
},
908+
{
909+
"activityId": "activity-Run-160934-2",
910+
"sportType": "Run",
911+
"distanceInMeter": 160934,
912+
"timeInSeconds": 2
913+
},
914+
{
915+
"activityId": "activity-Run-160934-3",
916+
"sportType": "Run",
917+
"distanceInMeter": 160934,
918+
"timeInSeconds": 3
919+
},
920+
{
921+
"activityId": "activity-Run-160934-4",
922+
"sportType": "Run",
923+
"distanceInMeter": 160934,
924+
"timeInSeconds": 4
925+
},
926+
{
927+
"activityId": "activity-Run-160934-5",
928+
"sportType": "Run",
929+
"distanceInMeter": 160934,
930+
"timeInSeconds": 5
931+
},
932+
{
933+
"activityId": "activity-Run-160934-6",
934+
"sportType": "Run",
935+
"distanceInMeter": 160934,
936+
"timeInSeconds": 6
937+
},
938+
{
939+
"activityId": "activity-Run-160934-7",
940+
"sportType": "Run",
941+
"distanceInMeter": 160934,
942+
"timeInSeconds": 7
943+
},
944+
{
945+
"activityId": "activity-Run-160934-8",
946+
"sportType": "Run",
947+
"distanceInMeter": 160934,
948+
"timeInSeconds": 8
949+
},
950+
{
951+
"activityId": "activity-Run-160934-9",
952+
"sportType": "Run",
953+
"distanceInMeter": 160934,
954+
"timeInSeconds": 9
955+
},
956+
{
957+
"activityId": "activity-Run-160934-10",
958+
"sportType": "Run",
959+
"distanceInMeter": 160934,
960+
"timeInSeconds": 10
781961
}
782962
]

tests/Domain/Activity/BestEffort/__snapshots__/DbalActivityBestEffortRepositoryTest__testFindBestEffortsFor__2.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,23 @@
7676
"sportType": "Run",
7777
"distanceInMeter": 42194,
7878
"timeInSeconds": 1
79+
},
80+
{
81+
"activityId": "activity-Run-50000-1",
82+
"sportType": "Run",
83+
"distanceInMeter": 50000,
84+
"timeInSeconds": 1
85+
},
86+
{
87+
"activityId": "activity-Run-100000-1",
88+
"sportType": "Run",
89+
"distanceInMeter": 100000,
90+
"timeInSeconds": 1
91+
},
92+
{
93+
"activityId": "activity-Run-160934-1",
94+
"sportType": "Run",
95+
"distanceInMeter": 160934,
96+
"timeInSeconds": 1
7997
}
8098
]

0 commit comments

Comments
 (0)