fine_print 5.0.0 → 6.0.1

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: f98bbe712ac212f8a867b40027680989430cc471c23bf78e3e136a7151d561ed
4
- data.tar.gz: 8aae23a16b7164d402e9c32754a64216f92c236014d237493ef863f3e6c93e35
3
+ metadata.gz: 36c354c7847e144c71413d80b85ff33cd0c8557c56e962f4e52f76633b4736e1
4
+ data.tar.gz: 8ed54d4e8fe86be2fbe20d9a135e56328ede04d377625edfe21ec8a1c9431c2b
5
5
  SHA512:
6
- metadata.gz: 9cc690921fa7478187f3eb939cc221097a61a3efaf062ff5a96694f7303bdc9be9966b0bfa16347ec0b094e0ab5ab44ea50c6958886e807a514d698f016fa962
7
- data.tar.gz: bdc9ef70427216f97e3854d603a9b0ce265765272b7d735e6b57a94d296349ae6a1d24ccb881436079f92990316b4f74cbdc4e5a6e5d383c04618c476dcb9376
6
+ metadata.gz: 119712381276c0e3b6d4980c35187dddfc730bbcd38af142b60a91136939f48aeb7d2d5c62bc057baa2b10702fe911ede772108818ca688fac2fcf501d096dc8
7
+ data.tar.gz: 5925eca798f95541aee4d54169155a69e30be2aa3ff026ad4dd6824ef79b7bb0ef3bc9f2a31094371a9285cead44d25087d254b58608ea79830ec62220c46d9d
@@ -5,7 +5,14 @@ module FinePrint
5
5
  before_action :get_contract, except: [:index, :new, :create]
6
6
 
7
7
  def index
8
- @contracts = Contract.includes(:signatures).all.to_a.group_by(&:name)
8
+ @contracts = Contract.select(
9
+ <<~EOS
10
+ "fine_print_contracts".*, (
11
+ SELECT COUNT(*) FROM "fine_print_signatures"
12
+ WHERE "fine_print_signatures"."contract_id" = "fine_print_contracts"."id"
13
+ ) AS "signatures_count"
14
+ EOS
15
+ ).all.to_a.group_by(&:name)
9
16
  end
10
17
 
11
18
  def new
@@ -17,7 +24,7 @@ module FinePrint
17
24
  @contract.name = params[:contract][:name]
18
25
  @contract.title = params[:contract][:title]
19
26
  @contract.content = params[:contract][:content]
20
-
27
+
21
28
  if @contract.save
22
29
  redirect_to @contract, notice: t('fine_print.contract.notices.created')
23
30
  else
@@ -24,12 +24,7 @@ module FinePrint
24
24
  joins(:same_name).group(:id).having(fpc[:version].eq(sn[:version].maximum))
25
25
  end
26
26
  scope :signed_by, ->(user) do
27
- joins(:signatures).where(
28
- # Originally this would be:
29
- # signatures: { user_id: user.id, user_type: class_name_for(user) }
30
- # This is broken in Rails 5 without a monkeypatch, so instead we use the following for now:
31
- fine_print_signatures: { user_id: user.id, user_type: class_name_for(user) }
32
- )
27
+ joins(:signatures).where(signatures: { user_id: user.id, user_type: class_name_for(user) })
33
28
  end
34
29
 
35
30
  def is_published?
@@ -9,7 +9,7 @@
9
9
 
10
10
  <ul class='fine_print'>
11
11
  <li><%= name %></li>
12
-
12
+
13
13
  <ul class='fine_print'>
14
14
  <% contracts.each do |contract| %>
15
15
  <li><%= link_to contract.title, contract, class: 'fine_print link' %>
@@ -17,7 +17,7 @@
17
17
  t('fine_print.contract.status.draft') : \
18
18
  t('fine_print.contract.status.version',
19
19
  version: contract.version.to_s) %>)
20
- <% if contract.signatures.empty? %>
20
+ <% if contract.signatures_count == 0 %>
21
21
  [<%= link_to t('fine_print.contract.actions.edit'),
22
22
  edit_contract_path(contract),
23
23
  class: 'fine_print link' %>]
@@ -63,7 +63,7 @@
63
63
  </li>
64
64
  <% end %>
65
65
  </ul>
66
-
66
+
67
67
  </ul>
68
68
 
69
69
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module FinePrint
2
- VERSION = '5.0.0'
2
+ VERSION = '6.0.1'
3
3
  end
Binary file
Binary file
@@ -1,96 +1,95 @@
1
-  (0.0ms) SELECT sqlite_version(*)
2
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
3
-  (10.8ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
4
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
5
-  (17.1ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
6
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
1
+  (0.1ms) SELECT sqlite_version(*)
2
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
3
+  (1.9ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
4
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
5
+  (1.5ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
6
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
7
7
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
8
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
8
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
9
+ Migrating to InstallFinePrint (0)
10
+  (0.0ms) begin transaction
11
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
12
+  (0.5ms) CREATE TABLE "fine_print_contracts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "version" integer, "title" varchar NOT NULL, "content" text NOT NULL, "created_at" datetime, "updated_at" datetime)
13
+ ↳ /Users/dante/Desktop/fine_print/db/migrate/0_install_fine_print.rb:3
14
+  (0.1ms) CREATE UNIQUE INDEX "index_fine_print_contracts_on_name_and_version" ON "fine_print_contracts" ("name", "version")
15
+ ↳ /Users/dante/Desktop/fine_print/db/migrate/0_install_fine_print.rb:12
16
+  (0.1ms) CREATE TABLE "fine_print_signatures" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "contract_id" integer NOT NULL, "user_type" varchar NOT NULL, "user_id" integer NOT NULL, "created_at" datetime, "updated_at" datetime)
17
+ ↳ /Users/dante/Desktop/fine_print/db/migrate/0_install_fine_print.rb:14
18
+  (0.1ms) CREATE 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")
19
+ ↳ /Users/dante/Desktop/fine_print/db/migrate/0_install_fine_print.rb:21
20
+  (0.1ms) CREATE INDEX "index_fine_print_signatures_on_contract_id" ON "fine_print_signatures" ("contract_id")
21
+ ↳ /Users/dante/Desktop/fine_print/db/migrate/0_install_fine_print.rb:24
22
+ ActiveRecord::SchemaMigration Create (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "0"]]
23
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
24
+  (1.1ms) commit transaction
25
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
26
+ Migrating to AddImplicitSignatures (1)
27
+  (0.0ms) begin transaction
28
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
29
+  (0.6ms) ALTER TABLE "fine_print_signatures" ADD "is_implicit" boolean DEFAULT 0 NOT NULL
30
+ ↳ /Users/dante/Desktop/fine_print/db/migrate/1_add_implicit_signatures.rb:3
31
+ ActiveRecord::SchemaMigration Create (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "1"]]
32
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
33
+  (0.8ms) commit transaction
34
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
9
35
  Migrating to CreateDummyUsers (1000)
10
36
   (0.0ms) begin transaction
11
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
12
-  (0.1ms) CREATE TABLE "dummy_users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "is_admin" boolean DEFAULT 0 NOT NULL, "created_at" datetime, "updated_at" datetime)
37
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
38
+  (0.4ms) CREATE TABLE "dummy_users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "is_admin" boolean DEFAULT 0 NOT NULL, "created_at" datetime, "updated_at" datetime)
13
39
  ↳ db/migrate/1000_create_dummy_users.rb:3
14
40
  ActiveRecord::SchemaMigration Create (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "1000"]]
15
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
16
-  (11.5ms) commit transaction
17
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
41
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
42
+  (0.9ms) commit transaction
43
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
18
44
  ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
19
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
45
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
20
46
   (0.0ms) begin transaction
21
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
22
- ActiveRecord::InternalMetadata Create (0.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "development"], ["created_at", "2019-05-23 16:44:31.349445"], ["updated_at", "2019-05-23 16:44:31.349445"]]
23
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
24
-  (13.0ms) commit transaction
25
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
47
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
48
+ ActiveRecord::InternalMetadata Create (0.3ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "development"], ["created_at", "2023-03-21 17:29:24.804592"], ["updated_at", "2023-03-21 17:29:24.804592"]]
49
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
50
+  (0.9ms) commit transaction
51
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
52
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
53
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
54
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
55
+ ↳ /Users/dante/.rbenv/versions/2.7.2/bin/rake:23
56
+  (1.2ms) SELECT sqlite_version(*)
57
+  (0.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
58
+  (1.0ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? [["key", "environment"]]
26
59
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
27
- /home/dante/.rbenv/versions/2.6.1/bin/rake:23
28
-  (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
29
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
60
+  (0.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? [["key", "environment"]]
30
61
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
31
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
32
62
   (0.1ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? [["key", "environment"]]
33
- /home/dante/.rbenv/versions/2.6.1/bin/rake:23
34
-  (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
35
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
36
-  (0.0ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? [["key", "environment"]]
37
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
38
-  (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
39
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
40
-  (0.0ms) SELECT "ar_internal_metadata"."value" FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? [["key", "environment"]]
41
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
63
+  (0.1ms) SELECT sqlite_version(*)
64
+  (0.0ms) SELECT sqlite_version(*)
42
65
   (0.0ms) SELECT sqlite_version(*)
43
- /home/dante/.rbenv/versions/2.6.1/bin/rake:23
44
-  (15.9ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
45
- /home/dante/.rbenv/versions/2.6.1/bin/rake:23
46
-  (15.7ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
47
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
48
-  (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
49
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
66
+  (1.7ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
67
+  (1.5ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL)
68
+  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
50
69
  Migrating to InstallFinePrint (0)
51
-  (0.0ms) begin transaction
52
- /home/dante/.rbenv/versions/2.6.1/bin/rake:23
53
-  (0.1ms) CREATE TABLE "fine_print_contracts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "version" integer, "title" varchar NOT NULL, "content" text NOT NULL, "created_at" datetime, "updated_at" datetime)
54
- ↳ /home/dante/Desktop/fine_print/db/migrate/0_install_fine_print.rb:3
70
+ TRANSACTION (0.1ms) begin transaction
71
+  (0.4ms) CREATE TABLE "fine_print_contracts" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar NOT NULL, "version" integer, "title" varchar NOT NULL, "content" text NOT NULL, "created_at" datetime, "updated_at" datetime)
55
72
   (0.1ms) CREATE UNIQUE INDEX "index_fine_print_contracts_on_name_and_version" ON "fine_print_contracts" ("name", "version")
56
- ↳ /home/dante/Desktop/fine_print/db/migrate/0_install_fine_print.rb:12
57
73
   (0.1ms) CREATE TABLE "fine_print_signatures" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "contract_id" integer NOT NULL, "user_type" varchar NOT NULL, "user_id" integer NOT NULL, "created_at" datetime, "updated_at" datetime)
58
- ↳ /home/dante/Desktop/fine_print/db/migrate/0_install_fine_print.rb:14
59
74
   (0.1ms) CREATE 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")
60
- /home/dante/Desktop/fine_print/db/migrate/0_install_fine_print.rb:21
61
-  (0.1ms) CREATE INDEX "index_fine_print_signatures_on_contract_id" ON "fine_print_signatures" ("contract_id")
62
- ↳ /home/dante/Desktop/fine_print/db/migrate/0_install_fine_print.rb:24
75
+  (0.1ms) CREATE INDEX "index_fine_print_signatures_on_contract_id" ON "fine_print_signatures" ("contract_id")
63
76
  ActiveRecord::SchemaMigration Create (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "0"]]
64
- /home/dante/.rbenv/versions/2.6.1/bin/rake:23
65
-  (12.9ms) commit transaction
66
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
77
+ TRANSACTION (1.2ms) commit transaction
67
78
  Migrating to AddImplicitSignatures (1)
68
-  (0.0ms) begin transaction
69
- /home/dante/.rbenv/versions/2.6.1/bin/rake:23
70
-  (0.2ms) ALTER TABLE "fine_print_signatures" ADD "is_implicit" boolean DEFAULT 0 NOT NULL
71
- /home/dante/Desktop/fine_print/db/migrate/1_add_implicit_signatures.rb:3
72
- ActiveRecord::SchemaMigration Create (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "1"]]
73
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
74
-  (15.7ms) commit transaction
75
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
79
+ TRANSACTION (0.0ms) begin transaction
80
+  (0.6ms) ALTER TABLE "fine_print_signatures" ADD "is_implicit" boolean DEFAULT 0 NOT NULL
81
+ ActiveRecord::SchemaMigration Create (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "1"]]
82
+ TRANSACTION (0.9ms) commit transaction
76
83
  Migrating to CreateDummyUsers (1000)
77
-  (0.0ms) begin transaction
78
- /home/dante/.rbenv/versions/2.6.1/bin/rake:23
79
-  (0.2ms) CREATE TABLE "dummy_users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "is_admin" boolean DEFAULT 0 NOT NULL, "created_at" datetime, "updated_at" datetime)
80
- ↳ db/migrate/1000_create_dummy_users.rb:3
84
+ TRANSACTION (0.1ms) begin transaction
85
+  (0.4ms) CREATE TABLE "dummy_users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "is_admin" boolean DEFAULT 0 NOT NULL, "created_at" datetime, "updated_at" datetime)
81
86
  ActiveRecord::SchemaMigration Create (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "1000"]]
82
- /home/dante/.rbenv/versions/2.6.1/bin/rake:23
83
-  (10.4ms) commit transaction
84
- /home/dante/.rbenv/versions/2.6.1/bin/rake:23
85
- ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
86
- /home/dante/.rbenv/versions/2.6.1/bin/rake:23
87
-  (0.0ms) begin transaction
88
- /home/dante/.rbenv/versions/2.6.1/bin/rake:23
89
- ActiveRecord::InternalMetadata Create (0.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "development"], ["created_at", "2019-05-23 16:45:12.206332"], ["updated_at", "2019-05-23 16:45:12.206332"]]
90
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
91
-  (13.2ms) commit transaction
92
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
87
+ TRANSACTION (1.0ms) commit transaction
88
+ ActiveRecord::InternalMetadata Load (0.2ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
89
+ TRANSACTION (0.1ms) begin transaction
90
+ ActiveRecord::InternalMetadata Create (0.7ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "development"], ["created_at", "2023-03-21 17:38:35.575933"], ["updated_at", "2023-03-21 17:38:35.575933"]]
91
+ TRANSACTION (0.9ms) commit transaction
92
+  (0.1ms) SELECT sqlite_version(*)
93
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
94
+  (0.0ms) SELECT sqlite_version(*)
93
95
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
94
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23
95
-  (0.0ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
96
- ↳ /home/dante/.rbenv/versions/2.6.1/bin/rake:23