biddyweb / substruct

Automatically exported from code.google.com/p/substruct
0 stars 0 forks source link

Filtering by tag doesn't work correctly #184

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Reopening issue 89.

What steps will reproduce the problem?
1. As per issue 89
2. Create some discontinued items with quantity > 1

What version of the product are you using? On what operating system?
substruct_rel_1-0-a6.tar.gz, Windows Vista

Please provide any additional information below.
There's and logical error in SQL statement in app/models/product.rb in 
CONDITIONS_AVAILABLE definition. IS:

 CONDITIONS_AVAILABLE = %Q/
      CURRENT_DATE() >= DATE(items.date_available)
      AND (items.is_discontinued = 0
      OR items.is_discontinued = 1 AND (items.quantity > 0 OR 
items.variation_quantity > 0))
  /

Should be:
 CONDITIONS_AVAILABLE = %Q/
      CURRENT_DATE() >= DATE(items.date_available)
      AND (items.is_discontinued = 0
      OR (items.is_discontinued = 1 AND (items.quantity > 0 OR 
items.variation_quantity > 0)))
  /

The last part of the condition should say something other conditions and 
is either not discontinued either is discontinued by stock lasts. Now it 
can be read as : (other conditions and is discontinued) or discontinued by 
stock lasts.

Original issue reported on code.google.com by marcin.m...@gmail.com on 13 Sep 2009 at 4:57