unidom-score 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +40 -0
- data/Rakefile +24 -0
- data/app/assets/config/unidom-score_manifest.js +2 -0
- data/app/assets/javascripts/unidom/score/application.js +13 -0
- data/app/assets/stylesheets/unidom/score/application.css +14 -0
- data/app/controllers/unidom/score/application_controller.rb +3 -0
- data/app/helpers/unidom/score/application_helper.rb +2 -0
- data/app/jobs/unidom/score/application_job.rb +2 -0
- data/app/mailers/unidom/score/application_mailer.rb +4 -0
- data/app/models/unidom/score/application_record.rb +3 -0
- data/app/models/unidom/score/score_sheet.rb +23 -0
- data/app/views/layouts/unidom/score/application.html.erb +15 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20060111000000_create_unidom_score_sheets.rb +36 -0
- data/lib/tasks/score_tasks.rake +4 -0
- data/lib/unidom/score/engine.rb +15 -0
- data/lib/unidom/score/version.rb +5 -0
- data/lib/unidom/score.rb +6 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 972f92ff143ebea1a4954fece45cf4d42bf9e3c9
|
4
|
+
data.tar.gz: 080af716b002e1afe55cc01bed48925efee3a60e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 363ba44c00d2c77bea115eb8d37357372e3b966865b53039db72a060c3253bf4b9ca5fcc51c16ce166d96c21219a6b435298f7e3363638999e2ee37dcb034ec4
|
7
|
+
data.tar.gz: dc0c583951803fcbf42e1f7e3f3591f0eed08a177738bf25f8de78f711c4ee6ddccb08e7f125ee690909e77946ed41a10597ecdc6bf4a5e24bb8a2fa7f9dfc90
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2016 Topbit Du
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Unidom Score 评分领域模型引擎
|
2
|
+
|
3
|
+
[![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/unidom-score.svg)](https://badge.fury.io/rb/unidom-score)
|
5
|
+
[![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-score.svg)](https://gemnasium.com/github.com/topbitdu/unidom-score)
|
6
|
+
|
7
|
+
Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Score domain model engine includes the Score Sheet, the Score Sheet Item, the Score Sheet Template, and the Score Sheet Template Item.
|
8
|
+
Unidom (统一领域对象模型)是一系列的领域模型引擎。评分领域模型引擎包括评分表、评分项、评分表模版和评分项模版模型。
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
## Recent Update
|
13
|
+
|
14
|
+
Check out the [Road Map](ROADMAP.md) to find out what's the next.
|
15
|
+
Check out the [Change Log](CHANGELOG.md) to find out what's new.
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
## Usage in Gemfile
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
gem 'unidom-score'
|
23
|
+
```
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
## Run the Database Migration
|
28
|
+
|
29
|
+
```shell
|
30
|
+
rake db:migrate
|
31
|
+
```
|
32
|
+
The migration versions start with 200601.
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
## Call the Model
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
score_sheet = Unidom::Score::ScoreSheet.valid_at.alive.first
|
40
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Unidom Score'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
load 'rails/tasks/statistics.rake'
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
require 'bundler/gem_tasks'
|
24
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_self
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_self
|
14
|
+
*/
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Score Sheet 是评分表。
|
2
|
+
# #score_sheet_template 是评分表模版。
|
3
|
+
# #scorer 是评分者。
|
4
|
+
# #score_keeper 是得分者。
|
5
|
+
|
6
|
+
class Unidom::Score::ScoreSheet < Unidom::Score::ApplicationRecord
|
7
|
+
|
8
|
+
self.table_name = 'unidom_score_sheets'
|
9
|
+
|
10
|
+
include Unidom::Common::Concerns::ModelExtension
|
11
|
+
|
12
|
+
validates :name, allow_blank: true, length: { in: 2..columns_hash['name'].limit }
|
13
|
+
validates :score, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
14
|
+
|
15
|
+
belongs_to :template, class_name: 'Unidom::Score::ScoreSheetTemplate', foreign_key: :score_sheet_template_id
|
16
|
+
belongs_to :scorer, polymorphic: true
|
17
|
+
belongs_to :score_keeper, polymorphic: true
|
18
|
+
|
19
|
+
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)
|
20
|
+
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
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Unidom Score</title>
|
5
|
+
<%= stylesheet_link_tag 'unidom/score/application', media: 'all' %>
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
|
10
|
+
<%= yield %>
|
11
|
+
|
12
|
+
<%= javascript_include_tag 'unidom/score/application' %>
|
13
|
+
|
14
|
+
</body>
|
15
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
class CreateUnidomScoreSheets < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :unidom_score_sheets, id: :uuid do |t|
|
6
|
+
|
7
|
+
t.references :score_sheet_template, type: :uuid, null: true
|
8
|
+
t.references :scorer, type: :uuid, null: false,
|
9
|
+
polymorphic: { null: false, default: '', limit: 200 }
|
10
|
+
t.references :score_keeper, type: :uuid, null: false,
|
11
|
+
polymorphic: { null: false, default: '', limit: 200 }
|
12
|
+
|
13
|
+
t.string :name, null: true, default: nil, limit: 200
|
14
|
+
t.decimal :score, null: false, default: 0.0, precision: 12, scale: 2
|
15
|
+
t.date :scored_on, null: false
|
16
|
+
|
17
|
+
t.text :description
|
18
|
+
t.text :instruction
|
19
|
+
|
20
|
+
t.column :state, 'char(1)', null: false, default: 'C'
|
21
|
+
t.datetime :opened_at, null: false, default: Time.utc(1970)
|
22
|
+
t.datetime :closed_at, null: false, default: Time.utc(3000)
|
23
|
+
t.boolean :defunct, null: false, default: false
|
24
|
+
t.jsonb :notation, null: false, default: {}
|
25
|
+
|
26
|
+
t.timestamps null: false
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
add_index :unidom_score_sheets, :score_sheet_template_id
|
31
|
+
add_index :unidom_score_sheets, :scorer_id
|
32
|
+
add_index :unidom_score_sheets, :score_keeper_id
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Unidom
|
2
|
+
module Score
|
3
|
+
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
|
6
|
+
isolate_namespace Unidom::Score
|
7
|
+
|
8
|
+
initializer :append_migrations do |app|
|
9
|
+
config.paths['db/migrate'].expanded.each { |expanded_path| app.config.paths['db/migrate'] << expanded_path } unless app.root.to_s.match root.to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
data/lib/unidom/score.rb
ADDED
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unidom-score
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Topbit Du
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: unidom-common
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
28
|
+
The Score domain model engine includes the Score Sheet, the Score Sheet Item, the
|
29
|
+
Score Sheet Template, and the Score Sheet Template Item. Unidom (统一领域对象模型)是一系列的领域模型引擎。评分领域模型引擎包括评分表、评分项、评分表模版和评分项模版模型。
|
30
|
+
email:
|
31
|
+
- topbit.du@gmail.com
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- MIT-LICENSE
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- app/assets/config/unidom-score_manifest.js
|
40
|
+
- app/assets/javascripts/unidom/score/application.js
|
41
|
+
- app/assets/stylesheets/unidom/score/application.css
|
42
|
+
- app/controllers/unidom/score/application_controller.rb
|
43
|
+
- app/helpers/unidom/score/application_helper.rb
|
44
|
+
- app/jobs/unidom/score/application_job.rb
|
45
|
+
- app/mailers/unidom/score/application_mailer.rb
|
46
|
+
- app/models/unidom/score/application_record.rb
|
47
|
+
- app/models/unidom/score/score_sheet.rb
|
48
|
+
- app/views/layouts/unidom/score/application.html.erb
|
49
|
+
- config/routes.rb
|
50
|
+
- db/migrate/20060111000000_create_unidom_score_sheets.rb
|
51
|
+
- lib/tasks/score_tasks.rake
|
52
|
+
- lib/unidom/score.rb
|
53
|
+
- lib/unidom/score/engine.rb
|
54
|
+
- lib/unidom/score/version.rb
|
55
|
+
homepage: https://github.com/topbitdu/unidom-score
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.6.4
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: Unidom Score Domain Model Engine 评分领域模型引擎
|
79
|
+
test_files: []
|