Openbravo Issue Tracking System - Retail Modules | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0036954 | Retail Modules | Web POS | public | 2017-09-26 13:48 | 2017-10-26 16:38 |
Reporter | marvintm | ||||
Assigned To | gorka_gil | ||||
Priority | normal | Severity | major | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Platform | OS | 5 | OS Version | ||
Product Version | |||||
Target Version | Fixed in Version | RR18Q1 | |||
Merge Request Status | |||||
Review Assigned To | marvintm | ||||
OBNetwork customer | |||||
Support ticket | |||||
Regression level | |||||
Regression date | |||||
Regression introduced in release | |||||
Regression introduced by commit | |||||
Triggers an Emergency Pack | No | ||||
Summary | 0036954: buildIdentifier function in ob-cache doesn't take into account property names in the criteria | ||||
Description | The buildIdentifier function in ob-cache, which is used by the caching mechanism which is used by OB.Dal.findUsingCache and OB.Dal.queryUsingCache, doesn't take into account property names, only their values, when serializing a criteria. This means that if somebody tries to use the same cache for two different queries which query the same table but have different criterias, it could happen that incorrect results are returned. Although this was not considered the proper usage of the API in the original implementation, taking property names into account would make the API friendlier to use, and would protect it against developer mistakes. | ||||
Steps To Reproduce | Login in the Web POS. Then, execute the following two queries: OB.Dal.find(OB.Model.Product, {isGeneric: true}, function(data){console.log(data);}) OB.Dal.find(OB.Model.Product, {bestseller: true}, function(data){console.log(data);}) Verify that they return two different sets of products (makes sense, because the criteria is different). Now try the following two: OB.Dal.findUsingCache("productCache", OB.Model.Product, {isGeneric: true}, function(data){console.log(data);}) OB.Dal.findUsingCache("productCache", OB.Model.Product, {bestseller: true}, function(data){console.log(data);}) Both queries are using the same cache (which is something arguably does not make sense), but in any case, they return the same result, which is most likely wrong according to what the developer expected. If we included the whole criteria in the buildIdentifier function, this would not happen, as two different sets of results would have been created in the cache. | ||||
Proposed Solution | Change the buildIdentifier function so that it serializes the whole criteria to JSON. This way, we would not be losing the property names, and this problem would not happen. | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2017-09-26 13:48 | marvintm | New Issue | |||
2017-09-26 13:48 | marvintm | Assigned To | => Retail | ||
2017-09-26 13:48 | marvintm | Triggers an Emergency Pack | => No | ||
2017-09-26 13:50 | marvintm | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=15993#r15993 | ||
2017-10-02 16:22 | gorka_gil | Assigned To | Retail => gorka_gil | ||
2017-10-09 18:15 | gorka_gil | Status | new => scheduled | ||
2017-10-13 09:23 | hgbot | Checkin | |||
2017-10-13 09:23 | hgbot | Note Added: 0099882 | |||
2017-10-13 09:24 | hgbot | Checkin | |||
2017-10-13 09:24 | hgbot | Note Added: 0099883 | |||
2017-10-13 09:24 | hgbot | Status | scheduled => resolved | ||
2017-10-13 09:24 | hgbot | Resolution | open => fixed | ||
2017-10-13 09:24 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/540216bb64224392b0a4004b80526da5b08579dd [^] | ||
2017-10-26 16:38 | marvintm | Review Assigned To | => marvintm | ||
2017-10-26 16:38 | marvintm | Status | resolved => closed | ||
2017-10-26 16:38 | marvintm | Fixed in Version | => RR18Q1 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|