comee_core 0.1.87 → 0.1.89
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/comee/core/sales_order_items_controller.rb +2 -29
- data/app/controllers/comee/core/units_controller.rb +5 -0
- data/app/models/comee/core/pod.rb +1 -0
- data/app/models/comee/core/transport_availability.rb +13 -1
- data/app/models/comee/core/unit.rb +4 -0
- data/app/serializers/comee/core/sales_order_item_serializer.rb +2 -2
- data/config/routes.rb +5 -1
- data/config/spring.rb +1 -1
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/transport_availabilities.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2215fbbb3c1a9e0c836eb20902ea9c9871e473d08bb17c0659ca6c20236daeb
|
4
|
+
data.tar.gz: a546d3c21ef0b354c9ff61159309919145de3335e16639d9674a6ae1f2414824
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e00d19d0c5d47518505c4a4b5f7ef3a336807966795d933cff8ce7f133dfe32aebc50d76cb2d8dbd78b1010e89d271be9cf3dd6d1b30175b1405f50024108559
|
7
|
+
data.tar.gz: 5a9d63dd29c4ec4ed87b555dc7cb7b316d1fb69f97dbbc59f14dbc6cc638fd34ca0291103cb355078903276963911bd7953be094daeb3be86fd91157c7fc4039
|
@@ -25,39 +25,12 @@ module Comee
|
|
25
25
|
render json: {success: true}
|
26
26
|
end
|
27
27
|
|
28
|
-
# def filter_with_status
|
29
|
-
# items = SalesOrderItem.includes(:sales_order, :product, :unit)
|
30
|
-
# .ransack(params[:q]).result
|
31
|
-
# statuses = ItemStatus.where(sales_order_item_id: items.map(&:id))
|
32
|
-
# .select("MAX(id) AS max_id, sales_order_item_id")
|
33
|
-
# .group(:sales_order_item_id)
|
34
|
-
# .all
|
35
|
-
# ids = statuses.map(&:max_id)
|
36
|
-
# statuses = ItemStatus.where(id: ids).each_with_object({}) { |status, res| res[status.sales_order_item_id] = status }
|
37
|
-
# result = items.each_with_object([]) do |item, res|
|
38
|
-
# status = statuses[item.id]
|
39
|
-
# data = {
|
40
|
-
# sales_order_no: item.sales_order.order_number,
|
41
|
-
# customer_item_no: item.customer_item_no,
|
42
|
-
# product_code: item.product.code,
|
43
|
-
# unit: item.unit.code,
|
44
|
-
# quantity: item.quantity,
|
45
|
-
# delivery_date: item.delivery_date,
|
46
|
-
# handover_date: item.sales_order.handover_date,
|
47
|
-
# po_reference: item.po_reference,
|
48
|
-
# status: status&.status
|
49
|
-
# }
|
50
|
-
# res << data.merge(status&.details)
|
51
|
-
# end
|
52
|
-
# render json: {success: true, data: result}
|
53
|
-
# end
|
54
|
-
|
55
28
|
private
|
56
29
|
|
57
30
|
def model_params
|
58
31
|
params.require(:payload).permit(:sales_order_id, :customer_order_item_id, :product_id, :unit_id, :quantity, :quantity_delivered,
|
59
|
-
:customer_item_no, :price, :delivery_date, :eb_number, :lead_time, :comment,
|
60
|
-
:po_reference, :pallet_no, :source_id)
|
32
|
+
:customer_item_no, :price, :handover_date, :delivery_date, :eb_number, :lead_time, :comment,
|
33
|
+
:action_note, :po_reference, :pallet_no, :source_id)
|
61
34
|
end
|
62
35
|
end
|
63
36
|
end
|
@@ -1,8 +1,20 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class TransportAvailability < ApplicationRecord
|
4
|
+
before_save :compute_weekday
|
5
|
+
|
6
|
+
has_many :time_slots
|
7
|
+
|
4
8
|
validates :availability_date, presence: true, uniqueness: true
|
5
|
-
|
9
|
+
|
10
|
+
def compute_weekday
|
11
|
+
self.weekday = availability_date.strftime("%A")
|
12
|
+
self.weekday_short = availability_date.strftime("%a")
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.ransackable_attributes(_auth_object = nil)
|
16
|
+
%w[availability_date weekday weekday_short]
|
17
|
+
end
|
6
18
|
end
|
7
19
|
end
|
8
20
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class SalesOrderItemSerializer < ActiveModel::Serializer
|
4
|
-
attributes :id, :customer_item_no, :quantity, :quantity_delivered, :price, :
|
5
|
-
:action_note, :po_reference
|
4
|
+
attributes :id, :customer_item_no, :quantity, :quantity_delivered, :price, :handover_date, :delivery_date, :eb_number,
|
5
|
+
:lead_time, :comment, :action_note, :po_reference
|
6
6
|
|
7
7
|
belongs_to :sales_order
|
8
8
|
belongs_to :customer_order_item
|
data/config/routes.rb
CHANGED
@@ -66,7 +66,11 @@ Comee::Core::Engine.routes.draw do
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
resources :currencies
|
69
|
-
resources :units
|
69
|
+
resources :units do
|
70
|
+
collection do
|
71
|
+
post "filter"
|
72
|
+
end
|
73
|
+
end
|
70
74
|
resources :unit_conversions
|
71
75
|
resources :users
|
72
76
|
post "/purchase_orders/filter", controller: :purchase_orders, action: :filter
|
data/config/spring.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Spring.application_root = "spec/dummy"
|
1
|
+
Spring.application_root = "./spec/dummy"
|
data/lib/comee/core/version.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :transport_availability, class: "Comee::Core::TransportAvailability" do
|
3
3
|
availability_date do
|
4
|
-
d = Date.current
|
4
|
+
d = Faker::Date.between(from: Date.current, to: Date.current.advance(months: 6))
|
5
5
|
d.advance(days: 1) if d.wday == 7
|
6
6
|
d.advance(days: 2) if d.wday == 6
|
7
7
|
d
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comee_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.89
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|