fine_print 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fine_print/version.rb +1 -1
- data/lib/fine_print/version.rb~ +1 -1
- data/lib/fine_print.rb +2 -2
- data/lib/fine_print.rb~ +21 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +26 -0
- data/spec/dummy/log/test.log +1693 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 737d9043df423544d60771c30e22ef71811bcb4b
|
4
|
+
data.tar.gz: 6e54249ed44c5178b6fe8ea17d6518680cf5436b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 268d93027f2008ebadafed4b5dd735235b3506fa0bb7813af8be63dc727e3178ae25c09c885d92d03b7290bc9298bbb4e62116998db17c0d4df76c0cc1f716ef
|
7
|
+
data.tar.gz: 3f1c3ccdf8fcdb31522c61cf524c5b979f566ad80d75a0c4d703c4ae3a6889bafc79084613533e256388ad110739a2902f0de34236527ce25b079d22ba5b3d25
|
data/lib/fine_print/version.rb
CHANGED
data/lib/fine_print/version.rb~
CHANGED
data/lib/fine_print.rb
CHANGED
data/lib/fine_print.rb~
CHANGED
@@ -39,7 +39,7 @@ module FinePrint
|
|
39
39
|
when Integer
|
40
40
|
Contract.find(ref)
|
41
41
|
when String
|
42
|
-
Contract.where(:name => ref).published.first
|
42
|
+
Contract.where(:name => ref.to_s).published.first
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -82,6 +82,26 @@ module FinePrint
|
|
82
82
|
:user_id => user.id).first.nil?
|
83
83
|
end
|
84
84
|
|
85
|
+
# Returns an array of names for the contracts whose latest published
|
86
|
+
# version the given user has not signed.
|
87
|
+
# - user -- the user in question
|
88
|
+
# - names -- contract names to check
|
89
|
+
#
|
90
|
+
def self.get_unsigned_contract_names(user, *names)
|
91
|
+
raise_unless_signed_in(user)
|
92
|
+
names = names.flatten.collect{|name| name.to_s}
|
93
|
+
return [] if names.blank?
|
94
|
+
|
95
|
+
signed_contracts = Contract
|
96
|
+
.joins(:signatures)
|
97
|
+
.where({:name => names,
|
98
|
+
:fine_print_signatures => {:user_id => user.id,
|
99
|
+
:user_type => user.class.name}}).latest
|
100
|
+
signed_contract_names = signed_contracts.collect{|c| c.name}
|
101
|
+
|
102
|
+
return names - signed_contract_names
|
103
|
+
end
|
104
|
+
|
85
105
|
def self.is_signed_in?(user)
|
86
106
|
user_signed_in_proc.call(user)
|
87
107
|
end
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -1745,3 +1745,29 @@ Connecting to database specified by database.yml
|
|
1745
1745
|
[1m[35m (4.4ms)[0m CREATE INDEX "index_fine_print_signatures_on_contract_id" ON "fine_print_signatures" ("contract_id")
|
1746
1746
|
[1m[36m (4.5ms)[0m [1mCREATE UNIQUE INDEX "index_fine_print_s_on_u_id_and_u_type_and_c_id" ON "fine_print_signatures" ("user_id", "user_type", "contract_id")[0m
|
1747
1747
|
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
1748
|
+
Connecting to database specified by database.yml
|
1749
|
+
[1m[36m (0.0ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
1750
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
1751
|
+
[1m[36m (59.6ms)[0m [1mDROP TABLE "dummy_users"[0m
|
1752
|
+
[1m[35m (5.0ms)[0m CREATE TABLE "dummy_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "is_admin" boolean DEFAULT 'f' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
1753
|
+
[1m[36m (5.1ms)[0m [1mDROP TABLE "fine_print_contracts"[0m
|
1754
|
+
[1m[35m (4.5ms)[0m CREATE TABLE "fine_print_contracts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "version" integer, "title" varchar(255) NOT NULL, "content" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
1755
|
+
[1m[36m (6.2ms)[0m [1mCREATE UNIQUE INDEX "index_fine_print_contracts_on_name_and_version" ON "fine_print_contracts" ("name", "version")[0m
|
1756
|
+
[1m[35m (4.9ms)[0m DROP TABLE "fine_print_signatures"
|
1757
|
+
[1m[36m (4.8ms)[0m [1mCREATE TABLE "fine_print_signatures" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "contract_id" integer NOT NULL, "user_id" integer NOT NULL, "user_type" varchar(255) NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
1758
|
+
[1m[35m (4.3ms)[0m CREATE INDEX "index_fine_print_signatures_on_contract_id" ON "fine_print_signatures" ("contract_id")
|
1759
|
+
[1m[36m (4.6ms)[0m [1mCREATE UNIQUE INDEX "index_fine_print_s_on_u_id_and_u_type_and_c_id" ON "fine_print_signatures" ("user_id", "user_type", "contract_id")[0m
|
1760
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
1761
|
+
Connecting to database specified by database.yml
|
1762
|
+
[1m[36m (0.0ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
1763
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
1764
|
+
[1m[36m (20.7ms)[0m [1mDROP TABLE "dummy_users"[0m
|
1765
|
+
[1m[35m (4.3ms)[0m CREATE TABLE "dummy_users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "is_admin" boolean DEFAULT 'f' NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
1766
|
+
[1m[36m (4.4ms)[0m [1mDROP TABLE "fine_print_contracts"[0m
|
1767
|
+
[1m[35m (4.3ms)[0m CREATE TABLE "fine_print_contracts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) NOT NULL, "version" integer, "title" varchar(255) NOT NULL, "content" text NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
1768
|
+
[1m[36m (4.6ms)[0m [1mCREATE UNIQUE INDEX "index_fine_print_contracts_on_name_and_version" ON "fine_print_contracts" ("name", "version")[0m
|
1769
|
+
[1m[35m (4.6ms)[0m DROP TABLE "fine_print_signatures"
|
1770
|
+
[1m[36m (4.4ms)[0m [1mCREATE TABLE "fine_print_signatures" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "contract_id" integer NOT NULL, "user_id" integer NOT NULL, "user_type" varchar(255) NOT NULL, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
1771
|
+
[1m[35m (4.2ms)[0m CREATE INDEX "index_fine_print_signatures_on_contract_id" ON "fine_print_signatures" ("contract_id")
|
1772
|
+
[1m[36m (4.2ms)[0m [1mCREATE UNIQUE INDEX "index_fine_print_s_on_u_id_and_u_type_and_c_id" ON "fine_print_signatures" ("user_id", "user_type", "contract_id")[0m
|
1773
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|