From e93dd774a5c8338b6c29b8b39b6d883925b9ac61 Mon Sep 17 00:00:00 2001 From: msquare Date: Wed, 19 Jul 2017 21:28:26 +0200 Subject: fix small issues on checking success of a db query --- includes/model/EventConfig_model.php | 2 +- src/Database/Db.php | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/model/EventConfig_model.php b/includes/model/EventConfig_model.php index f5846870..112ad457 100644 --- a/includes/model/EventConfig_model.php +++ b/includes/model/EventConfig_model.php @@ -64,7 +64,7 @@ function EventConfig_update( ); } - return (bool)DB::update(' + return DB::update(' UPDATE `EventConfig` SET `event_name` = ?, `buildup_start_date` = ?, diff --git a/src/Database/Db.php b/src/Database/Db.php index c1efa058..4116ffda 100644 --- a/src/Database/Db.php +++ b/src/Database/Db.php @@ -81,31 +81,31 @@ class Db } /** - * Run a insert query + * Run an insert query * * @param string $query * @param array $bindings - * @return bool + * @return int|bool */ public static function insert($query, array $bindings = []) { self::query($query, $bindings); - return self::$lastStatus; + return (self::$lastStatus ? self::$stm->rowCount() : false); } /** - * Run a update query + * Run an update query * * @param string $query * @param array $bindings - * @return int|null + * @return int|bool */ public static function update($query, array $bindings = []) { self::query($query, $bindings); - return (self::$lastStatus ? self::$stm->rowCount() : null); + return (self::$lastStatus ? self::$stm->rowCount() : false); } /** @@ -113,13 +113,13 @@ class Db * * @param string $query * @param array $bindings - * @return int|null + * @return int|bool */ public static function delete($query, array $bindings = []) { self::query($query, $bindings); - return (self::$lastStatus ? self::$stm->rowCount() : null); + return (self::$lastStatus ? self::$stm->rowCount() : false); } /** -- cgit v1.2.3-54-g00ecf From 903a1f97902414fd2b5028726ee3a864e405f11a Mon Sep 17 00:00:00 2001 From: msquare Date: Wed, 19 Jul 2017 21:30:18 +0200 Subject: remove 24h shift filter time range limit --- includes/model/ShiftsFilter.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/includes/model/ShiftsFilter.php b/includes/model/ShiftsFilter.php index 47ef50d7..3b691b55 100644 --- a/includes/model/ShiftsFilter.php +++ b/includes/model/ShiftsFilter.php @@ -9,12 +9,6 @@ namespace Engelsystem; */ class ShiftsFilter { - /** - * How long can the time interval be? - * 86400 = one day - */ - const MAX_DURATION = 86400; - /** * Shift is completely full. */ @@ -98,9 +92,6 @@ class ShiftsFilter */ public function setEndTime($endTime) { - if ($endTime - $this->startTime > ShiftsFilter::MAX_DURATION) { - $endTime = $this->startTime + ShiftsFilter::MAX_DURATION; - } $this->endTime = $endTime; } -- cgit v1.2.3-54-g00ecf From 8ae01236353dad099e98f555fdf9cbfbf5cdca6a Mon Sep 17 00:00:00 2001 From: msquare Date: Wed, 19 Jul 2017 21:32:42 +0200 Subject: unarrived angels can enter a shift (has been disabled for 33c3) --- includes/model/Shifts_model.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php index b0269362..21abc888 100644 --- a/includes/model/Shifts_model.php +++ b/includes/model/Shifts_model.php @@ -266,10 +266,6 @@ function Shift_signup_allowed_angel( ) { $free_entries = Shift_free_entries($needed_angeltype, $shift_entries); - if ($user['Gekommen'] == 0) { - return new ShiftSignupState(ShiftSignupState::SHIFT_ENDED, $free_entries); - } - if ($user_shifts == null) { $user_shifts = Shifts_by_user($user); } -- cgit v1.2.3-54-g00ecf From 9b3f6f557a127fef16be267c26f8239dc1c22126 Mon Sep 17 00:00:00 2001 From: msquare Date: Wed, 19 Jul 2017 21:49:04 +0200 Subject: update tests to work with phpunit version installed by composer --- phpunit.xml | 3 ++- test/model/LogEntriesModelTest.php | 8 +++++--- test/model/RoomModelTest.php | 14 ++++++++------ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 29bfdba5..b868096c 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -16,7 +16,8 @@ ./include/ ./public/ - + ./src/ + diff --git a/test/model/LogEntriesModelTest.php b/test/model/LogEntriesModelTest.php index 4da6fd4b..25d46fc4 100644 --- a/test/model/LogEntriesModelTest.php +++ b/test/model/LogEntriesModelTest.php @@ -1,9 +1,11 @@ assertNotFalse(LogEntry_create('test', 'test_LogEntry_create')); - + // There should be one more log entry now $this->assertEquals(count(LogEntries()), $count + 1); } diff --git a/test/model/RoomModelTest.php b/test/model/RoomModelTest.php index 9c91939d..135a6108 100644 --- a/test/model/RoomModelTest.php +++ b/test/model/RoomModelTest.php @@ -1,9 +1,11 @@ create_Room(); - + $room = Room($this->room_id); - + $this->assertNotFalse($room); $this->assertNotNull($room); $this->assertEquals($room['Name'], 'test'); - - $this->assertNull(Room(-1)); + + $this->assertNull(Room(- 1)); } /** -- cgit v1.2.3-54-g00ecf