You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

48 lines
1.2 KiB

<?php
use App\Enumerators\SessionElement;
use App\Wrappers\DatabaseInteractions;
use App\Wrappers\SessionWrapper;
use App\Wrappers\SQLQueryBuilderWrapper;
use App\Wrappers\TwigWrapper;
require_once __DIR__ . "/../../vendor/autoload.php";
$db = new DatabaseInteractions();
$danceDetails = $db->RunOneSelect(
queryBuilder: SQLQueryBuilderWrapper::SELECT_ONE(
table: 'Dances',
id: $_GET["dance-id"]
)
->cols(cols: [
'SUM(CASE WHEN T_DR.Rating = 1 THEN 1 ELSE 0 END) AS Likes',
'SUM(CASE WHEN T_DR.Rating = -1 THEN 1 ELSE 0 END) AS Dislikes',
])
->join(
join: 'LEFT',
spec: 'DanceRatings AS T_DR',
cond: 'T.ID=T_DR.DanceID',
)
);
$danceSteps = $db->RunSelect(
queryBuilder: SQLQueryBuilderWrapper::SELECT(
table: 'DanceSteps'
)
->where(cond: 'T.DanceID=:__dance_id__')
->orderBy(spec: [
'T.BarCountAtStart ASC',
])
->bindValue(name: '__dance_id__', value: $_GET["dance-id"])
);
TwigWrapper::RenderTwig(
target: "Pages/dance/uuid.html.twig",
arguments: [
"DanceDetails"=>$danceDetails,
"DanceSteps"=>$danceSteps,
]
);