unidom-score 1.0.1 → 1.0.2

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
  SHA1:
3
- metadata.gz: e0b5e95a644e2722c9025887c060acc57e1b6563
4
- data.tar.gz: 37a987d4cb632e081ffae4e6ce3983624e605c98
3
+ metadata.gz: eaa607c731316c64167f570f7b5d6f9a9d35377c
4
+ data.tar.gz: a2910f4c55f4ce798026fbf5bfcdf03167e9be93
5
5
  SHA512:
6
- metadata.gz: 21d8c2b0a3ca2a46183bcf0b5c9b145eb71a88316db3382415f7ea0a929bf784bbdcaf0e8597b754ff659452a6073a79a882ebbf10a9ff8013cb1827602d8cca
7
- data.tar.gz: 8eae79d927f7cad9a8806b1648e902df96a8feaf4a98db2feb441481d7d876667fdefb89fad0ccfac08ce2c79673694b43705d99a3ec8dc9f1d4feaf1f133c64
6
+ metadata.gz: 92aeb82df2fbda87c322bad426f8d92fd9cfa1c54966b601eb61add780f63d746d5bd5896ef68419617690a246e9a7e9f7186da78c723049ee9b86a4795952d0
7
+ data.tar.gz: e712a734cd42ef93b35099f196150c6b53f03263f5787b9258a441c7f28a1e8c619845501883d6b6140c3b7949ec9142baa5027807c34fa27a792724e31ea267
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Unidom Score 评分领域模型引擎
2
2
 
3
+ [![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/gems/unidom-score/frames)
3
4
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
5
+
4
6
  [![Gem Version](https://badge.fury.io/rb/unidom-score.svg)](https://badge.fury.io/rb/unidom-score)
5
7
  [![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-score.svg)](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
+ ```
@@ -1,3 +1,6 @@
1
+ ##
2
+ # Application controller 是模块内所有控制器的基类。
3
+
1
4
  class Unidom::Score::ApplicationController < ActionController::Base
2
5
  protect_from_forgery with: :exception
3
6
  end
@@ -1,2 +1,5 @@
1
+ ##
2
+ # Application job 是模块内所有异步任务的基类。
3
+
1
4
  class Unidom::Score::ApplicationJob < ActiveJob::Base
2
5
  end
@@ -1,3 +1,6 @@
1
+ ##
2
+ # Application mailer 是模块内所有电子邮件发送类的基类。
3
+
1
4
  class Unidom::Score::ApplicationMailer < ActionMailer::Base
2
5
  default from: 'from@example.com'
3
6
  layout 'mailer'
@@ -1,3 +1,6 @@
1
+ ##
2
+ # Application record 是模块内所有模型的抽象基类。
3
+
1
4
  class Unidom::Score::ApplicationRecord < ActiveRecord::Base
2
5
  self.abstract_class = true
3
6
  end
@@ -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'
@@ -18,4 +18,4 @@ class Unidom::Score::ScoreItemTemplate < Unidom::Score::ApplicationRecord
18
18
 
19
19
  scope :sheet_is, ->(sheet) { where sheet_id: to_id(sheet) }
20
20
 
21
- end
21
+ end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Score::ScoreItemTemplate'
@@ -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'
@@ -20,4 +20,4 @@ class Unidom::Score::ScoreSheetTemplate < Unidom::Score::ApplicationRecord
20
20
 
21
21
  scope :subject_is, ->(subject) { where subject: subject }
22
22
 
23
- end
23
+ end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Score::ScoreSheetTemplate'
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Score
3
- VERSION = '1.0.1'.freeze
3
+ VERSION = '1.0.2'.freeze
4
4
  end
5
5
  end
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.1
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-03 00:00:00.000000000 Z
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.8'
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.8'
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 (统一领域对象模型)是一系列的领域模型引擎。评分领域模型引擎包括评分表、评分项、评分表模版和评分项模版模型。