mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-06 18:31:05 +00:00
fix(podcast-about): update stats query to discard scheduled episodes from episodes number
This commit is contained in:
parent
2accb0f765
commit
67c037c9eb
@ -324,10 +324,8 @@ class EpisodeModel extends UuidModel
|
|||||||
{
|
{
|
||||||
$result = $this->builder()
|
$result = $this->builder()
|
||||||
->selectMax('season_number', 'current_season_number')
|
->selectMax('season_number', 'current_season_number')
|
||||||
->where([
|
->where('podcast_id', $podcastId)
|
||||||
'podcast_id' => $podcastId,
|
->where('`published_at` <= UTC_TIMESTAMP()', null, false)
|
||||||
'published_at IS NOT' => null,
|
|
||||||
])
|
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
@ -339,10 +337,11 @@ class EpisodeModel extends UuidModel
|
|||||||
$result = $this->builder()
|
$result = $this->builder()
|
||||||
->selectMax('number', 'next_episode_number')
|
->selectMax('number', 'next_episode_number')
|
||||||
->where([
|
->where([
|
||||||
'podcast_id' => $podcastId,
|
'podcast_id' => $podcastId,
|
||||||
'season_number' => $seasonNumber,
|
'season_number' => $seasonNumber,
|
||||||
'published_at IS NOT' => null,
|
])
|
||||||
])->get()
|
->where('`published_at` <= UTC_TIMESTAMP()', null, false)
|
||||||
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
return (int) $result[0]['next_episode_number'] + 1;
|
return (int) $result[0]['next_episode_number'] + 1;
|
||||||
@ -357,10 +356,9 @@ class EpisodeModel extends UuidModel
|
|||||||
->select(
|
->select(
|
||||||
'COUNT(DISTINCT season_number) as number_of_seasons, COUNT(*) as number_of_episodes, MIN(published_at) as first_published_at'
|
'COUNT(DISTINCT season_number) as number_of_seasons, COUNT(*) as number_of_episodes, MIN(published_at) as first_published_at'
|
||||||
)
|
)
|
||||||
->where([
|
->where('podcast_id', $podcastId)
|
||||||
'podcast_id' => $podcastId,
|
->where('`published_at` <= UTC_TIMESTAMP()', null, false)
|
||||||
'published_at IS NOT' => null,
|
->get()
|
||||||
])->get()
|
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
$stats = [
|
$stats = [
|
||||||
|
@ -245,9 +245,8 @@ class PodcastModel extends Model
|
|||||||
->builder()
|
->builder()
|
||||||
->select('YEAR(published_at) as year, count(*) as number_of_episodes')
|
->select('YEAR(published_at) as year, count(*) as number_of_episodes')
|
||||||
->where([
|
->where([
|
||||||
'podcast_id' => $podcastId,
|
'podcast_id' => $podcastId,
|
||||||
'season_number' => null,
|
'season_number' => null,
|
||||||
'published_at IS NOT' => null,
|
|
||||||
])
|
])
|
||||||
->where('`published_at` <= UTC_TIMESTAMP()', null, false)
|
->where('`published_at` <= UTC_TIMESTAMP()', null, false)
|
||||||
->groupBy('year')
|
->groupBy('year')
|
||||||
@ -284,7 +283,6 @@ class PodcastModel extends Model
|
|||||||
->where([
|
->where([
|
||||||
'podcast_id' => $podcastId,
|
'podcast_id' => $podcastId,
|
||||||
'season_number is not' => null,
|
'season_number is not' => null,
|
||||||
'published_at IS NOT' => null,
|
|
||||||
])
|
])
|
||||||
->where('`published_at` <= UTC_TIMESTAMP()', null, false)
|
->where('`published_at` <= UTC_TIMESTAMP()', null, false)
|
||||||
->groupBy('season_number')
|
->groupBy('season_number')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user