Skip to content

Commit

Permalink
Going through reverse order in console's foreach in case we destroy n…
Browse files Browse the repository at this point in the history
…odes.
  • Loading branch information
gaspard committed Jun 27, 2012
1 parent d73787c commit e47d4f1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions History.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* Removing evaluated strings if copy_id is blank.
* Exporting relations by class name instead of kpath (may differ from site to site).
* Using any character to build kpath if no character from the class name can be used.
* Going through reverse order in console's foreach in case we destroy nodes.

== 1.2.0, 1.2.1 2012-05-01

Expand Down
4 changes: 3 additions & 1 deletion lib/zena/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ def foreach(pseudo_sql, opts = {})
page_count = (count.to_f / limit).ceil
puts "#{count} nodes, #{page_count} chunk(s) (100 items)"
curr_page = 1
for curr_page in (1..page_count)
# We walk pages in reverse order in case objects are deleted

for curr_page in (1..page_count).to_a.reverse
query.offset = " OFFSET #{limit * (curr_page - 1)}"
if list = Node.do_find(:all, eval(query.to_s(:find)))
puts "Page #{curr_page}/#{page_count}"
Expand Down

0 comments on commit e47d4f1

Please sign in to comment.