Commit 8f5429a1393ba2344502e7359a09dd9e3a7bf5d0
1 parent
f92ad9bb
Exists in
script_to_update
If this script runs more than once it wont break the search of the block
Showing
1 changed file
with
5 additions
and
3 deletions
Show diff stats
update.rb
... | ... | @@ -11,9 +11,11 @@ softwares.each do |soft| |
11 | 11 | print "." if soft.community.save |
12 | 12 | boxToMove = soft.community.boxes.where(:position => 1).first |
13 | 13 | blockToMove = boxToMove.blocks.where(:type => "SoftwareInformationBlock").first |
14 | - newBox = soft.community.boxes.where(:position => 4).first | |
15 | - blockToMove.box = newBox | |
16 | - print "." if blockToMove.save | |
14 | + if blockToMove | |
15 | + newBox = soft.community.boxes.where(:position => 4).first | |
16 | + blockToMove.box = newBox | |
17 | + print "." if blockToMove.save | |
18 | + end | |
17 | 19 | else |
18 | 20 | soft.destroy |
19 | 21 | end | ... | ... |