• R/O
  • SSH
  • HTTPS

jinrousiki: Commit


Commit MetaInfo

Revision2283 (tree)
Time2018-12-07 02:41:03
Authorumethyl

Log Message

RoomDB::ResetVote()

Change Summary

Incremental Difference

--- trunk/include/database/room_db_class.php (revision 2282)
+++ trunk/include/database/room_db_class.php (revision 2283)
@@ -139,15 +139,18 @@
139139 //投票リセット
140140 public static function ResetVote() {
141141 if (DB::$ROOM->IsTest()) return true;
142- if (! self::UpdateVoteCount()) return false;
142+ if (false === self::UpdateVoteCount()) {
143+ return false;
144+ }
143145
144146 //即処理されるタイプの投票イベントはリセット対象外なので投票回数をスライドさせておく
145- if (! DB::$ROOM->IsDate(1)) return true;
146- $query = <<<EOF
147-UPDATE vote SET vote_count = vote_count + 1 WHERE room_no = ? AND date = ? AND type IN (?, ?)
148-EOF;
147+ if (false === DB::$ROOM->IsDate(1)) { //即処理型は1日目のみ
148+ return true;
149+ }
150+ $query = Query::Init()->Table('vote')->Update()->SetData('vote_count', 'vote_count + 1');
151+ $query->Where(['room_no', 'date'])->WhereIn('type', 2);
149152 $list = [DB::$ROOM->id, DB::$ROOM->date, VoteAction::CUPID, VoteAction::DUELIST];
150- DB::Prepare($query, $list);
153+ DB::Prepare($query->Build(), $list);
151154 return DB::FetchBool();
152155 }
153156
Show on old repository browser