View Issue Details

IDProjectCategoryView StatusLast Update
381RackTablesdefaultpublic2011-01-04 23:50
Reporteruser188Assigned Toandriyanov  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.18.5 
Fixed in Version0.19.0 
Summary381: The 'Refcnt' counter on Configuration: Dictionary: Chapter 'XXX' for some chapter is broken
DescriptionLet imagine there are some object types having the same attribute(s) (i.e. CPU Model) in Racktables i.e (Server, Laptop & Desktop PC). In such situation a value for the attribute apearing on the "Main page: Configuration: Dictionary: Chapter 'CPU Model'" page is multiply by number of the object type this attribute appear in (in our example by 3). After tracing the problem lay in following PHP/SQL code/query (from inc/database.php - line 1979) causing the problem:


                // Find the list of all assigned values of dictionary-addressed attributes, each with
                // chapter/word keyed reference counters.
                $query = "select uint_value, count(object_id) as refcnt " .
                        "from Attribute as a inner join AttributeMap as am on a.id = am.attr_id " .
                        "inner join AttributeValue as av on a.id = av.attr_id " .
                        "inner join Dictionary as d on am.chapter_id = d.chapter_id and av.uint_value = d.dict_key " .
                        "where a.type = 'dict' and am.chapter_id = ? group by uint_value";
                break;


The first join return 3 row not 1:

mysql> SELECT * FROM Attribute AS a INNER JOIN AttributeMap AS am ON a.id = am.attr_id WHERE a.type = 'dict' AND am.chapter_id = 10004 ;
+-------+------+-----------+------------+---------+------------+
| id | type | name | objtype_id | attr_id | chapter_id |
+-------+------+-----------+------------+---------+------------+
| 10012 | dict | CPU Model | 4 | 10012 | 10004 |
| 10012 | dict | CPU Model | 50000 | 10012 | 10004 |
| 10012 | dict | CPU Model | 50001 | 10012 | 10004 |
+-------+------+-----------+------------+---------+------------+
3 rows in set (0.00 sec)


Any idea how to fix it?


(And, yes we are using Racktables to inventory boxes out of Server rooms).

TagsNo tags attached.

Activities

user188

2010-12-08 11:03

  ~0000200

The issue has been recreated on the DEMO website:

http://demo.racktables.org/index.php?page=chapter&chapter_no=10001
infrastation

infrastation

2010-12-08 18:00

administrator   ~0000201

I see. May be, you already know, how to fix this best?
andriyanov

andriyanov

2011-01-04 23:50

reporter   ~0000213

Fixed in 0.19.0 (SVN commit 4076).

Issue History

Date Modified Username Field Change
2010-12-07 18:00 user188 New Issue
2010-12-08 11:03 user188 Note Added: 0000200
2010-12-08 18:00 infrastation Note Added: 0000201
2010-12-08 18:00 infrastation Status new => acknowledged
2011-01-04 23:48 andriyanov Status acknowledged => assigned
2011-01-04 23:48 andriyanov Assigned To => andriyanov
2011-01-04 23:50 andriyanov Note Added: 0000213
2011-01-04 23:50 andriyanov Status assigned => closed
2011-01-04 23:50 andriyanov Resolution open => fixed
2011-01-04 23:50 andriyanov Fixed in Version => 0.19.0