diff options
-rw-r--r-- | modules/gallery/models/item.php | 4 | ||||
-rw-r--r-- | modules/gallery/tests/Item_Model_Test.php | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 9735ed62..d27e331b 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -444,11 +444,11 @@ class Item_Model extends ORM_MPTT { $position = $db->from("items") ->where("parent_id", $this->id) - ->where("$sort_column < ", $child->$sort_column) + ->where("$sort_column $comp ", $child->$sort_column) ->where($where) ->count_records(); - // We stopped short of our target value in the sort (notice that we're using a < comparator + // We stopped short of our target value in the sort (notice that we're using a < comparator // above) because it's possible that we have duplicate values in the sort column. An // equality check would just arbitrarily pick one of those multiple possible equivalent // columns, which would mean that if you choose a sort order that has duplicates, it'd pick diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index fefc9383..e7dce893 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -232,6 +232,7 @@ class Item_Model_Test extends Unit_Test_Case { $this->assert_equal("resize", file_get_contents($photo->resize_path())); $this->assert_equal("file", file_get_contents($photo->file_path())); } + public function move_album_fails_invalid_target_test() { // Create an album with a photo in it $root = ORM::factory("item", 1); |