ecom_core 1.2.19 → 1.2.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dec564e431b435c4775432757843f7d46c2c98d0c3858bb783e8325b630ba84f
4
- data.tar.gz: 6831882fb350c6d92d1324a7f6d3fcf6a95ec334af3b551b11b6e24c93c29c75
3
+ metadata.gz: 57de1b5bb610121618f09d6623d8f83e5c38e4d0f91415264c0c90008c4aca92
4
+ data.tar.gz: 2d1c048ac5692e8675a86a3fd769f5a3200be47d7790fd7df1ac25a7f1e6b045
5
5
  SHA512:
6
- metadata.gz: a9043260a84f6ad95cb2e3ba02329f50bb60a98159b143e58db19c5273bacc1d15d6df538ee460ded92e519071741ac32e6003ec29ae659548109d806ea50d36
7
- data.tar.gz: 0e280d833e3b19ce2c87ec29f3d7880e20d015e712c289c027785c885bb8b3b601e8347ecf1290ac26bd14c5b7ccc8cae7fbbc2ecb911b3ef0f2cd97d03f87ba
6
+ metadata.gz: 5d32fb2ceea452a4327a86d3b0521ba719ed45bbf1392c754270686aeca4fb406bba683bb4ce7a60748ddcbd74f7fe1f955701eea507d5077b10ab6dfa23ac0c
7
+ data.tar.gz: 2a89d665d5ca5899193ce27d423ada50b36bf03a5a728c803b7839e0d15bab8a875eebd43152d66fbe7e378fdfd7522ac80cc4763f0903cfc7c1bcc195dbb4ec
@@ -1,10 +1,33 @@
1
1
  module Ecom
2
2
  module Core
3
3
  class Company < ApplicationRecord
4
+ # The settings attribute is a json string containing setting key value
5
+ # pairs. The valid settings are:
6
+ # payroll_periods => a list of payroll period values. Each
7
+ # payroll period has the following entries:
8
+ # order: A numeric value indicating the order of the period.
9
+ # date: A numeric value indicating the date of each month which
10
+ # upto which timesheet data is used for payroll calculation
11
+ # for the specific period.
12
+ # comparison: One of [:exact, :days_before_month_end]. :exact will
13
+ # force calculations to be made upto the exact mentioned date
14
+ # value, whereas :days_before_month_end is often used for last
15
+ # period payroll calculation and we want to specify on which date
16
+ # before the end of the month we have to limit timesheet data to
17
+ # calculate payroll. E.g. 3 days before month end would be 27th
18
+ # for september and 28th for october.
19
+ #
20
+ # period_count - the total number of periods per month for payroll.
21
+ # this value should align with the defined payroll periods.
22
+ #
4
23
  has_many :projects
5
24
 
6
25
  validates :code, :name, :address, :telephone, presence: true
7
26
  validates :code, :name, uniqueness: true
27
+
28
+ def valid_settings?
29
+ settings['payroll_periods'].count == settings['period_count']
30
+ end
8
31
  end
9
32
  end
10
33
  end
@@ -6,7 +6,7 @@ class CreateEcomCoreCompanies < ActiveRecord::Migration[6.0]
6
6
  t.string :address, null: false
7
7
  t.string :telephone, null: false
8
8
  t.string :email
9
- t.json :settings
9
+ t.jsonb :settings, default: {}
10
10
 
11
11
  t.timestamps
12
12
  end
@@ -1,5 +1,5 @@
1
1
  module Ecom
2
2
  module Core
3
- VERSION = '1.2.19'.freeze
3
+ VERSION = '1.2.20'.freeze
4
4
  end
5
5
  end
@@ -7,5 +7,11 @@ FactoryBot.define do
7
7
  address { FFaker::Address.street_address }
8
8
  telephone { FFaker::PhoneNumber.phone_number }
9
9
  email { FFaker::Internet.email }
10
+ settings do
11
+ {
12
+ payroll_periods: [{ order: 1, date: 25, comparison: :exact }],
13
+ period_count: 1
14
+ }
15
+ end
10
16
  end
11
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecom_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.19
4
+ version: 1.2.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-21 00:00:00.000000000 Z
11
+ date: 2020-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aasm