active_recall 1.6.0 → 1.6.1
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/README.md +5 -2
- data/lib/active_recall/item_methods.rb +2 -6
- data/lib/active_recall/models/deck.rb +2 -0
- data/lib/active_recall/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfa5de74ed9196b1484d8ff5829edae52adc82d7cec8c5c42b22f5c71abaae2b
|
4
|
+
data.tar.gz: 1e17d2f83a70bdbf4a5e0184bb89cb4f36aab98b94e0210dc9e32ce48b1769ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 397d873582d9cd7b6591f1c2bf78888eddca83d7936020acb1d5b4d0b9ede6f9fa211b6a3b800ccb49de13c33c42e23d951bc2d3475e7870f5dd17b40f1d58f6
|
7
|
+
data.tar.gz: 234e542f97ca7f0454f362b59db98dec06c56ed7c93e0ae4654c48e788eb45f95466054ddc75d7862596eb24db2194d5771ff23283e0671523645242429dad88
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -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
|
|
@@ -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
|
@@ -42,12 +42,14 @@ module ActiveRecall
|
|
42
42
|
.destroy
|
43
43
|
end
|
44
44
|
|
45
|
+
# OPTIMIZE: Attempt in active record, rather than array of Ruby records
|
45
46
|
def review
|
46
47
|
%i[untested failed expired].inject([]) do |words, s|
|
47
48
|
words += items.send(s).order(random_order_function).map(&:source)
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
52
|
+
# OPTIMIZE: Use optimized #review and build only the record to be returned
|
51
53
|
def next
|
52
54
|
word = nil
|
53
55
|
%i[untested failed expired].each do |category|
|