product_update_single 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/product_update_single/version.rb +1 -1
- data/lib/product_update_single.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34279169d49c00c21b86a4677e14e5d30e53c55b
|
4
|
+
data.tar.gz: f643768a33bbb8f6ed8066e77eabb0d19c5d120e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28eb1eea0f226a989fc8c0c34aafadd18bce9e2d074a3b0ff68de1f8a4363b87ef797d4fadf5040c74b980574a33f823c2136a7a115cd586ff7551d2da022d80
|
7
|
+
data.tar.gz: 599728471c06dddef72a4efdcefe81b21e0b8de4af783a5f933ac4fe99965c003375e02ae4fe4e486fa53bf645dbf860cbb762f1e89f3aa542c6e80cdc15096c
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "product_update_single/version"
|
2
|
-
|
2
|
+
#This is a singleton class which performs the ranking and count update of the products based on every order is confirmed
|
3
3
|
require 'singleton'
|
4
4
|
class ProductUpdateSingleton
|
5
5
|
include Singleton
|
@@ -29,7 +29,8 @@ class ProductUpdateSingleton
|
|
29
29
|
@product_hit_update.quantityAvailable -= @order_record.quantity
|
30
30
|
@product_hit_update.save
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
|
+
#this method updates the count column in the product model based on the quantity of products sold.
|
33
34
|
def count_update
|
34
35
|
@order_confirmed = Order.last
|
35
36
|
@order_record = OrderItem.where(order_id: @order_confirmed.id)
|
@@ -50,6 +51,7 @@ class ProductUpdateSingleton
|
|
50
51
|
self.hit_counter
|
51
52
|
end
|
52
53
|
|
54
|
+
#this method is triggered by the count update method internally to rank the products by its count updated previously.
|
53
55
|
def hit_counter
|
54
56
|
@count_iterate = 1
|
55
57
|
@prod = Product.all
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: product_update_single
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kishore Kumar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|