Skip to content

Commit

Permalink
Merge branch 'staging' into snyk-fix-f8b1193a9a4b195ad4b656f5df492024
Browse files Browse the repository at this point in the history
  • Loading branch information
puppe1990 authored Sep 5, 2024
2 parents 9203901 + fc0f8a7 commit ef89687
Show file tree
Hide file tree
Showing 61 changed files with 1,648 additions and 3,263 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.9.0'
node-version: '22.2.0'
cache: 'yarn'
- run: |
npm install -g [email protected].19
npm install -g [email protected].22
yarn install --check-files
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
ruby-version: 3.3.4
# runs 'bundle install' and cache installed gems automatically
bundler-cache: true

Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.2
3.3.4
14 changes: 7 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.2.2'
ruby '3.3.4'

# dotenv-rails must be on the top
gem 'dotenv-rails', '>= 3.0.0', groups: %i[development test]
Expand All @@ -11,7 +11,7 @@ gem 'inherited_resources', '1.14.0'
# Bundle Rails instead: gem 'rails', github: 'rails/rails'
gem "rails", "~> 7.0.8", ">= 7.0.8.4"
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails", ">= 3.5.1"
gem "sprockets-rails", ">= 3.5.2"

# Use postgresql as the database for Active Record
gem "pg", "~> 1.1"
Expand All @@ -23,13 +23,13 @@ gem "puma", "~> 6.4", ">= 6.4.2"
gem 'pundit'

# Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]
gem "jsbundling-rails", ">= 1.3.0"
gem "jsbundling-rails", ">= 1.3.1"

# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
gem "turbo-rails", ">= 2.0.0"
gem "turbo-rails", ">= 2.0.6"

# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
gem "stimulus-rails", ">= 1.3.1"
gem "stimulus-rails", ">= 1.3.4"

gem "sentry-ruby"
gem "sentry-rails", ">= 5.18.0"
Expand Down Expand Up @@ -80,7 +80,7 @@ group :development, :test do
gem 'bullet'
gem 'byebug', platforms: %i[mri mingw x64_mingw]
gem 'pry-byebug'
gem 'rspec-rails', '>= 6.1.3'
gem 'rspec-rails', '>= 6.1.4'
gem 'solargraph'
end

Expand Down Expand Up @@ -142,9 +142,9 @@ gem 'rack-cors', require: 'rack/cors'
gem 'rails-i18n', '~> 7.0.9'
gem 'rqrcode_png', git: "https://github.com/DCarper/rqrcode_png.git"
gem 'serviceworker-rails'
gem 'rubocop-rails', '>= 2.25.1', require: false
gem 'rubocop-rspec', '>= 2.31.0', require: false
gem 'rubocop-performance', '>= 1.21.1', require: false
gem 'rubocop-rails', '>= 2.26.0', require: false
gem 'bling_api', git: 'https://github.com/Purple-Stock/bling_api'

gem "good_job", github: 'bensheldon/good_job', branch: 'main'
Expand Down
53 changes: 27 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ GEM
coderay (1.1.3)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
concurrent-ruby (1.3.3)
concurrent-ruby (1.3.4)
crack (1.0.0)
bigdecimal
rexml
Expand Down Expand Up @@ -284,7 +284,7 @@ GEM
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jmespath (1.6.2)
jsbundling-rails (1.3.0)
jsbundling-rails (1.3.1)
railties (>= 6.0.0)
json (2.7.2)
jsonapi-serializer (2.2.0)
Expand Down Expand Up @@ -313,7 +313,7 @@ GEM
method_source (1.1.0)
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.24.1)
minitest (5.25.1)
msgpack (1.7.2)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
Expand All @@ -328,14 +328,14 @@ GEM
net-protocol
newrelic_rpm (9.10.1)
nio4r (2.7.3)
nokogiri (1.16.6-arm64-darwin)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.6-x86_64-linux)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
pagy (6.0.4)
parallel (1.25.1)
parser (3.3.3.0)
parallel (1.26.3)
parser (3.3.4.2)
ast (~> 2.4.1)
racc
path_expander (1.1.1)
Expand All @@ -355,7 +355,7 @@ GEM
pundit (2.3.2)
activesupport (>= 3.0.0)
raabro (1.4.0)
racc (1.8.0)
racc (1.8.1)
rack (2.2.9)
rack-cors (2.0.2)
rack (>= 2.0.0)
Expand Down Expand Up @@ -416,7 +416,7 @@ GEM
railties (>= 5.2)
reverse_markdown (2.1.1)
nokogiri
rexml (3.3.1)
rexml (3.3.6)
strscan
rodf (1.2.0)
builder (>= 3.0)
Expand All @@ -439,7 +439,7 @@ GEM
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.3)
rspec-rails (6.1.4)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
Expand All @@ -448,18 +448,18 @@ GEM
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
rubocop (1.64.1)
rubocop (1.65.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
rubocop-ast (1.32.1)
parser (>= 3.3.1.0)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
Expand All @@ -468,10 +468,10 @@ GEM
rubocop-performance (1.21.0)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rails (2.25.1)
rubocop-rails (2.26.0)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.30.0)
rubocop (~> 1.40)
Expand Down Expand Up @@ -556,19 +556,19 @@ GEM
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.5.1)
sprockets-rails (3.5.2)
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
stimulus-rails (1.3.3)
stimulus-rails (1.3.4)
railties (>= 6.0.0)
strscan (3.1.0)
thor (1.3.1)
thread_safe (0.3.6)
tilt (2.3.0)
timeout (0.4.1)
tty-which (0.4.2)
turbo-rails (2.0.5)
turbo-rails (2.0.6)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
Expand Down Expand Up @@ -605,10 +605,11 @@ GEM
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.36)
zeitwerk (2.6.16)
zeitwerk (2.6.17)

PLATFORMS
arm64-darwin-22
arm64-darwin-23
x86_64-linux

DEPENDENCIES
Expand Down Expand Up @@ -639,7 +640,7 @@ DEPENDENCIES
image_processing (~> 1.2)
inherited_resources (= 1.14.0)
jbuilder
jsbundling-rails (>= 1.3.0)
jsbundling-rails (>= 1.3.1)
jsonapi-serializer
listen (~> 3.2)
net-smtp
Expand All @@ -659,9 +660,9 @@ DEPENDENCIES
roo
roo-xls
rqrcode_png!
rspec-rails (>= 6.1.3)
rspec-rails (>= 6.1.4)
rubocop-performance (>= 1.20.0)
rubocop-rails (>= 2.25.1)
rubocop-rails (>= 2.26.0)
rubocop-rspec (>= 2.24.1)
rubycritic
rubyzip
Expand All @@ -675,17 +676,17 @@ DEPENDENCIES
solargraph
spreadsheet_architect
spring (~> 3.0.0)
sprockets-rails (>= 3.5.1)
stimulus-rails (>= 1.3.1)
turbo-rails (>= 2.0.0)
sprockets-rails (>= 3.5.2)
stimulus-rails (>= 1.3.4)
turbo-rails (>= 2.0.6)
tzinfo-data
vcr
web-console (>= 4.2.1)
webdrivers
webmock (>= 3.20.0)

RUBY VERSION
ruby 3.2.2p53
ruby 3.3.4p94

BUNDLED WITH
2.4.6
12 changes: 12 additions & 0 deletions app/controllers/items_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class ItemsController < ApplicationController
def update_status
@item = Item.find(params[:id])
case params[:status]
when 'resolved'
@item.resolve!
when 'unresolved'
@item.unresolve!
end
redirect_back(fallback_location: show_pending_orders_path, notice: 'Status atualizado com sucesso.')
end
end
35 changes: 22 additions & 13 deletions app/controllers/orders_control_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,41 @@ def show_orders_products_stock
.order(custom_id: :desc)
end


def show_pending_orders
situation_id = params[:situation_id]
store_id = params[:store_id]

@resolution_status = params[:resolution_status] || 'unresolved'

if situation_id.present?
cleaned_situation_ids = situation_id.split(',').map(&:to_i)
else
cleaned_situation_ids = BlingOrderItem::Status::PENDING
end

pending_items = Item.includes(:bling_order_item).where(bling_order_items: { situation_id: cleaned_situation_ids })

if store_id.present?
@pending_order_items = pending_items.where(bling_order_items: { store_id: store_id })
else
@pending_order_items = pending_items
end


items = Item.includes(:bling_order_item).where(bling_order_items: { situation_id: cleaned_situation_ids })

items = items.where(bling_order_items: { store_id: store_id }) if store_id.present?

@all_items = case @resolution_status
when 'unresolved'
items.unresolved
when 'resolved'
items.resolved
else
items
end

# Group items by store and sort by total quantity
@sorted_stores = @all_items.group_by { |item| item.bling_order_item.store_name }
.sort_by { |_, items| -items.sum(&:quantity) }
.to_h

respond_to do |format|
format.html # show.html.erb
format.csv { send_data generate_csv(@pending_order_items), filename: "pending-orders-#{Date.today}.csv" }
format.csv { send_data generate_csv(@all_items), filename: "orders-#{Date.today}.csv" }
end
end


def show_orders_business_day
@simplo_orders = SimploOrder.where(order_status: %w[2 30 31]).order(order_id: :asc)
@calendar = SimploOrder.calendar
Expand Down
Loading

0 comments on commit ef89687

Please sign in to comment.