patch #2
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ vendor/*
|
|||||||
tests/.phpunit.result.cache
|
tests/.phpunit.result.cache
|
||||||
node_modules/
|
node_modules/
|
||||||
js/
|
js/
|
||||||
|
build/
|
||||||
|
2
Makefile
2
Makefile
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
app_name=gpoddersync
|
app_name=gpoddersync
|
||||||
|
|
||||||
project_dir=$(CURDIR)/../$(app_name)
|
project_dir=$(CURDIR)
|
||||||
build_dir=$(CURDIR)/build/artifacts
|
build_dir=$(CURDIR)/build/artifacts
|
||||||
appstore_dir=$(build_dir)/appstore
|
appstore_dir=$(build_dir)/appstore
|
||||||
source_dir=$(build_dir)/source
|
source_dir=$(build_dir)/source
|
||||||
|
@ -41,6 +41,7 @@ class EpisodeActionController extends Controller {
|
|||||||
public function create(): JSONResponse {
|
public function create(): JSONResponse {
|
||||||
|
|
||||||
$episodeActionsArray = $this->filterEpisodesFromRequestParams($this->request->getParams());
|
$episodeActionsArray = $this->filterEpisodesFromRequestParams($this->request->getParams());
|
||||||
|
$episodeActionsArray = $this->filterOnlyPlays($episodeActionsArray);
|
||||||
$this->episodeActionSaver->saveEpisodeActions($episodeActionsArray, $this->userId);
|
$this->episodeActionSaver->saveEpisodeActions($episodeActionsArray, $this->userId);
|
||||||
|
|
||||||
return new JSONResponse(["timestamp" => time()]);
|
return new JSONResponse(["timestamp" => time()]);
|
||||||
@ -74,4 +75,12 @@ class EpisodeActionController extends Controller {
|
|||||||
public function filterEpisodesFromRequestParams(array $data): array {
|
public function filterEpisodesFromRequestParams(array $data): array {
|
||||||
return array_filter($data, "is_numeric", ARRAY_FILTER_USE_KEY);
|
return array_filter($data, "is_numeric", ARRAY_FILTER_USE_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $data
|
||||||
|
* @return array $episodeActionsArray
|
||||||
|
*/
|
||||||
|
private function filterOnlyPlays(array $data): array {
|
||||||
|
return array_filter($data, fn($ep) => isset($ep['action']) && strtolower($ep['action']) === 'play');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user