diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-08-28 11:41:06 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-08-28 11:41:06 -0700 |
commit | b9aca313fade910254be14f8e25d9a6c41752851 (patch) | |
tree | a03ef2faccca28129bbd0bd058584a52317f4f4c | |
parent | 48e84243d24c52638042d3b5edc3cbd3765daac3 (diff) |
Fix a couple of off-by-one errors.
-rw-r--r-- | modules/organize/controllers/organize.php | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index 04f3c0b4..f56ad006 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -191,7 +191,7 @@ class Organize_Controller extends Controller { $album = ORM::factory("item", $task->get("parent_id")); foreach ($album->children() as $child) { // Do this directly in the database to avoid sending notifications - Database::Instance()->update("items", array("weight" => $i++), array("id" => $child->id)); + Database::Instance()->update("items", array("weight" => ++$i), array("id" => $child->id)); } $album->sort_column = "weight"; $album->sort_order = "ASC"; @@ -220,7 +220,8 @@ class Organize_Controller extends Controller { Database::Instance()->query( "UPDATE {items} " . "SET `weight` = `weight` + $count " . - "WHERE `weight` > $target_weight AND `parent_id` = {$parent_id}"); + "WHERE `weight` >= $target_weight AND `parent_id` = {$parent_id}"); + $mode = "insert-source-items"; $task->percent_complete = 80; break; |