Ensure that the article_id is set for every article_price

This addresses the TODO from dc92de771e.
This commit is contained in:
Patrick Gansterer 2020-08-17 14:00:26 +02:00
parent 26aecbbe9e
commit 3a6276aece
3 changed files with 22 additions and 8 deletions

View file

@ -166,13 +166,7 @@ class OrderArticle < ApplicationRecord
else
# Creates a new article_price if neccessary
# Set created_at timestamp to order ends, to make sure the current article price isn't changed
create_article_price!(price_attributes.merge(created_at: order.ends)) and save
# TODO: The price_attributes do not include an article_id so that
# the entry in the database will not "know" which article is
# referenced. Let us check the effect of that and change it or
# comment on the meaning.
# Possibly this is the real reason why the global price is not
# affected instead of the `created_at: order.ends` injection.
create_article_price!(price_attributes.merge(article_id: article_id, created_at: order.ends)) and save
end
# Updates ordergroup values