commiting all judging files with database line changes/fixes

This commit is contained in:
Muad Sakah 2025-02-07 03:53:28 +00:00
parent 8f05b7e4cb
commit 5776e10151
5 changed files with 29 additions and 33 deletions

View File

@ -105,8 +105,8 @@ if ($id < 1) {
// get their availability
$availabilityText = '';
if ($config['judges_availability_enable'] == 'yes') {
$q = $pdo->prepare("SELECT * FROM judges_availability WHERE users_id=\"?\" ORDER BY `start`");
$q->execute([$judgeinfo['id']]);
$q = $pdo->prepare("SELECT * FROM judges_availability WHERE users_id=? ORDER BY `start`");
$q->execute([$judgeinfo['id']]);
$sel = array();
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
$st = substr($r->start, 0, 5);
@ -131,9 +131,9 @@ if ($judgeinfo['special_award_only'] == 'yes') {
$query = 'SELECT aa.name AS awardname FROM judges_specialaward_sel jss'
. ' JOIN users ON jss.users_id = users.id'
. ' JOIN award_awards aa ON aa.id = jss.award_awards_id'
. ' WHERE users.id=' . $id;
. ' WHERE users.id=?';
$results = $pdo->prepare($query);
$results->execute();
$results->execute([$id]);
while ($record = $results . fetch()) {
$awardList[] = $record['awardname'];
}

View File

@ -725,11 +725,9 @@ function judge_team_create($num, $name)
function judge_team_add_judge($team_id, $users_id)
{
global $config, $judges;
$stmt = $pdo->prepare("INSERT INTO judges_teams_link
\t (users_id,judges_teams_id,captain,year)
\t VALUES (?,?,?,
?)");
$stmt->execute([$users_id,$team_id,$judges[$users_id]['willing_chair'],$config['FAIRYEAR']]);
$stmt = $pdo->prepare("INSERT INTO judges_teams_link (users_id, judges_teams_id, captain, year) VALUES (?, ?, ?, ?)");
$stmt->execute([$users_id, $team_id, $judges[$users_id]['willing_chair'], $config['FAIRYEAR']]);
show_pdo_errors_if_any($pdo);
}
@ -1620,18 +1618,10 @@ for ($k = 0; $k < $keys_count; $k++) {
continue;
/* if jteam_id isn't 0, instert it into the db */
$stmt = $pdo->prepare('INSERT INTO judges_teams_timeslots_link '
. ' (judges_teams_id,judges_timeslots_id,year)'
. " VALUES (?, "
. " ?, "
. " ?)");
$stmt = $pdo->prepare('INSERT INTO judges_teams_timeslots_link (judges_teams_id,judges_timeslots_id,year) VALUES (?,?,?)');
$stmt->execute([$jteam[$jteam_id]['team_id'],$available_timeslots[$y]['id'],$config['FAIRYEAR']]);
$stmt = $pdo->prepare('INSERT INTO judges_teams_timeslots_projects_link '
. ' (judges_teams_id,judges_timeslots_id,projects_id,year) '
. " VALUES (?, "
. " ?, "
. " ?,?)");
$stmt = $pdo->prepare('INSERT INTO judges_teams_timeslots_projects_link (judges_teams_id,judges_timeslots_id,projects_id,year) VALUES (?,?,?,?)');
$stmt->execute([$jteam[$jteam_id]['team_id'],$available_timeslots[$y]['id'],$pid,$config['FAIRYEAR']]);
}
printf("\n");

View File

@ -188,9 +188,15 @@ if ($action == 'savemultiple') {
$tt = $duration + $break;
for ($x = 0; $x < $addnum; $x++) {
$q = $pdo->prepare("SELECT \tDATE_ADD(? ?:?:00', INTERVAL ? MINUTE) AS endtime,
DATE_ADD(? ?:?:00', INTERVAL ? MINUTE) AS startnext ");
$q->execute([$date,$hr,$min,$duration,$date,$hr,$min,$tt]);
$q = $pdo->prepare("SELECT
DATE_ADD(?, INTERVAL ? MINUTE) AS endtime,
DATE_ADD(?, INTERVAL ? MINUTE) AS startnext");
$q->execute([
"$date $hr:$min:00", $duration,
"$date $hr:$min:00", $tt
]);
show_pdo_errors_if_any($pdo);
$r = $q->fetch(PDO::FETCH_OBJ);
list($ed, $et) = split(' ', $r->endtime);

View File

@ -51,9 +51,9 @@ if ($_GET['projectid']) {
$score_error = '*** ERROR **** You entered a value greater than 100.00';
}
$stmt = $pdo->prepare("UPDATE judges_teams_timeslots_projects_link
\t \t\t\t\t\tSET score=?"
. ' WHERE judges_teams_id =?'
. " and projects_id =? and year=?");
SET score=?
WHERE judges_teams_id =?
and projects_id =? and year=?");
$stmt->execute([$score,$_POST['team_' . $curr_team . '_id'],$project_id,$year]);
show_pdo_errors_if_any($pdo);
}

View File

@ -102,14 +102,14 @@ if ($_GET['csv'] != 'yes') {
while ($r = $q->fetch(PDO::FETCH_OBJ)) {
if ($_GET['csv'] == 'yes') {
echo "$r->projectnumber \t ? \t ? \t ? \t ? \t ? ";
$p = $pdo->prepare("SELECT judges_teams_timeslots_projects_link.judges_teams_id,
\t \t\t\t\t score,
\t judges_teams.num
\t FROM judges_teams_timeslots_projects_link,
\t judges_teams
\t WHERE judges_teams_timeslots_projects_link.judges_teams_id = judges_teams.id
\t AND projects_id =? ORDER BY judges_teams_id");
$p->execute([$r->title,$cats[$r->projectcategories_id] ,$divs[$r->projectdivisions_id],$r->score,$r->norm_score,$r->projectid]);
$p = $pdo->prepare("SELECT judges_teams_timeslots_projects_link.judges_teams_id, score, judges_teams.num
FROM judges_teams_timeslots_projects_link, judges_teams
WHERE judges_teams_timeslots_projects_link.judges_teams_id = judges_teams.id
AND projects_id = ?
ORDER BY judges_teams_id");
$p->execute([$r->title, $cats[$r->projectcategories_id], $divs[$r->projectdivisions_id], $r->score, $r->norm_score, $r->projectid]);
show_pdo_errors_if_any($pdo);
while ($s = $p->fetch(PDO::FETCH_OBJ)) {
$team = getJudgingTeam($s->judges_teams_id);