Skip to content

Commit

Permalink
Merge pull request #3318 from magento-chaika/chaika_october2
Browse files Browse the repository at this point in the history
[Chaika] Bugfixes
  • Loading branch information
Lysenko Olexandr authored Oct 24, 2018
2 parents c515b40 + 1652246 commit fcf9eed
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
15 changes: 11 additions & 4 deletions app/code/Magento/Catalog/view/frontend/web/js/product/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

define([
'underscore',
'jquery',
'mageUtils',
'uiElement',
'Magento_Catalog/js/product/storage/storage-service',
'Magento_Customer/js/customer-data'
], function (_, utils, Element, storage, customerData) {
'Magento_Customer/js/customer-data',
'Magento_Catalog/js/product/view/product-ids-resolver'
], function (_, $, utils, Element, storage, customerData, productResolver) {
'use strict';

return Element.extend({
Expand Down Expand Up @@ -135,11 +137,16 @@ define([
*/
filterIds: function (ids) {
var _ids = {},
currentTime = new Date().getTime() / 1000;
currentTime = new Date().getTime() / 1000,
currentProductIds = productResolver($('#product_addtocart_form'));

_.each(ids, function (id) {
if (currentTime - id['added_at'] < ~~this.idsStorage.lifetime) {
if (
currentTime - id['added_at'] < ~~this.idsStorage.lifetime &&
!_.contains(currentProductIds, id['product_id'])
) {
_ids[id['product_id']] = id;

}
}, this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Review\Model\ResourceModel\Review\Product;

use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
Expand Down Expand Up @@ -403,12 +404,20 @@ public function getAllIds($limit = null, $offset = null)
public function getResultingIds()
{
$idsSelect = clone $this->getSelect();
$idsSelect->reset(Select::LIMIT_COUNT);
$idsSelect->reset(Select::LIMIT_OFFSET);
$idsSelect->reset(Select::COLUMNS);
$idsSelect->reset(Select::ORDER);
$idsSelect->columns('rt.review_id');
return $this->getConnection()->fetchCol($idsSelect);
$data = $this->getConnection()
->fetchAll(
$idsSelect
->reset(Select::LIMIT_COUNT)
->reset(Select::LIMIT_OFFSET)
->columns('rt.review_id')
);

return array_map(
function ($value) {
return $value['review_id'];
},
$data
);
}

/**
Expand Down

0 comments on commit fcf9eed

Please sign in to comment.