Summit Attendees List
* fixed orders Change-Id: I870feac1b1a6adc9593d0c52caecad6e5f8bd8ec Signed-off-by: smarcet <smarcet@gmail.com>
This commit is contained in:
parent
89cd16e565
commit
ccc7f090a0
@ -15,6 +15,7 @@
|
||||
use App\Http\Utils\EpochCellFormatter;
|
||||
use App\Jobs\Emails\InviteAttendeeTicketEditionMail;
|
||||
use App\Jobs\Emails\SummitAttendeeTicketRegenerateHashEmail;
|
||||
use App\Jobs\SynchAllAttendeesStatus;
|
||||
use App\ModelSerializers\SerializerUtils;
|
||||
use App\Services\Model\IAttendeeService;
|
||||
use App\Services\Model\ISummitOrderService;
|
||||
@ -350,6 +351,8 @@ final class OAuth2SummitAttendeesApiController extends OAuth2ProtectedController
|
||||
$summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id);
|
||||
if (is_null($summit)) return $this->error404();
|
||||
|
||||
SynchAllAttendeesStatus::dispatch($summit->getId());
|
||||
|
||||
return $this->_getAll(
|
||||
function () {
|
||||
return [
|
||||
|
70
app/Jobs/SynchAllAttendeesStatus.php
Normal file
70
app/Jobs/SynchAllAttendeesStatus.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php namespace App\Jobs;
|
||||
/**
|
||||
* Copyright 2021 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use libs\utils\ITransactionService;
|
||||
use models\exceptions\EntityNotFoundException;
|
||||
use models\summit\ISummitRepository;
|
||||
|
||||
/**
|
||||
* Class SynchAllAttendeesStatus
|
||||
* @package App\Jobs
|
||||
*/
|
||||
class SynchAllAttendeesStatus implements ShouldQueue
|
||||
{
|
||||
public $tries = 2;
|
||||
|
||||
public $timeout = PHP_INT_MAX;
|
||||
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $summit_id;
|
||||
|
||||
/**
|
||||
* SynchAllPresentationActions constructor.
|
||||
* @param int $summit_id
|
||||
*/
|
||||
public function __construct(int $summit_id)
|
||||
{
|
||||
$this->summit_id = $summit_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ISummitRepository $repository
|
||||
* @param ITransactionService $tx_service
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function handle(
|
||||
ISummitRepository $repository,
|
||||
ITransactionService $tx_service
|
||||
)
|
||||
{
|
||||
Log::debug(sprintf("SynchAllAttendeesStatus::handle summit %s", $this->summit_id));
|
||||
$tx_service->transaction(function() use($repository){
|
||||
$summit = $repository->getById($this->summit_id);
|
||||
if(is_null($summit))
|
||||
throw new EntityNotFoundException(sprintf("Summit %s not found", $this->summit_id));
|
||||
|
||||
$summit->synchAllAttendeesStatus();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -5312,6 +5312,12 @@ SQL;
|
||||
}
|
||||
}
|
||||
|
||||
public function synchAllAttendeesStatus():void{
|
||||
foreach($this->attendees as $attendee){
|
||||
$attendee->updateStatus();
|
||||
}
|
||||
}
|
||||
|
||||
public function synchPresentationAction(Presentation $presentation):void{
|
||||
$presentation->initializeActions();
|
||||
}
|
||||
|
@ -118,6 +118,9 @@ final class DoctrineSummitAttendeeRepository
|
||||
'company' => 'e.company_name',
|
||||
'member_id' => 'm.id',
|
||||
'status' => 'e.status',
|
||||
'email' => <<<SQL
|
||||
COALESCE(LOWER(m.email), LOWER(e.email))
|
||||
SQL
|
||||
];
|
||||
}
|
||||
|
||||
@ -138,6 +141,7 @@ final class DoctrineSummitAttendeeRepository
|
||||
*/
|
||||
public function getBySummit(Summit $summit, PagingInfo $paging_info, Filter $filter = null, Order $order = null)
|
||||
{
|
||||
|
||||
$query = $this->getEntityManager()
|
||||
->createQueryBuilder()
|
||||
->select("e")
|
||||
@ -150,7 +154,6 @@ final class DoctrineSummitAttendeeRepository
|
||||
$query->setParameter("summit_id", $summit->getId());
|
||||
|
||||
if(!is_null($filter)){
|
||||
|
||||
$filter->apply2Query($query, $this->getFilterMappings());
|
||||
}
|
||||
|
||||
@ -166,12 +169,12 @@ final class DoctrineSummitAttendeeRepository
|
||||
->setFirstResult($paging_info->getOffset())
|
||||
->setMaxResults($paging_info->getPerPage());
|
||||
|
||||
$paginator = new Paginator($query, $fetchJoinCollection = true);
|
||||
$total = $paginator->count();
|
||||
$data = array();
|
||||
|
||||
$paginator = new Paginator($query);
|
||||
$data = [];
|
||||
foreach($paginator as $entity)
|
||||
array_push($data, $entity);
|
||||
$data[] = $entity;
|
||||
|
||||
$total = $paginator->count();
|
||||
|
||||
return new PagingResponse
|
||||
(
|
||||
@ -278,4 +281,5 @@ final class DoctrineSummitAttendeeRepository
|
||||
|
||||
return $query->getQuery()->getOneOrNullResult();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user