active_recall 1.6.0 → 1.6.4
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 +4 -4
- data/Gemfile.lock +13 -13
- 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/item_methods.rb +2 -6
- data/lib/active_recall/models/deck.rb +10 -9
- 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: 90faada77c84371101ce19140d8c0e113fa06a831ed0c11613ac46bc7221a798
         | 
| 4 | 
            +
              data.tar.gz: 6aaaf972df81c2341143307c4998bcb7c0b0017e1e0979bc54b8bddaf5a74d86
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3a4cf31bf1d9860b954aaaf482dfc4ac990012b6ea65432135f267d324505ddad9f856deca45318c3671b69b339c1a53bc8b6c10bb99ce3bad54db6f5b4736ea
         | 
| 7 | 
            +
              data.tar.gz: 87cb8640cf8f2ed2bdcdda45c36064f943c303d001155676160f357b1190d64b6451ac3d68091d92f7db6cc7c64b6cb4c73a10781c390ea0edfb89185e69ad4f
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,27 +1,27 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                active_recall (1.6. | 
| 5 | 
            -
                  activerecord (>= 5.2.3, <= 6. | 
| 6 | 
            -
                  activesupport (>= 5.2.3, <= 6. | 
| 4 | 
            +
                active_recall (1.6.4)
         | 
| 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.1)
         | 
| 12 | 
            +
                  activesupport (= 6.1.4.1)
         | 
| 13 | 
            +
                activerecord (6.1.4.1)
         | 
| 14 | 
            +
                  activemodel (= 6.1.4.1)
         | 
| 15 | 
            +
                  activesupport (= 6.1.4.1)
         | 
| 16 | 
            +
                activesupport (6.1.4.1)
         | 
| 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 26 | 
             
                minitest (5.14.4)
         | 
| 27 27 | 
             
                rake (12.3.3)
         | 
| @@ -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,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
         | 
| @@ -43,18 +43,11 @@ module ActiveRecall | |
| 43 43 | 
             
                end
         | 
| 44 44 |  | 
| 45 45 | 
             
                def review
         | 
| 46 | 
            -
                   | 
| 47 | 
            -
                    words += items.send(s).order(random_order_function).map(&:source)
         | 
| 48 | 
            -
                  end
         | 
| 46 | 
            +
                  _review.map(&:source)
         | 
| 49 47 | 
             
                end
         | 
| 50 48 |  | 
| 51 49 | 
             
                def next
         | 
| 52 | 
            -
                   | 
| 53 | 
            -
                  %i[untested failed expired].each do |category|
         | 
| 54 | 
            -
                    word = items.send(category).order(random_order_function).limit(1).map(&:source).first
         | 
| 55 | 
            -
                    break if word
         | 
| 56 | 
            -
                  end
         | 
| 57 | 
            -
                  word
         | 
| 50 | 
            +
                  _review.first.try(:source)
         | 
| 58 51 | 
             
                end
         | 
| 59 52 |  | 
| 60 53 | 
             
                def last
         | 
| @@ -87,6 +80,14 @@ module ActiveRecall | |
| 87 80 |  | 
| 88 81 | 
             
                private
         | 
| 89 82 |  | 
| 83 | 
            +
                def _review
         | 
| 84 | 
            +
                  items
         | 
| 85 | 
            +
                    .untested
         | 
| 86 | 
            +
                    .or(items.failed)
         | 
| 87 | 
            +
                    .or(items.expired)
         | 
| 88 | 
            +
                    .order(random_order_function)
         | 
| 89 | 
            +
                end
         | 
| 90 | 
            +
             | 
| 90 91 | 
             
                def random_order_function
         | 
| 91 92 | 
             
                  Arel.sql(mysql? ? 'RAND()' : 'random()')
         | 
| 92 93 | 
             
                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. | 
| 4 | 
            +
              version: 1.6.4
         | 
| 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-09-17 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
         |