active_recall 1.5.0 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +1 -1
- data/Gemfile.lock +14 -14
- data/README.md +6 -3
- data/active_recall.gemspec +4 -4
- data/lib/active_recall/algorithms/fibonacci_sequence.rb +4 -2
- data/lib/active_recall/deck_methods.rb +2 -2
- data/lib/active_recall/item_methods.rb +2 -6
- data/lib/active_recall/models/deck.rb +5 -2
- data/lib/active_recall/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e993b98e9627ec06e8eae73c3fba15a6ed761b66dbb1092b1355140cb2bd366
|
4
|
+
data.tar.gz: 5402a3ae205e52b20587ab73a5d819eaf7102dea5d52cf983e4be5beddf5279d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aba48fb3870fd48fba35a371b48ceeaad4fb306acef718175f67451ee25111ec6389faaf0c52d9424ad1b87da94faf1c24b66f32f920392fa4b7e68ebbb27699
|
7
|
+
data.tar.gz: 2c9c4651bd1e4ac541ffb4c258e899bf311cd84ec6cc4490b643ef1a27bc236c9820e5e30b5af22ee4673413dfad5e0bacbdbcd7344494c9df2059e3472fee17
|
data/.github/workflows/tests.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_recall (1.
|
5
|
-
activerecord (>= 5.2.3, <= 6.
|
6
|
-
activesupport (>= 5.2.3, <= 6.
|
4
|
+
active_recall (1.6.3)
|
5
|
+
activerecord (>= 5.2.3, <= 6.2)
|
6
|
+
activesupport (>= 5.2.3, <= 6.2)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (6.1.
|
12
|
-
activesupport (= 6.1.
|
13
|
-
activerecord (6.1.
|
14
|
-
activemodel (= 6.1.
|
15
|
-
activesupport (= 6.1.
|
16
|
-
activesupport (6.1.
|
11
|
+
activemodel (6.1.4)
|
12
|
+
activesupport (= 6.1.4)
|
13
|
+
activerecord (6.1.4)
|
14
|
+
activemodel (= 6.1.4)
|
15
|
+
activesupport (= 6.1.4)
|
16
|
+
activesupport (6.1.4)
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
18
|
i18n (>= 1.6, < 2)
|
19
19
|
minitest (>= 5.1)
|
20
20
|
tzinfo (~> 2.0)
|
21
21
|
zeitwerk (~> 2.3)
|
22
|
-
concurrent-ruby (1.1.
|
22
|
+
concurrent-ruby (1.1.9)
|
23
23
|
diff-lcs (1.3)
|
24
|
-
i18n (1.8.
|
24
|
+
i18n (1.8.10)
|
25
25
|
concurrent-ruby (~> 1.0)
|
26
|
-
minitest (5.14.
|
26
|
+
minitest (5.14.4)
|
27
27
|
rake (12.3.3)
|
28
28
|
rdoc (6.2.0)
|
29
29
|
rspec (3.8.0)
|
@@ -49,9 +49,9 @@ PLATFORMS
|
|
49
49
|
|
50
50
|
DEPENDENCIES
|
51
51
|
active_recall!
|
52
|
-
rake (
|
52
|
+
rake (>= 12.0)
|
53
53
|
rdoc
|
54
|
-
rspec (
|
54
|
+
rspec (>= 3.0)
|
55
55
|
sqlite3
|
56
56
|
|
57
57
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
**ActiveRecall** is a spaced-repetition system that allows you to treat arbitrary [ActiveRecord](https://github.com/rails/rails/tree/master/activerecord) models as if they were flashcards to be learned and reviewed.
|
4
4
|
It it based on, and is intended to be backwards compatible with, the [okubo](https://github.com/rgravina/okubo) gem.
|
5
|
-
The primary differentiating features are that it lets the user specify the scheduling algorithm and is fully compatible with Rails 6.0 and Ruby 3.0.
|
5
|
+
The primary differentiating features are that it lets the user specify the scheduling algorithm and is fully compatible with Rails 6.0 (and 6.1) and Ruby 3.0.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -116,9 +116,12 @@ user.words.next #=> nil
|
|
116
116
|
|
117
117
|
## Development
|
118
118
|
|
119
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
119
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
120
|
+
Then, run `rake spec` to run the tests.
|
121
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
120
122
|
|
121
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
123
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
124
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
122
125
|
|
123
126
|
## Contributing
|
124
127
|
|
data/active_recall.gemspec
CHANGED
@@ -32,10 +32,10 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
33
33
|
spec.require_paths = ['lib']
|
34
34
|
|
35
|
-
spec.add_development_dependency 'rake', '
|
35
|
+
spec.add_development_dependency 'rake', '>= 12.0'
|
36
36
|
spec.add_development_dependency 'rdoc'
|
37
|
-
spec.add_development_dependency 'rspec', '
|
37
|
+
spec.add_development_dependency 'rspec', '>= 3.0'
|
38
38
|
spec.add_development_dependency 'sqlite3'
|
39
|
-
spec.add_runtime_dependency 'activerecord', '>= 5.2.3', '<= 6.
|
40
|
-
spec.add_runtime_dependency 'activesupport', '>= 5.2.3', '<= 6.
|
39
|
+
spec.add_runtime_dependency 'activerecord', '>= 5.2.3', '<= 6.2'
|
40
|
+
spec.add_runtime_dependency 'activesupport', '>= 5.2.3', '<= 6.2'
|
41
41
|
end
|
@@ -51,9 +51,11 @@ module ActiveRecall
|
|
51
51
|
|
52
52
|
attr_reader :box, :current_time, :times_right, :times_wrong
|
53
53
|
|
54
|
+
SEQUENCE = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765].freeze
|
55
|
+
|
54
56
|
def fibonacci_number_at(index)
|
55
|
-
if (0
|
56
|
-
index
|
57
|
+
if (0...SEQUENCE.length).cover?(index)
|
58
|
+
SEQUENCE[index]
|
57
59
|
else
|
58
60
|
fibonacci_number_at(index - 1) + fibonacci_number_at(index - 2)
|
59
61
|
end
|
@@ -3,10 +3,10 @@
|
|
3
3
|
module ActiveRecall
|
4
4
|
module DeckMethods
|
5
5
|
def deck
|
6
|
-
d = ActiveRecall::Deck.
|
6
|
+
d = ActiveRecall::Deck.find_or_create_by(user_id: id, user_type: self.class.name)
|
7
7
|
d.source_class.module_eval do
|
8
8
|
def stats
|
9
|
-
ActiveRecall::Item.
|
9
|
+
ActiveRecall::Item.find_by(source_id: id, source_type: self.class.name)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
d
|
@@ -3,15 +3,11 @@
|
|
3
3
|
module ActiveRecall
|
4
4
|
module ItemMethods
|
5
5
|
def right_answer_for!(item)
|
6
|
-
|
7
|
-
i.right!
|
8
|
-
i.save!
|
6
|
+
deck.items.find_by(source_id: item.id).right!
|
9
7
|
end
|
10
8
|
|
11
9
|
def wrong_answer_for!(item)
|
12
|
-
|
13
|
-
i.wrong!
|
14
|
-
i.save!
|
10
|
+
deck.items.find_by(source_id: item.id).wrong!
|
15
11
|
end
|
16
12
|
end
|
17
13
|
end
|
@@ -37,16 +37,19 @@ module ActiveRecall
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def delete(source)
|
40
|
-
|
41
|
-
|
40
|
+
ActiveRecall::Item
|
41
|
+
.find_by(deck: self, source_id: source.id, source_type: source.class.name)
|
42
|
+
.destroy
|
42
43
|
end
|
43
44
|
|
45
|
+
# OPTIMIZE: Attempt in active record, rather than array of Ruby records
|
44
46
|
def review
|
45
47
|
%i[untested failed expired].inject([]) do |words, s|
|
46
48
|
words += items.send(s).order(random_order_function).map(&:source)
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
52
|
+
# OPTIMIZE: Use optimized #review and build only the record to be returned
|
50
53
|
def next
|
51
54
|
word = nil
|
52
55
|
%i[untested failed expired].each do |category|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_recall
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Gravina
|
@@ -9,20 +9,20 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '12.0'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '12.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
@@ -43,14 +43,14 @@ dependencies:
|
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - "
|
46
|
+
- - ">="
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '3.0'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- - "
|
53
|
+
- - ">="
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '3.0'
|
56
56
|
- !ruby/object:Gem::Dependency
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: 5.2.3
|
77
77
|
- - "<="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: '6.
|
79
|
+
version: '6.2'
|
80
80
|
type: :runtime
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -86,7 +86,7 @@ dependencies:
|
|
86
86
|
version: 5.2.3
|
87
87
|
- - "<="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '6.
|
89
|
+
version: '6.2'
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
91
|
name: activesupport
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
version: 5.2.3
|
97
97
|
- - "<="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: '6.
|
99
|
+
version: '6.2'
|
100
100
|
type: :runtime
|
101
101
|
prerelease: false
|
102
102
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
version: 5.2.3
|
107
107
|
- - "<="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '6.
|
109
|
+
version: '6.2'
|
110
110
|
description: A spaced-repetition system to be used with ActiveRecord models
|
111
111
|
email:
|
112
112
|
- robert.gravina@gmail.com
|