active_recall 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1784eaa3c18a644a3b7b16935626de436851355d6ec1f0ac19367ef2d789a873
4
- data.tar.gz: '08e4a478783a55852dbefa1d0f6703ab2e44b4c02cd493e7091ff8cd715f4f43'
3
+ metadata.gz: cfa5de74ed9196b1484d8ff5829edae52adc82d7cec8c5c42b22f5c71abaae2b
4
+ data.tar.gz: 1e17d2f83a70bdbf4a5e0184bb89cb4f36aab98b94e0210dc9e32ce48b1769ba
5
5
  SHA512:
6
- metadata.gz: d80c727f175317bb7173721981dba6eaea93e8e6a13793e3fc38ffebf0215b998c58904b936c6fb9cbd9784a3a6641ce35016402e6b85ef335f8df3c8bf622a5
7
- data.tar.gz: e645b4e3cd9ee513885f3a766d7d0566efa12bae1be14e0c3593c130bc6a10083544ffdb1e71a22e9a0cd313f1415811aa9fec3c734c9839c677a367f21e91be
6
+ metadata.gz: 397d873582d9cd7b6591f1c2bf78888eddca83d7936020acb1d5b4d0b9ede6f9fa211b6a3b800ccb49de13c33c42e23d951bc2d3475e7870f5dd17b40f1d58f6
7
+ data.tar.gz: 234e542f97ca7f0454f362b59db98dec06c56ed7c93e0ae4654c48e788eb45f95466054ddc75d7862596eb24db2194d5771ff23283e0671523645242429dad88
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active_recall (1.6.0)
4
+ active_recall (1.6.1)
5
5
  activerecord (>= 5.2.3, <= 6.1)
6
6
  activesupport (>= 5.2.3, <= 6.1)
7
7
 
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. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
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`. 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).
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
- i = deck.items.find_by(source_id: item.id)
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
- i = deck.items.find_by(source_id: item.id)
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|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecall
4
- VERSION = '1.6.0'
4
+ VERSION = '1.6.1'
5
5
  end
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.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Gravina