Introduced group_order_article.result to save the result for each group/article.

This commit is contained in:
Benjamin Meichsner 2009-02-04 16:41:01 +01:00
parent 6fd5d825f9
commit 251ced4fa1
27 changed files with 106 additions and 137 deletions

View file

@ -111,10 +111,10 @@ class Finance::BalancingController < ApplicationController
end
def new_group_order_article
group_order_article = OrderArticle.find(params[:id]).group_order_articles.build
goa = OrderArticle.find(params[:id]).group_order_articles.build
render :update do |page|
page["edit_box"].replace_html :partial => "new_group_order_article",
:locals => {:group_order_article => group_order_article}
:locals => {:group_order_article => goa}
page["edit_box"].show
end
end
@ -185,7 +185,6 @@ class Finance::BalancingController < ApplicationController
page["edit_box"].hide
page["group_order_articles_#{goa.order_article.id}"].replace_html :partial => 'group_order_articles',
:locals => {:order_article => goa.order_article}
page["group_order_article_#{goa.id}"].visual_effect :highlight, :duration => 2
page["summary"].replace_html :partial => 'summary', :locals => {:order => goa.order_article.order}
page["order_profit"].visual_effect :highlight, :duration => 2
end

View file

@ -71,7 +71,7 @@ class Finance::TransactionsController < ApplicationController
amount = params[:financial_transaction][:amount]
note = params[:financial_transaction][:note]
begin
@group.addFinancialTransaction(amount, note, @current_user)
@group.add_financial_transaction(amount, note, @current_user)
flash[:notice] = 'Transaktion erfolgreich angelegt.'
redirect_to :action => 'index'
rescue => e
@ -90,7 +90,7 @@ class Finance::TransactionsController < ApplicationController
params[:financial_transactions].each do |trans|
# ignore empty amount fields ...
unless trans[:amount].blank?
Ordergroup.find(trans[:ordergroup_id]).addFinancialTransaction trans[:amount], note, @current_user
Ordergroup.find(trans[:ordergroup_id]).add_financial_transaction trans[:amount], note, @current_user
end
end
flash[:notice] = 'Saved all transactions successfully'

View file

@ -16,18 +16,19 @@ class OrderingController < ApplicationController
@open_orders = Order.open
@other_orders = @open_orders.reject{|order| order == @order}
# Load order article data...
@articles_by_category = @order.get_articles
@articles_grouped_by_category = @order.articles_grouped_by_category
# save results of earlier orders in array
ordered_articles = Array.new
@group_order = @order.group_orders.find(:first, :conditions => "ordergroup_id = #{@ordergroup.id}", :include => :group_order_articles)
@group_order = @order.group_orders.find(:first,
:conditions => "ordergroup_id = #{@ordergroup.id}", :include => :group_order_articles)
if @group_order
# Group has already ordered, so get the results...
for article in @group_order.group_order_articles
result = article.result
ordered_articles[article.order_article_id] = {'quantity' => article.quantity,
'tolerance' => article.tolerance,
'quantity_result' => result[:quantity],
'tolerance_result' => result[:tolerance]}
for goa in @group_order.group_order_articles
ordered_articles[goa.order_article_id] = {:quantity => goa.quantity,
:tolerance => goa.tolerance,
:quantity_result => goa.result(:quantity),
:tolerance_result => goa.result(:tolerance)}
end
@version = @group_order.lock_version
@availableFunds = @ordergroup.get_available_funds(@group_order)
@ -41,19 +42,19 @@ class OrderingController < ApplicationController
@others_quantity = Array.new; @quantity = Array.new; @quantity_result = Array.new; @used_quantity = Array.new; @unused_quantity = Array.new
@others_tolerance = Array.new; @tolerance = Array.new; @tolerance_result = Array.new; @used_tolerance = Array.new; @unused_tolerance = Array.new
i = 0;
@articles_by_category.each do |category_name, order_articles|
@articles_grouped_by_category.each do |category_name, order_articles|
for order_article in order_articles
# price/unit size
@price[i] = order_article.article.fc_price
@unit[i] = order_article.article.unit_quantity
# quantity
@quantity[i] = (ordered_articles[order_article.id] ? ordered_articles[order_article.id]['quantity'] : 0)
@quantity[i] = (ordered_articles[order_article.id] ? ordered_articles[order_article.id][:quantity] : 0)
@others_quantity[i] = order_article.quantity - @quantity[i]
@used_quantity[i] = (ordered_articles[order_article.id] ? ordered_articles[order_article.id]['quantity_result'] : 0)
@used_quantity[i] = (ordered_articles[order_article.id] ? ordered_articles[order_article.id][:quantity_result] : 0)
# tolerance
@tolerance[i] = (ordered_articles[order_article.id] ? ordered_articles[order_article.id]['tolerance'] : 0)
@tolerance[i] = (ordered_articles[order_article.id] ? ordered_articles[order_article.id][:tolerance] : 0)
@others_tolerance[i] = order_article.tolerance - @tolerance[i]
@used_tolerance[i] = (ordered_articles[order_article.id] ? ordered_articles[order_article.id]['tolerance_result'] : 0)
@used_tolerance[i] = (ordered_articles[order_article.id] ? ordered_articles[order_article.id][:tolerance_result] : 0)
i += 1
end
end
@ -90,8 +91,8 @@ class OrderingController < ApplicationController
end
# Get ordered quantities and update group_order_articles/_quantities...
quantities = ordered.fetch(order_article.id.to_s, {'quantity' => 0, 'tolerance' => 0})
group_order_article.update_quantities(quantities['quantity'].to_i, quantities['tolerance'].to_i)
quantities = ordered.fetch(order_article.id.to_s, {:quantity => 0, :tolerance => 0})
group_order_article.update_quantities(quantities[:quantity].to_i, quantities[:tolerance].to_i)
# Also update results for the order_article
order_article.update_results!

View file

@ -55,7 +55,7 @@ class OrdersController < ApplicationController
def new
@supplier = Supplier.find(params[:supplier_id])
@order = @supplier.orders.build :ends => 4.days.from_now
@template_orders = @supplier.orders.finished :order => 'starts DESC', :include => "order_article_results"
@template_orders = @supplier.orders.finished :order => 'starts DESC', :limit => 5
end
# Save a new order.

View file

@ -34,6 +34,7 @@ class Article < ActiveRecord::Base
has_many :article_prices, :order => "created_at"
named_scope :in_stock, :conditions => "quantity > 0", :order => 'suppliers.name', :include => :supplier
named_scope :available, :conditions => {:availability => true}
# Validations
validates_presence_of :name, :unit, :price, :tax, :deposit, :unit_quantity, :supplier_id, :article_category_id
@ -171,24 +172,6 @@ class Article < ActiveRecord::Base
end
end
# Returns Articles in a nested Array, grouped by category and ordered by article name.
# The array has the following form:
# e.g: [["drugs",[teethpaste, toiletpaper]], ["fruits" => [apple, banana, lemon]]]
# TODO: force article to belong to a category and remove this complicated implementation!
def self.group_by_category(articles)
articles_by_category = {}
ArticleCategory.find(:all).each do |category|
articles_by_category.merge!(category.name.to_s => articles.select {|article| article.article_category and article.article_category.id == category.id })
end
# add articles without a category
articles_by_category.merge!( "--" => articles.select {|article| article.article_category == nil})
# return "clean" hash, sorted by category.name
return articles_by_category.reject {|category, array| array.empty?}.sort
# it could be so easy ... but that doesn't work for empty category-ids...
# articles.group_by {|a| a.article_category}.sort {|a, b| a[0].name <=> b[0].name}
end
def update_quantity(amount)
update_attribute :quantity, quantity + amount
end
@ -203,7 +186,7 @@ class Article < ActiveRecord::Base
# Create an ArticlePrice, when the price-attr are changed.
def update_price_history
if price_changed?
article_prices.create(
article_prices.build(
:price => price,
:tax => tax,
:deposit => deposit,

View file

@ -30,7 +30,7 @@ class GroupOrderArticle < ActiveRecord::Base
attr_accessor :ordergroup_id # To create an new GroupOrder if neccessary
named_scope :ordered, :conditions => 'quantity_result > 0 OR tolerance_result > 0'
named_scope :ordered, :conditions => 'result > 0'
# Updates the quantity/tolerance for this GroupOrderArticle by updating both GroupOrderArticle properties
# and the associated GroupOrderArticleQuantities chronologically.
@ -155,18 +155,14 @@ class GroupOrderArticle < ActiveRecord::Base
# Returns order result,
# either calcualted on the fly or fetched from quantity_/tolerance_result
def result
if quantity_result.nil?
calculate_result
else
{:quantity => quantity_result, :tolerance => tolerance_result, :total => quantity_result + tolerance_result}
end
# After an order is finished, there is only the result
def result(type = :total)
self[:result] || calculate_result[type]
end
# This is used when finishing the order.
# This is used during order.finish!.
def save_results!
self.quantity_result = calculate_result[:quantity]
self.tolerance_result = calculate_result[:tolerance]
save!
self.update_attribute(:result, calculate_result[:total])
end
end

View file

@ -76,12 +76,18 @@ class Order < ActiveRecord::Base
# Returns OrderArticles in a nested Array, grouped by category and ordered by article name.
# The array has the following form:
# e.g: [["drugs",[teethpaste, toiletpaper]], ["fruits" => [apple, banana, lemon]]]
def get_articles
def articles_grouped_by_category
order_articles.all(:include => [:article, :article_price], :order => 'articles.name').group_by { |a|
a.article.article_category.name
}.sort { |a, b| a[0] <=> b[0] }
end
memoize :get_articles
memoize :articles_grouped_by_category
def articles_sort_by_category
order_articles.all(:include => [:article], :order => 'articles.name').sort do |a,b|
a.article.article_category.name <=> b.article.article_category.name
end
end
# Returns the defecit/benefit for the foodcoop
# Requires a valid invoice, belonging to this order
@ -117,9 +123,9 @@ class Order < ActiveRecord::Base
for goa in go.group_order_articles
case type
when :groups
total += goa.quantity * goa.order_article.price.fc_price
total += goa.result * goa.order_article.price.fc_price
when :groups_without_markup
total += goa.quantity * goa.order_article.price.gross_price
total += goa.result * goa.order_article.price.gross_price
end
end
end
@ -165,7 +171,7 @@ class Order < ActiveRecord::Base
transaction do # Start updating account balances
for group_order in gos
price = group_order.price * -1 # decrease! account balance
group_order.ordergroup.addFinancialTransaction(price, transaction_note, user)
group_order.ordergroup.add_financial_transaction(price, transaction_note, user)
end
self.update_attributes! :state => 'closed', :updated_by => user
end

View file

@ -43,11 +43,12 @@ class OrderArticle < ActiveRecord::Base
# Count quantities of belonging group_orders.
# In balancing this can differ from ordered (by supplier) quantity for this article.
def group_orders_sum
quantity = group_order_articles.collect(&:quantity).sum
quantity = group_order_articles.collect(&:result).sum
{:quantity => quantity, :price => quantity * price.fc_price}
end
# Update quantity/tolerance/units_to_order from group_order_articles
# This is only used in opened orders.
def update_results!
quantity = group_order_articles.collect(&:quantity).sum
tolerance = group_order_articles.collect(&:tolerance).sum
@ -80,6 +81,10 @@ class OrderArticle < ActiveRecord::Base
units += ((remainder > 0) && (remainder + tolerance >= unit_size) ? 1 : 0)
end
def ordered_quantities_equal_to_group_orders?
(units_to_order * price.unit_quantity) == group_orders_sum[:quantity]
end
private
def article_and_price_exist

View file

@ -65,50 +65,22 @@ class Ordergroup < Group
# Creates a new FinancialTransaction for this Ordergroup and updates the account_balance accordingly.
# Throws an exception if it fails.
def addFinancialTransaction(amount, note, user)
def add_financial_transaction(amount, note, user)
transaction do
trans = FinancialTransaction.new(:ordergroup => self, :amount => amount, :note => note, :user => user)
trans.save!
self.account_balance += trans.amount
self.account_updated = trans.created_on
save!
notifyNegativeBalance(trans)
notify_negative_balance(trans)
end
end
# Returns all GroupOrders by this group that are currently running.
def findCurrent
group_orders.find(:all, :conditions => ["orders.finished = ? AND orders.starts < ? AND (orders.ends IS NULL OR orders.ends > ?)", false, Time.now, Time.now], :include => :order)
end
#find expired (lapsed) but not manually finished orders
def findExpiredOrders
group_orders.find(:all, :conditions => ["orders.ends < ?", Time.now], :include => :order, :order => 'orders.ends DESC')
end
# Returns all GroupOrderResults by this group that are finished but not booked yet.
def findFinishedNotBooked
GroupOrderResult.find(:all,
:conditions => ["group_order_results.group_name = ? AND group_order_results.order_id = orders.id AND orders.finished = ? AND orders.booked = ? ", self.name, true, false],
:include => :order,
:order => 'orders.ends DESC')
end
# Returns all GroupOrderResults for booked orders
def findBookedOrders(limit = false, offset = 0)
GroupOrderResult.find(:all,
:conditions => ["group_order_results.group_name = ? AND group_order_results.order_id = orders.id AND orders.finished = ? AND orders.booked = ? ", self.name, true, true],
:include => :order,
:order => "orders.ends DESC",
:limit => limit,
:offset => offset)
end
private
private
# If this order group's account balance is made negative by the given/last transaction,
# a message is sent to all users who have enabled notification.
def notifyNegativeBalance(transaction)
def notify_negative_balance(transaction)
# Notify only when order group had a positive balance before the last transaction:
if (transaction.amount < 0 && self.account_balance < 0 && self.account_balance - transaction.amount >= 0)
users = self.users.reject { |u| u.settings["notify.negativeBalance"] != '1' }

View file

@ -24,7 +24,8 @@
class Supplier < ActiveRecord::Base
acts_as_paranoid # Avoid deleting the supplier for consistency of order-results
has_many :articles, :dependent => :destroy
has_many :articles, :dependent => :destroy,
:include => [:article_category], :order => 'article_categories.name, articles.name'
has_many :orders
has_many :deliveries
has_many :invoices
@ -40,10 +41,9 @@ class Supplier < ActiveRecord::Base
# for the sharedLists-App
belongs_to :shared_supplier
# Returns all articles for this supplier that are available and have a valid price, grouped by article category and ordered by name.
def getArticlesAvailableForOrdering
articles = Article.find(:all, :conditions => ['supplier_id = ? AND availability = ?', self.id, true], :order => 'article_categories.name, articles.name', :include => :article_category)
articles.select {|article| article.fc_price}
# Returns all articles for this supplier that are available, grouped by article category and ordered by name.
def get_articles_for_ordering
articles.available.all.group_by { |a| a.article_category.name }
end
# sync all articles with the external database
@ -52,7 +52,7 @@ class Supplier < ActiveRecord::Base
def sync_all
updated_articles = Array.new
outlisted_articles = Array.new
for article in articles.find(:all, :order => "article_categories.name", :include => :article_category)
for article in articles
# try to find the associated shared_article
shared_article = article.shared_article
if shared_article

View file

@ -15,7 +15,7 @@
(Einheit:
= group_order_article.order_article.article.unit
)
= form.text_field :quantity, :size => "6"
= form.text_field :result, :size => "6"
= submit_tag "Speichern"
|
= link_to_function 'Abbrechen', "Element.hide('edit_box')"

View file

@ -16,5 +16,5 @@
%th Pfand
%th{:colspan => "2"}
%tbody#result_table
- for order_article in @order.order_articles.all(:include => [:article, :article_price])
- for order_article in @order.order_articles.ordered.all(:include => [:article, :article_price])
= render :partial => "order_article_result", :locals => {:order_article => order_article}

View file

@ -15,7 +15,7 @@
%td{:style=>"width:50%"}
= group_order_article.group_order.ordergroup.name
%td{:id => "group_order_article_#{group_order_article.id}_quantity"}
= group_order_article.quantity
= group_order_article.result
%td.currency
= number_to_currency(group_order_article.order_article.price.fc_price * group_order_article.quantity, :unit => "")
%td.actions{:style=>"width:1em"}

View file

@ -6,11 +6,11 @@
= form.error_messages
%p
Gruppe:
= form.select :ordergroup_id, Ordergroup.all(:order => "name").collect {|og| [og.name, og.id] }
= form.select :ordergroup_id, Ordergroup.all(:order => "name").collect{ |og| [og.name, og.id] }
%p
Menge:
= form.text_field "quantity", :size => 5
= form.hidden_field "order_article_id"
= form.text_field :result, :size => 5
= form.hidden_field :order_article_id
%p
= submit_tag "Speichern"
|

View file

@ -3,7 +3,10 @@
"Element.toggle('group_order_articles_#{order_article.id}'); |
Element.toggleClassName(this.up('td'), 'open')" |
%td= order_article.article.order_number
%td= order_article.units_to_order
%td
= order_article.units_to_order
- unless order_article.ordered_quantities_equal_to_group_orders?
%span{:style => "color:red;font-weight: bold"} !
%td= order_article.price.unit_quantity.to_s + ' * ' + order_article.article.unit.to_s
%td= number_to_currency(order_article.price.price, :unit => "")
%td= number_to_currency(order_article.price.fc_price, :unit => "")

View file

@ -62,11 +62,11 @@
%th
%abbr{:title => "Menge + Toleranz"} Bestellt
%th
%abbr{:title => "Unter Berücksichtigung der anderen Gruppen"} Zugeteilt
%abbr{:title => "Unter Berücksichtigung der anderen Gruppen"} Bekommen
%th Gesamtpreis
%tbody
- total = 0 #set counter for order-sum
- for category_name, order_articles in @order.get_articles
- for category_name, order_articles in @order.articles_grouped_by_category
%tr{:style => "background-color:#EFEFEF"}
%td{:style => "text-align:left;"}=h category_name
%td{:colspan => "9"}
@ -76,8 +76,11 @@
- if goa
- quantity = goa.quantity
- tolerance = goa.tolerance
- result = goa.result[:total]
- sub_total = oa.price.fc_price * (quantity + tolerance)
- result = goa.result
- if @order.open?
- sub_total = oa.price.fc_price * (quantity + tolerance)
- else
- sub_total = oa.price.fc_price * result
- else
- quantity, tolerance, result, sub_total = 0, 0, 0, 0
- total += sub_total

View file

@ -82,7 +82,7 @@
<%-
total = 0
i = 0
@articles_by_category.each do |category, order_articles|
@articles_grouped_by_category.each do |category, order_articles|
-%>
<tr style="background-color:#EFEFEF">
<td style="text-align:left"><b><%=h category %></b></td>

View file

@ -6,7 +6,7 @@
%th Bestellte Einheiten
%th Volle Gebinde
- total_net, total_gross, counter = 0, 0, 0
- order.get_articles.each do |category_name, order_articles|
- order.articles_grouped_by_category.each do |category_name, order_articles|
%tr{:style => "background-color:#EFEFEF"}
%td{:style => "text-align:left; color: grey;"}=h category_name
%td{:colspan => "9"}

View file

@ -31,7 +31,7 @@
%option{:value => "-1", :selected => "selected"}=_ "Choose an order..."
- i = -1
- for order in @template_orders
%option{:value => (i += 1)}=h order.supplier.name
%option{:value => (i += 1)}= "#{h(order.supplier.name)} bis #{order.ends.strftime('%d. %b')}"
%table.list
%tr
%th= check_box_tag 'checkall', "1", false, { :onclick => "checkUncheckAll(this)" }
@ -41,11 +41,11 @@
%th=_ "Manufacturer"
%th=_ "Unit quantity"
%th=_ "Price"
- for category, articles in Article.group_by_category(@order.supplier.getArticlesAvailableForOrdering)
- for category_name, articles in @order.supplier.get_articles_for_ordering
%tr{:style => "background-color:#EFEFEF"}
%td
%td{:colspan => "6", :style => "text-align:left"}
%b=h category
%b=h category_name
- for article in articles
/ check if the article is selected
- included = @order.order_articles.detect { |order_article| order_article.article_id == article.id }

View file

@ -2,17 +2,19 @@
//<![CDATA[
// Preset selected order articles per template order:
var template = new Array();
<% current_article_ids = @order.supplier.articles.available.map(&:id) -%>
<% i = -1; for order in @template_orders -%>
template[<%= i += 1 %>] = new Array(<%= @order.supplier.getArticlesAvailableForOrdering.collect{|a| !order.order_article_results.detect{|t| t.name == a.name }.nil?}.join(', ') %>);
template[<%= i += 1 %>] = new Array(<%= current_article_ids.collect { |id| order.article_ids.include?(id) }.join(', ') %>);
<% end -%>
// Call with index into template-array to select order articles from template.
function useTemplate(id) {
if (id >= 0 && id < template.length) {
<% i = -1; for article in @order.supplier.getArticlesAvailableForOrdering -%>
var status = template[id][<%= i += 1 %>]
$('checkbox_<%= article.id %>').checked = status;
highlightRow('<%= article.id %>',status);
<% end -%>}
}
<% i = -1; for article_id in current_article_ids -%>
var status = template[id][<%= i += 1 %>]
$('checkbox_<%= article_id %>').checked = status;
highlightRow('<%= article_id %>',status);
<% end -%>
}
}
//]]>
</script>

View file

@ -20,8 +20,8 @@ for order_article in @order.order_articles.ordered
data = []
for goa in order_article.group_order_articles
data << [goa.group_order.ordergroup.name,
goa.quantity,
number_with_precision(order_article.price.fc_price * goa.quantity)]
goa.result,
number_with_precision(order_article.price.fc_price * goa.result)]
end
pdf.table data,

View file

@ -24,11 +24,10 @@ for group_order in @order.group_orders
data = []
group_order.group_order_articles.ordered.each do |goa|
price = goa.order_article.price.fc_price
quantity = goa.quantity
sub_total = price * quantity
sub_total = price * goa.result
total += sub_total
data << [goa.order_article.article.name,
quantity, number_with_precision(price),
goa.result, number_with_precision(price),
goa.order_article.price.unit_quantity,
goa.order_article.article.unit,
number_with_precision(sub_total)]

View file

@ -59,7 +59,7 @@ while (page_number * max_order_articles_per_page < total_num_order_articles) do
for order_article in current_order_articles
# get the Ordergroup result for this order_article
goa = order_article.group_order_articles.first :conditions => { :group_order_id => group_order.id }
group_result << ((goa.nil? || goa == 0) ? "" : goa.quantity.to_i)
group_result << ((goa.nil? || goa == 0) ? "" : goa.result.to_i)
end
groups_data << group_result
end

View file

@ -4,7 +4,7 @@
%th{:colspan => '3'} Legende
%tr
%th{:style => 'width:70%'} Bestellgruppe
%th Bestellt
%th Bestellt (Menge + Toleranz)
%th Bekommen
%th Gesamtpreis
@ -19,8 +19,8 @@
- for goa in order_article.group_order_articles
%tr{:class => cycle('even', 'odd', :name => 'groups')}
%td{:style => "width:70%"}=h goa.group_order.ordergroup.name
%td= "#{goa.quantity} (#{goa.tolerance})"
%td= "#{goa.quantity} + #{goa.tolerance}"
%td
%b= "#{goa.quantity_result} + #{goa.tolerance_result}"
%td= number_to_currency(order_article.price.fc_price * goa.quantity)
%b= goa.result
%td= number_to_currency(order_article.price.fc_price * goa.result)
- reset_cycle('groups')

View file

@ -3,7 +3,7 @@
%tr
%th{:style => "width:40%"} Name
%th
%acronym{:title => "zugeteilte Einheiten (davon aus Toleranzmenge)"} Menge
%acronym{:title => "zugeteilte Einheiten"} Menge
%th
%acronym{:title => "Preis incl. MwSt, Pfand und Foodcoop-Aufschlag"} FC-Preis
%th
@ -20,11 +20,11 @@
- total = 0
- for goa in group_order.group_order_articles.ordered.all(:include => :order_article)
- fc_price = goa.order_article.price.fc_price
- subTotal = fc_price * goa.quantity
- subTotal = fc_price * goa.result
- total += subTotal
%tr{:class => cycle('even', 'odd', :name => 'articles')}
%td{:style => "width:40%"}=h goa.order_article.article.name
%td= "#{goa.result[:quantity]} (#{goa.result[:tolerance]})"
%td= goa.result
%td= number_to_currency(fc_price)
%td= goa.order_article.price.unit_quantity
%td= goa.order_article.article.unit

View file

@ -79,9 +79,8 @@ class RefactorOrderLogic < ActiveRecord::Migration
# change_column :group_orders, :updated_by_user_id, :integer, :default => nil, :null => true
# == GroupOrderArticle
# The order result in ordergroup is now saved!
add_column :group_order_articles, :quantity_result, :integer, :default => nil
add_column :group_order_articles, :tolerance_result, :integer, :default => nil
# The total order result in ordergroup is now saved!
add_column :group_order_articles, :result, :integer, :default => nil
end
def self.down

View file

@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20090119155930) do
ActiveRecord::Schema.define(:version => 20090120184410) do
create_table "article_categories", :force => true do |t|
t.string "name", :default => "", :null => false
@ -97,6 +97,7 @@ ActiveRecord::Schema.define(:version => 20090119155930) do
t.integer "quantity", :default => 0, :null => false
t.integer "tolerance", :default => 0, :null => false
t.datetime "updated_on", :null => false
t.integer "result"
end
add_index "group_order_articles", ["group_order_id", "order_article_id"], :name => "goa_index", :unique => true