active_recall 1.8.3 → 1.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/console +9 -0
- data/lib/active_recall/algorithms/fibonacci_sequence.rb +1 -1
- data/lib/active_recall/base.rb +3 -0
- data/lib/active_recall/models/deck.rb +12 -14
- data/lib/active_recall/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e96531570c81f3e7457acc497a7db792708b6b765794e2294b00cce0bd0cfe2
|
4
|
+
data.tar.gz: 06c2f07e0438fc376beefe980dbdc579f06bb7d8bab77e692faed876b5a69629
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8c4385a5646b277f27b6a90505e6f55847eba3d5e96bb32e0694f9148a018f71846d5cb9d552078a5c215965e5d72f6661f96c64885e9199ff557e77b47b059
|
7
|
+
data.tar.gz: 9089edaa9ef21c0d1a8750d60b223ac4cda49c075268bee4bea25493b7951c3bd31747a129a93721f0e239efb41bb9d7db3a6f96d157d9b2f95930494f812c91
|
data/Gemfile.lock
CHANGED
data/bin/console
ADDED
data/lib/active_recall/base.rb
CHANGED
@@ -9,27 +9,21 @@ module ActiveRecall
|
|
9
9
|
has_many :items, class_name: "ActiveRecall::Item", dependent: :destroy
|
10
10
|
|
11
11
|
def each
|
12
|
-
_items.
|
13
|
-
if block_given?
|
14
|
-
yield item
|
15
|
-
else
|
16
|
-
yield item
|
17
|
-
end
|
18
|
-
end
|
12
|
+
_items.find_each { |item| yield item }
|
19
13
|
end
|
20
14
|
|
21
15
|
def ==(other)
|
22
16
|
_items == other
|
23
17
|
end
|
24
18
|
|
25
|
-
def _items
|
26
|
-
source_class.find(items.pluck(:source_id))
|
27
|
-
end
|
28
|
-
|
29
19
|
def <<(source)
|
30
|
-
|
20
|
+
attributes = {deck: self, source_id: source.id, source_type: source.class.name}
|
31
21
|
|
32
|
-
|
22
|
+
if ActiveRecall::Item.exists?(attributes)
|
23
|
+
raise ArgumentError, "Word already in the stack"
|
24
|
+
end
|
25
|
+
|
26
|
+
items << ActiveRecall::Item.new(attributes)
|
33
27
|
end
|
34
28
|
|
35
29
|
def self.add_deck(user)
|
@@ -71,7 +65,7 @@ module ActiveRecall
|
|
71
65
|
end
|
72
66
|
|
73
67
|
def box(number)
|
74
|
-
source_class.
|
68
|
+
source_class.where(id: items.where(box: number).select(:source_id))
|
75
69
|
end
|
76
70
|
|
77
71
|
def source_class
|
@@ -80,6 +74,10 @@ module ActiveRecall
|
|
80
74
|
|
81
75
|
private
|
82
76
|
|
77
|
+
def _items
|
78
|
+
source_class.where(id: items.select(:source_id))
|
79
|
+
end
|
80
|
+
|
83
81
|
def _review
|
84
82
|
items
|
85
83
|
.untested
|
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.8.
|
4
|
+
version: 1.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Gravina
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-06
|
12
|
+
date: 2023-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -125,6 +125,7 @@ files:
|
|
125
125
|
- README.md
|
126
126
|
- Rakefile
|
127
127
|
- active_recall.gemspec
|
128
|
+
- bin/console
|
128
129
|
- bin/setup
|
129
130
|
- lib/active_recall.rb
|
130
131
|
- lib/active_recall/algorithms/fibonacci_sequence.rb
|