From b9aca313fade910254be14f8e25d9a6c41752851 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 28 Aug 2009 11:41:06 -0700 Subject: Fix a couple of off-by-one errors. --- modules/organize/controllers/organize.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'modules/organize/controllers') 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; -- cgit v1.2.3