Skip to content

Commit 7b9b781

Browse files
ISSUE-120: Better CLI output
1 parent 53c1bbd commit 7b9b781

File tree

5 files changed

+31
-19
lines changed

5 files changed

+31
-19
lines changed

src/Domain/Strava/Activity/ImportActivities/ImportActivitiesCommandHandler.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ public function handle(Command $command): void
8383

8484
$this->activityRepository->update($activity);
8585
unset($activityIdsToDelete[(string) $activity->getId()]);
86-
$command->getOutput()->writeln(sprintf(' => Updated activity "%s"', $activity->getName()));
86+
$command->getOutput()->writeln(sprintf(
87+
' => Updated activity "%s - %s"',
88+
$activity->getName(),
89+
$activity->getStartDate()->format('d-m-Y'))
90+
);
8791
} catch (EntityNotFound) {
8892
try {
8993
$startDate = SerializableDateTime::createFromFormat(
@@ -141,7 +145,11 @@ public function handle(Command $command): void
141145

142146
$this->activityRepository->add($activity);
143147
unset($activityIdsToDelete[(string) $activity->getId()]);
144-
$command->getOutput()->writeln(sprintf(' => Imported activity "%s"', $activity->getName()));
148+
$command->getOutput()->writeln(sprintf(
149+
' => Imported activity "%s - %s"',
150+
$activity->getName(),
151+
$activity->getStartDate()->format('d-m-Y'))
152+
);
145153
} catch (ClientException|RequestException $exception) {
146154
$this->stravaDataImportStatus->markActivityImportAsUncompleted();
147155

@@ -175,7 +183,11 @@ public function handle(Command $command): void
175183
$activity->delete();
176184
$this->activityRepository->delete($activity);
177185

178-
$command->getOutput()->writeln(sprintf(' => Deleted activity "%s"', $activity->getName()));
186+
$command->getOutput()->writeln(sprintf(
187+
' => Deleted activity "%s - %s"',
188+
$activity->getName(),
189+
$activity->getStartDate()->format('d-m-Y'))
190+
);
179191
}
180192
}
181193
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Importing activities...
22
=> Sport type "Wrong" not supported yet. <a href="https://github.com/robiningelbrecht/strava-statistics/issues/new?assignees=robiningelbrecht&labels=new+feature&projects=&template=feature_request.md&title=Add+support+for+sport+type+Wrong>Open a new GitHub issue</a> to if you want support for this sport type
3-
=> Imported activity "Night Ride1"
4-
=> Imported activity "Watopia Flat Forward in London"
5-
=> Updated activity "Night Ride3"
6-
=> Imported activity "Night Ride4"
7-
=> Imported activity "Night Ride5"
8-
=> Deleted activity "Delete this one"
9-
=> Deleted activity "Delete this one as well"
3+
=> Imported activity "Night Ride1 - 11-09-2023"
4+
=> Imported activity "Watopia Flat Forward in London - 31-08-2023"
5+
=> Updated activity "Night Ride3 - 10-10-2023"
6+
=> Imported activity "Night Ride4 - 11-09-2023"
7+
=> Imported activity "Night Ride5 - 11-09-2023"
8+
=> Deleted activity "Delete this one - 10-10-2023"
9+
=> Deleted activity "Delete this one as well - 10-10-2023"
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Importing activities...
22
=> Sport type "Wrong" not supported yet. <a href="https://github.com/robiningelbrecht/strava-statistics/issues/new?assignees=robiningelbrecht&labels=new+feature&projects=&template=feature_request.md&title=Add+support+for+sport+type+Wrong>Open a new GitHub issue</a> to if you want support for this sport type
3-
=> Imported activity "Night Ride1"
4-
=> Imported activity "Watopia Flat Forward in London"
5-
=> Updated activity "Night Ride3"
6-
=> Imported activity "Night Ride4"
3+
=> Imported activity "Night Ride1 - 11-09-2023"
4+
=> Imported activity "Watopia Flat Forward in London - 31-08-2023"
5+
=> Updated activity "Night Ride3 - 10-10-2023"
6+
=> Imported activity "Night Ride4 - 11-09-2023"
77
<error>You probably reached Strava API rate limits. You will need to import the rest of your activities tomorrow</error>
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Importing activities...
22
=> Sport type "Wrong" not supported yet. <a href="https://github.com/robiningelbrecht/strava-statistics/issues/new?assignees=robiningelbrecht&labels=new+feature&projects=&template=feature_request.md&title=Add+support+for+sport+type+Wrong>Open a new GitHub issue</a> to if you want support for this sport type
3-
=> Imported activity "Night Ride1"
4-
=> Imported activity "Watopia Flat Forward in London"
5-
=> Updated activity "Night Ride3"
6-
=> Imported activity "Night Ride4"
7-
=> Imported activity "Night Ride5"
3+
=> Imported activity "Night Ride1 - 11-09-2023"
4+
=> Imported activity "Watopia Flat Forward in London - 31-08-2023"
5+
=> Updated activity "Night Ride3 - 10-10-2023"
6+
=> Imported activity "Night Ride4 - 11-09-2023"
7+
=> Imported activity "Night Ride5 - 11-09-2023"

tests/strava.db

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)