Skip to content

Commit

Permalink
Add location to history export
Browse files Browse the repository at this point in the history
  • Loading branch information
leepeuker committed Aug 22, 2024
1 parent 40f4d70 commit d90ada6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Domain/Movie/MovieRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -925,9 +925,10 @@ public function fetchWatchDatesForMovieIds(int $userId, array $movieIds) : array
public function fetchWatchDatesOrderedByWatchedAtDesc(int $userId) : array
{
return $this->dbConnection->fetchAllAssociative(
'SELECT m.*, muwd.watched_at, muwd.plays, comment
'SELECT m.*, muwd.watched_at, muwd.plays, comment, l.name as location_name
FROM movie_user_watch_dates muwd
JOIN movie m on muwd.movie_id = m.id
JOIN location l on muwd.location_id = l.id
WHERE muwd.user_id = ?
ORDER BY watched_at DESC, muwd.position DESC',
[$userId],
Expand Down
2 changes: 1 addition & 1 deletion src/Service/Export/ExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class ExportService
{
private const CSV_HEADER_HISTORY = 'title,year,tmdbId,imdbId,watchedAt,comment' . PHP_EOL;
private const CSV_HEADER_HISTORY = 'title,year,tmdbId,imdbId,watchedAt,comment,location' . PHP_EOL;

private const CSV_HEADER_RATINGS = 'title,year,tmdbId,imdbId,userRating' . PHP_EOL;

Expand Down
1 change: 1 addition & 0 deletions src/Service/Export/ExportWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function writeWatchDateToCsv($fileHandle, array $movieWatchDate) : void
$movieWatchDate['imdb_id'],
$watchDate,
$movieWatchDate['comment'],
$movieWatchDate['location_name'],
]);

if ($lengthOfWrittenString === false) {
Expand Down

0 comments on commit d90ada6

Please sign in to comment.