hearthside-marginalia 0.1.0 → 0.2.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14c7ff324f7b80a8c952fb664f59bbdd40df805150fef4a7bb99295fbd46a9c4
|
4
|
+
data.tar.gz: d2591c9ec246923e0a4395015ba132acc65d6b73bba85e74d60c98e34c3bad51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bafefb3a1996354fbc23e51927dd99927dcd70714471711f48bf65239cf9f2f3bedcb0e40f05e25c448f9cc8991450a567d03c23471cd4412f2e2368c7a44955
|
7
|
+
data.tar.gz: 50d7bb0dbc6b374768149c35cb6b2b0e11019ccfc3fb20dc987fdc33419b905b2ef45b19a074136841cc1a3b6a8cadb8fbb82385580cba39dcfca0f66ecfb8b6
|
@@ -2,7 +2,7 @@ class Marginalia::Book < Marginalia::ApplicationRecord
|
|
2
2
|
# has_many :author_contributions, class_name: Marginalia::Contribution.name
|
3
3
|
# has_many :authors, class_name: Marginalia::Person.name, through: :author_contributions
|
4
4
|
# has_many :highlights
|
5
|
-
has_many :updates
|
5
|
+
has_many :updates, -> { order(created_at: :asc, progress: :asc) }
|
6
6
|
# has_many :genres
|
7
7
|
|
8
8
|
validates :title, presence: true
|
@@ -12,11 +12,19 @@ class Marginalia::Book < Marginalia::ApplicationRecord
|
|
12
12
|
enum format: [:hardcover, :paperback, :ebook, :audio].to_h { [_1, _1.to_s] }
|
13
13
|
|
14
14
|
def progress
|
15
|
-
case format
|
15
|
+
case format&.to_sym
|
16
16
|
when :audio
|
17
|
-
|
17
|
+
if minutes.to_f == 0.0
|
18
|
+
100
|
19
|
+
else
|
20
|
+
updates.last.progress.to_f / minutes.to_f
|
21
|
+
end
|
18
22
|
else
|
19
|
-
|
23
|
+
if pages.to_f == 0.0
|
24
|
+
100
|
25
|
+
else
|
26
|
+
updates.last.progress.to_f / pages.to_f
|
27
|
+
end
|
20
28
|
end
|
21
29
|
end
|
22
30
|
end
|
@@ -3,14 +3,16 @@ class CreateMarginaliaBooks < ActiveRecord::Migration[7.0]
|
|
3
3
|
create_table :marginalia_books do |t|
|
4
4
|
t.string :title
|
5
5
|
t.string :format
|
6
|
-
t.string :asin
|
7
|
-
t.string :isbn
|
6
|
+
t.string :asin, index: { unique: true }
|
7
|
+
t.string :isbn, index: { unique: true }
|
8
8
|
t.date :published_on
|
9
|
+
t.date :last_completed_on
|
9
10
|
t.integer :pages
|
10
11
|
t.integer :minutes
|
11
12
|
t.integer :rating
|
12
|
-
t.integer :read_count
|
13
13
|
t.text :review
|
14
|
+
t.string :cover_url
|
15
|
+
t.boolean :library
|
14
16
|
|
15
17
|
t.timestamps
|
16
18
|
end
|
data/lib/marginalia/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hearthside-marginalia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caleb Hearth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
169
|
- !ruby/object:Gem::Version
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
|
-
rubygems_version: 3.4.
|
172
|
+
rubygems_version: 3.4.10
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Reading tracking for Hearthside
|