瀏覽代碼

quick fix

chemi ledon 7 年之前
父節點
當前提交
37f43b3ed2
共有 1 個文件被更改,包括 14 次插入13 次删除
  1. 14 13
      app/models/product.rb

+ 14 - 13
app/models/product.rb

@@ -472,21 +472,22 @@ class Product < ActiveRecord::Base
     end
     puts 'termine'
   end
-end
 
-def self.gen_barcode_img_for_existing_barcodes
-  products = Product.activos_children
-  counter = 0
-  products.each do |product|
-    if product.barcode?
-      unless File.file?(Rails.public_path.join('barcodes', "#{product.barcode}.png"))
-        save_path = Rails.public_path.join('barcodes', "#{product.barcode}.png")
-        File.open(save_path, 'wb') { |f| f.write Barby::Code39.new(product.barcode).to_png(height: 50, margin: 5) }
-        counter += 1;
+  def self.gen_barcode_img_for_existing_barcodes
+    products = Product.activos_children
+    counter = 0
+    products.each do |product|
+      if product.barcode?
+        unless File.file?(Rails.public_path.join('barcodes', "#{product.barcode}.png"))
+          save_path = Rails.public_path.join('barcodes', "#{product.barcode}.png")
+          File.open(save_path, 'wb') { |f| f.write Barby::Code39.new(product.barcode).to_png(height: 50, margin: 5) }
+          counter += 1;
+        end
+      else
+        puts "***** NO TIENE BARCODE! #{product.id}"
       end
-    else
-      puts "***** NO TIENE BARCODE! #{product.id}"
     end
+    puts "TERMINÉ, generé: #{counter} imagenes de barcode"
   end
-  puts "TERMINÉ, generé: #{counter} imagenes de barcode"
 end
+