# HG changeset patch # User Matti Hamalainen # Date 1416333641 -7200 # Node ID bf33cec02dc62f169c10171b7bd2c7793205c8ef # Parent 69a829f687a9ddbccd904b3e0c679ba428999c8c Cleanups. diff -r 69a829f687a9 -r bf33cec02dc6 usrajax.php --- a/usrajax.php Tue Nov 18 19:19:10 2014 +0200 +++ b/usrajax.php Tue Nov 18 20:00:41 2014 +0200 @@ -90,9 +90,7 @@ // Check if the compo is valid for the entry $sql = stPrepareSQL("SELECT * FROM compos WHERE id=%d", $entry["compo_id"]); if (($compo = stFetchSQL($sql)) !== false && $compo["voting"] != 0) - { stUpdateVote($voteKeyId, $entry_id, $vote); - } } stDBCommitTransaction(); } @@ -103,21 +101,19 @@ stError("Voting is not enabled."); else { - stDBBeginTransaction(); foreach (stExecSQL("SELECT * FROM compos WHERE visible<>0 AND voting<>0") as $compo) { - $cid = $compo["id"]; - foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$cid) as $entry) + stDBBeginTransaction(); + foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$compo["id"]) as $entry) { $value = stGetRequestItem("ventry".$entry["id"], 0); if (!stUpdateVote($voteKeyId, $entry["id"], $value)) { - stError("Could not set vote for compo #".$cid.", entry #".$entry["id"]); - break; + stError("Could not set vote for compo #".$compo["id"].", entry #".$entry["id"]); } } + stDBCommitTransaction(); } - stDBCommitTransaction(); if ($errorSet) {