unidom-score 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +18 -0
- data/app/controllers/unidom/score/application_controller.rb +3 -0
- data/app/jobs/unidom/score/application_job.rb +3 -0
- data/app/mailers/unidom/score/application_mailer.rb +3 -0
- data/app/models/unidom/score/application_record.rb +3 -0
- data/app/models/unidom/score/score_item.rb +6 -1
- data/app/models/unidom/score/score_item_template.rb +1 -1
- data/app/models/unidom/score/score_sheet.rb +6 -1
- data/app/models/unidom/score/score_sheet_template.rb +1 -1
- data/lib/unidom/score/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaa607c731316c64167f570f7b5d6f9a9d35377c
|
4
|
+
data.tar.gz: a2910f4c55f4ce798026fbf5bfcdf03167e9be93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92aeb82df2fbda87c322bad426f8d92fd9cfa1c54966b601eb61add780f63d746d5bd5896ef68419617690a246e9a7e9f7186da78c723049ee9b86a4795952d0
|
7
|
+
data.tar.gz: e712a734cd42ef93b35099f196150c6b53f03263f5787b9258a441c7f28a1e8c619845501883d6b6140c3b7949ec9142baa5027807c34fa27a792724e31ea267
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Unidom Score 评分领域模型引擎
|
2
2
|
|
3
|
+
[](http://www.rubydoc.info/gems/unidom-score/frames)
|
3
4
|
[](http://opensource.org/licenses/MIT)
|
5
|
+
|
4
6
|
[](https://badge.fury.io/rb/unidom-score)
|
5
7
|
[](https://gemnasium.com/github.com/topbitdu/unidom-score)
|
6
8
|
|
@@ -51,3 +53,19 @@ item_1 = Unidom::Score::ScoreItem.score! sheet: score_sheet, scorer: score_sheet
|
|
51
53
|
item_2 = Unidom::Score::ScoreItem.score! sheet: score_sheet, scorer: score_sheet.try(:scorer), template: item_template_2, title: item_template_2.try(:title), score: 39, scored_on: Date.current, opened_at: Time.now, description: nil, instruction: nil
|
52
54
|
# The template could be nil
|
53
55
|
```
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
## Disable the Model & Migration
|
60
|
+
|
61
|
+
If you only need the app components other than models, the migrations should be neglected, and the models should not be loaded.
|
62
|
+
```ruby
|
63
|
+
# config/initializers/unidom.rb
|
64
|
+
Unidom::Common.configure do |options|
|
65
|
+
|
66
|
+
options[:neglected_namespaces] = %w{
|
67
|
+
Unidom::Score
|
68
|
+
}
|
69
|
+
|
70
|
+
end
|
71
|
+
```
|
@@ -21,8 +21,13 @@ class Unidom::Score::ScoreItem < Unidom::Score::ApplicationRecord
|
|
21
21
|
scope :template_is, ->(template) { where template_id: to_id(template) }
|
22
22
|
scope :scored_by, ->(scorer) { where scorer: scorer }
|
23
23
|
|
24
|
+
##
|
25
|
+
# 评分员 scorer (缺省为评分表的评分员) 以 template 为模版(可以为空)在评分表 sheet 上评分。评分项的标题为 title ,缺省为评分项模版的标题。
|
26
|
+
# 得分为 score ,缺省为 0 。得分日期为 scored_on ,缺省为当天。记录时间为 opened_at ,缺省为当前时间。
|
27
|
+
# 另有适用于己方的备注 description 和适用于对方的备注 instruction。如:
|
28
|
+
# Unidom::Score::ScoreItem.score! sheet: score_sheet, template: score_item_template, score: 20
|
24
29
|
def self.score!(sheet: nil, scorer: sheet.try(:scorer), template: nil, title: template.try(:title), score: 0, scored_on: Date.current, opened_at: Time.now, description: nil, instruction: nil)
|
25
30
|
create! sheet: sheet, scorer: scorer, template: template, title: title, score: score, scored_on: scored_on, opened_at: opened_at, description: description, instruction: instruction
|
26
31
|
end
|
27
32
|
|
28
|
-
end
|
33
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Score::ScoreItem'
|
@@ -24,8 +24,13 @@ class Unidom::Score::ScoreSheet < Unidom::Score::ApplicationRecord
|
|
24
24
|
scope :scored_by, ->(scorer) { where scorer: scorer }
|
25
25
|
scope :score_kept_by, ->(score_keeper) { where score_keeper: score_keeper }
|
26
26
|
|
27
|
+
##
|
28
|
+
# 评分员 scorer 以 template 为模版(可以为空),对得分者 score_keeper 评分。评分表的名称为 name ,缺省为模版的名称。
|
29
|
+
# 得分为 score ,缺省为 0 。得分日期为 scored_on ,缺省为当天。记录时间为 opened_at ,缺省为当前时间。
|
30
|
+
# 另有适用于己方的备注 description 和适用于对方的备注 instruction。如:
|
31
|
+
# Unidom::Score::ScoreSheet.score! scorer: officer, score_keeper: shop, template: score_sheet_template, score: 100
|
27
32
|
def self.score!(scorer: nil, score_keeper: nil, template: nil, name: template.try(:name), score: 0, scored_on: Date.current, opened_at: Time.now, description: nil, instruction: nil)
|
28
33
|
create! scorer: scorer, score_keeper: score_keeper, template: template, name: name, score: score, scored_on: scored_on, opened_at: opened_at, description: description, instruction: instruction
|
29
34
|
end
|
30
35
|
|
31
|
-
end
|
36
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Score::ScoreSheet'
|
data/lib/unidom/score/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-score
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.9'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.9'
|
27
27
|
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
28
28
|
The Score domain model engine includes the Score Sheet, the Score Sheet Item, the
|
29
29
|
Score Sheet Template, and the Score Sheet Template Item. Unidom (统一领域对象模型)是一系列的领域模型引擎。评分领域模型引擎包括评分表、评分项、评分表模版和评分项模版模型。
|