File tree Expand file tree Collapse file tree 5 files changed +7
-2
lines changed Expand file tree Collapse file tree 5 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,6 @@ After you've created and configured the repository you have to set it in your co
171
171
return [
172
172
'repository' => \App\Integrations\MagentoStock\MyStockRepository::class,
173
173
];
174
-
175
174
```
176
175
177
176
### Usage
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ public function process(): void
18
18
$ repository = BaseRepository::resolve ();
19
19
20
20
Stock::query ()
21
+ ->where ('sync ' , '= ' , true )
21
22
->where ('retrieve ' , '= ' , true )
22
23
->select (['sku ' ])
23
24
->take ($ repository ->retrieveLimit ())
@@ -26,6 +27,7 @@ public function process(): void
26
27
27
28
if (config ('magento-stock.async ' )) {
28
29
$ stocks = Stock::query ()
30
+ ->where ('sync ' , '= ' , true )
29
31
->where ('update ' , '= ' , true )
30
32
->whereHas ('product ' , function (Builder $ query ): void {
31
33
$ query ->where ('exists_in_magento ' , '= ' , true );
@@ -37,6 +39,7 @@ public function process(): void
37
39
UpdateStockAsyncJob::dispatch ($ stocks );
38
40
} else {
39
41
Stock::query ()
42
+ ->where ('sync ' , '= ' , true )
40
43
->where ('update ' , '= ' , true )
41
44
->select (['id ' , 'sku ' ])
42
45
->take ($ repository ->updateLimit ())
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ public function failed(): void
80
80
if (! $ shouldRetry ) {
81
81
$ this ->update = false ;
82
82
$ this ->retrieve = false ;
83
+ $ this ->fail_count = 0 ;
83
84
}
84
85
85
86
$ this ->save ();
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ public function skus(?Carbon $from = null): Collection
20
20
/** @var Collection<int, string> $skus */
21
21
$ skus = MagentoProduct::query ()
22
22
->where ('exists_in_magento ' , '= ' , true )
23
+ ->select (['sku ' ])
24
+ ->distinct ()
23
25
->pluck ('sku ' );
24
26
25
27
return $ skus ;
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ public function it_will_set_retrieve_update_too_many_failures(): void
39
39
40
40
$ model ->failed ();
41
41
42
- $ this ->assertEquals (101 , $ model ->fail_count );
42
+ $ this ->assertEquals (0 , $ model ->fail_count );
43
43
$ this ->assertFalse ($ model ->retrieve );
44
44
$ this ->assertFalse ($ model ->update );
45
45
}
You can’t perform that action at this time.
0 commit comments