Merge branch 'main' into dev-redis

This commit is contained in:
2025-05-01 20:41:26 -05:00
2 changed files with 5 additions and 2 deletions

View File

@@ -18,13 +18,15 @@ export default class extends Controller {
static targets = ['list'] static targets = ['list']
options = [] options = []
optionsLoaded = false
async connect() { async connect() {
await this.setOptions(); await this.setOptions();
} }
async setOptions() { async setOptions() {
if (this.options.length === 0) { if (false === this.optionsLoaded) {
this.optionsLoaded = true;
await fetch(`/torrentio/movies/${this.tmdbIdValue}/${this.imdbIdValue}`) await fetch(`/torrentio/movies/${this.tmdbIdValue}/${this.imdbIdValue}`)
.then(res => res.text()) .then(res => res.text())
.then(response => { .then(response => {

View File

@@ -41,7 +41,7 @@ class DownloadRepository extends ServiceEntityRepository
$firstResult = ($pageNumber - 1) * $perPage; $firstResult = ($pageNumber - 1) * $perPage;
$query = $this->createQueryBuilder('d') $query = $this->createQueryBuilder('d')
->andWhere('d.status IN (:statuses)') ->andWhere('d.status IN (:statuses)')
->orderBy('d.id', 'DESC') ->orderBy('d.id', 'ASC')
->setParameter('statuses', ['New', 'In Progress']) ->setParameter('statuses', ['New', 'In Progress'])
->setFirstResult($firstResult) ->setFirstResult($firstResult)
->setMaxResults($perPage) ->setMaxResults($perPage)
@@ -66,6 +66,7 @@ class DownloadRepository extends ServiceEntityRepository
->setImdbId($imdbId) ->setImdbId($imdbId)
->setMediaType($mediaType) ->setMediaType($mediaType)
->setBatchId($batchId) ->setBatchId($batchId)
->setProgress(0)
->setStatus($status); ->setStatus($status);
$this->getEntityManager()->persist($download); $this->getEntityManager()->persist($download);