active_recall 1.6.4 → 1.8.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90faada77c84371101ce19140d8c0e113fa06a831ed0c11613ac46bc7221a798
4
- data.tar.gz: 6aaaf972df81c2341143307c4998bcb7c0b0017e1e0979bc54b8bddaf5a74d86
3
+ metadata.gz: 52f95d564c23b6dc54674db372b9d96d2337c8e04fb2f35914fdb5e72b286cf5
4
+ data.tar.gz: 0fbf28c7111877c329e7953f3593cad3e8c0ecea0682ede2f078443edd175c58
5
5
  SHA512:
6
- metadata.gz: 3a4cf31bf1d9860b954aaaf482dfc4ac990012b6ea65432135f267d324505ddad9f856deca45318c3671b69b339c1a53bc8b6c10bb99ce3bad54db6f5b4736ea
7
- data.tar.gz: 87cb8640cf8f2ed2bdcdda45c36064f943c303d001155676160f357b1190d64b6451ac3d68091d92f7db6cc7c64b6cb4c73a10781c390ea0edfb89185e69ad4f
6
+ metadata.gz: 97baebcca8289c8460138360ebf3440fbd47646d74dc8c28ee77d762a7cdb91fd23f6069737058adb9dd08e38fe3323cec409e1e4a7a23c4120eee8b0a83ee95
7
+ data.tar.gz: 4e94302dd2412f9803167442f323f42335072a29facc90bc46db77f2650485432851b85ac087745a1e6e0c518c20abe93d049eff89531b511447ef76b0f7ec7a
@@ -1,4 +1,4 @@
1
- name: Tests
1
+ name: Tests
2
2
 
3
3
  on:
4
4
  pull_request:
@@ -16,13 +16,13 @@ jobs:
16
16
  fail-fast: false
17
17
  matrix:
18
18
  os:
19
- - macos
19
+ - macos
20
20
  - ubuntu
21
21
  ruby:
22
- - 2.5
23
- - 2.6
24
22
  - 2.7
25
23
  - 3.0
24
+ - 3.1
25
+ - 3.2
26
26
  allow_failures:
27
27
  - false
28
28
  include:
@@ -43,4 +43,4 @@ jobs:
43
43
  ruby-version: ${{ matrix.ruby }}
44
44
  bundler-cache: true
45
45
  - name: Test
46
- run: bundle exec rake spec || $ALLOW_FAILURES
46
+ run: bundle exec rake spec || $ALLOW_FAILURES
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.2.2
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
data/Gemfile.lock CHANGED
@@ -1,29 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- active_recall (1.6.4)
5
- activerecord (>= 5.2.3, <= 6.2)
6
- activesupport (>= 5.2.3, <= 6.2)
4
+ active_recall (1.8.3)
5
+ activerecord (>= 5.2.3, <= 7.1)
6
+ activesupport (>= 5.2.3, <= 7.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
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)
11
+ activemodel (7.0.5.1)
12
+ activesupport (= 7.0.5.1)
13
+ activerecord (7.0.5.1)
14
+ activemodel (= 7.0.5.1)
15
+ activesupport (= 7.0.5.1)
16
+ activesupport (7.0.5.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
- zeitwerk (~> 2.3)
22
- concurrent-ruby (1.1.9)
21
+ concurrent-ruby (1.2.2)
23
22
  diff-lcs (1.3)
24
- i18n (1.8.10)
23
+ i18n (1.14.1)
25
24
  concurrent-ruby (~> 1.0)
26
- minitest (5.14.4)
25
+ minitest (5.18.1)
27
26
  rake (12.3.3)
28
27
  rdoc (6.2.0)
29
28
  rspec (3.8.0)
@@ -40,12 +39,12 @@ GEM
40
39
  rspec-support (~> 3.8.0)
41
40
  rspec-support (3.8.2)
42
41
  sqlite3 (1.4.2)
43
- tzinfo (2.0.4)
42
+ tzinfo (2.0.6)
44
43
  concurrent-ruby (~> 1.0)
45
- zeitwerk (2.4.2)
46
44
 
47
45
  PLATFORMS
48
46
  ruby
47
+ x86_64-linux
49
48
 
50
49
  DEPENDENCIES
51
50
  active_recall!
@@ -55,4 +54,4 @@ DEPENDENCIES
55
54
  sqlite3
56
55
 
57
56
  BUNDLED WITH
58
- 2.2.3
57
+ 2.4.14
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 6.1) 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+ and Ruby 3+.
6
6
 
7
7
  ## Installation
8
8
 
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
@@ -1,26 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('lib', __dir__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'active_recall/version'
5
+ require "active_recall/version"
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = 'active_recall'
9
- spec.version = ActiveRecall::VERSION
10
- spec.authors = ['Robert Gravina', 'Jayson Virissimo']
11
- spec.email = ['robert.gravina@gmail.com', 'jayson.virissimo@asu.edu']
12
- spec.summary = 'A spaced-repetition system'
13
- spec.description = 'A spaced-repetition system to be used with ActiveRecord models'
14
- spec.homepage = 'https://github.com/jaysonvirissimo/active_recall'
15
- spec.license = 'MIT'
8
+ spec.name = "active_recall"
9
+ spec.version = ActiveRecall::VERSION
10
+ spec.authors = ["Robert Gravina", "Jayson Virissimo"]
11
+ spec.email = ["robert.gravina@gmail.com", "jayson.virissimo@asu.edu"]
12
+ spec.summary = "A spaced-repetition system"
13
+ spec.description = "A spaced-repetition system to be used with ActiveRecord models"
14
+ spec.homepage = "https://github.com/jaysonvirissimo/active_recall"
15
+ spec.license = "MIT"
16
16
 
17
17
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
18
  # to allow pushing to a single host or delete this section to allow pushing to any host.
19
19
  if spec.respond_to?(:metadata)
20
- spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
21
21
  else
22
- raise 'RubyGems 2.0 or newer is required to protect against ' \
23
- 'public gem pushes.'
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
24
  end
25
25
 
26
26
  # Specify which files should be added to the gem when it is released.
@@ -28,14 +28,15 @@ Gem::Specification.new do |spec|
28
28
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
29
29
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
30
  end
31
- spec.bindir = 'exe'
32
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
- spec.require_paths = ['lib']
31
+ spec.bindir = "exe"
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
34
 
35
- spec.add_development_dependency 'rake', '>= 12.0'
36
- spec.add_development_dependency 'rdoc'
37
- spec.add_development_dependency 'rspec', '>= 3.0'
38
- spec.add_development_dependency 'sqlite3'
39
- spec.add_runtime_dependency 'activerecord', '>= 5.2.3', '<= 6.2'
40
- spec.add_runtime_dependency 'activesupport', '>= 5.2.3', '<= 6.2'
35
+ spec.add_development_dependency "rake", ">= 12.0"
36
+ spec.add_development_dependency "rdoc"
37
+ spec.add_development_dependency "rspec", ">= 3.0"
38
+ spec.add_development_dependency "sqlite3"
39
+ spec.add_runtime_dependency "activerecord", ">= 5.2.3", "<= 7.1"
40
+ spec.add_runtime_dependency "activesupport", ">= 5.2.3", "<= 7.1"
41
+ spec.required_ruby_version = ">= 2.6"
41
42
  end
data/bin/setup CHANGED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
@@ -4,9 +4,9 @@ module ActiveRecall
4
4
  class Deck < ActiveRecord::Base
5
5
  include Enumerable
6
6
  include ActiveRecall::Base
7
- self.table_name = 'active_recall_decks'
7
+ self.table_name = "active_recall_decks"
8
8
  belongs_to :user, polymorphic: true
9
- has_many :items, class_name: 'ActiveRecall::Item', dependent: :destroy
9
+ has_many :items, class_name: "ActiveRecall::Item", dependent: :destroy
10
10
 
11
11
  def each
12
12
  _items.each do |item|
@@ -27,7 +27,7 @@ module ActiveRecall
27
27
  end
28
28
 
29
29
  def <<(source)
30
- raise ArgumentError, 'Word already in the stack' if include?(source)
30
+ raise ArgumentError, "Word already in the stack" if include?(source)
31
31
 
32
32
  items << ActiveRecall::Item.new(deck: self, source_id: source.id, source_type: source.class.name)
33
33
  end
@@ -43,7 +43,7 @@ module ActiveRecall
43
43
  end
44
44
 
45
45
  def review
46
- _review.map(&:source)
46
+ source_class.where(id: _review.select(:source_id))
47
47
  end
48
48
 
49
49
  def next
@@ -51,23 +51,23 @@ module ActiveRecall
51
51
  end
52
52
 
53
53
  def last
54
- items.order('created_at desc').limit(1).first.try(:source)
54
+ items.order("created_at desc").limit(1).first.try(:source)
55
55
  end
56
56
 
57
57
  def untested
58
- source_class.find(items.untested.pluck(:source_id))
58
+ source_class.where(id: items.untested.select(:source_id))
59
59
  end
60
60
 
61
61
  def failed
62
- source_class.find(items.failed.pluck(:source_id))
62
+ source_class.where(id: items.failed.select(:source_id))
63
63
  end
64
64
 
65
65
  def known
66
- source_class.find(items.known.pluck(:source_id))
66
+ source_class.where(id: items.known.select(:source_id))
67
67
  end
68
68
 
69
69
  def expired
70
- source_class.find(items.expired.pluck(:source_id))
70
+ source_class.where(id: items.expired.select(:source_id))
71
71
  end
72
72
 
73
73
  def box(number)
@@ -89,11 +89,11 @@ module ActiveRecall
89
89
  end
90
90
 
91
91
  def random_order_function
92
- Arel.sql(mysql? ? 'RAND()' : 'random()')
92
+ Arel.sql(mysql? ? "RAND()" : "random()")
93
93
  end
94
94
 
95
95
  def mysql?
96
- source_class.connection.adapter_name == 'Mysql2'
96
+ source_class.connection.adapter_name == "Mysql2"
97
97
  end
98
98
  end
99
99
  end
@@ -2,19 +2,19 @@
2
2
 
3
3
  module ActiveRecall
4
4
  class Item < ActiveRecord::Base
5
- self.table_name = 'active_recall_items'
5
+ self.table_name = "active_recall_items"
6
6
 
7
7
  belongs_to :deck
8
8
 
9
- scope :failed, -> { where(['box = ? and last_reviewed is not null', 0]) }
10
- scope :untested, -> { where(['box = ? and last_reviewed is null', 0]) }
9
+ scope :failed, -> { where(["box = ? and last_reviewed is not null", 0]) }
10
+ scope :untested, -> { where(["box = ? and last_reviewed is null", 0]) }
11
11
 
12
12
  def self.expired(current_time: Time.current)
13
- where(['box > ? and next_review <= ?', 0, current_time])
13
+ where(["box > ? and next_review <= ?", 0, current_time])
14
14
  end
15
15
 
16
16
  def self.known(current_time: Time.current)
17
- where(['box > ? and next_review > ?', 0, current_time])
17
+ where(["box > ? and next_review > ?", 0, current_time])
18
18
  end
19
19
 
20
20
  def source
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecall
4
- VERSION = '1.6.4'
4
+ VERSION = "1.8.3"
5
5
  end
data/lib/active_recall.rb CHANGED
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_recall/base'
4
- require 'active_recall/deck_methods'
5
- require 'active_recall/item_methods'
6
- require 'active_recall/algorithms/fibonacci_sequence'
7
- require 'active_recall/algorithms/leitner_system'
8
- require 'active_recall/configuration'
9
- require 'active_recall/models/deck'
10
- require 'active_recall/models/item'
11
- require 'active_recall/version'
3
+ require "active_recall/base"
4
+ require "active_recall/deck_methods"
5
+ require "active_recall/item_methods"
6
+ require "active_recall/algorithms/fibonacci_sequence"
7
+ require "active_recall/algorithms/leitner_system"
8
+ require "active_recall/configuration"
9
+ require "active_recall/models/deck"
10
+ require "active_recall/models/item"
11
+ require "active_recall/version"
12
12
 
13
13
  ActiveRecord::Base.include ActiveRecall::Base
14
14
 
@@ -1,26 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rails/generators'
4
- require 'rails/generators/migration'
5
- require 'rails/generators/active_record'
3
+ require "rails/generators"
4
+ require "rails/generators/migration"
5
+ require "rails/generators/active_record"
6
6
 
7
7
  class ActiveRecallGenerator < Rails::Generators::Base
8
8
  include Rails::Generators::Migration
9
9
 
10
10
  class_option :migrate_data, type: :boolean, default: false
11
11
 
12
- desc 'Creates migration files required by the active_recall spaced repetition gem.'
12
+ desc "Creates migration files required by the active_recall spaced repetition gem."
13
13
 
14
- source_paths << File.join(File.dirname(__FILE__), 'templates')
14
+ source_paths << File.join(File.dirname(__FILE__), "templates")
15
15
 
16
16
  def self.next_migration_number(path)
17
17
  ActiveRecord::Generators::Base.next_migration_number(path)
18
18
  end
19
19
 
20
20
  def create_migration_files
21
- create_migration_file_if_not_exist 'create_active_recall_tables'
22
- create_migration_file_if_not_exist 'add_active_recall_item_answer_counts'
23
- create_migration_file_if_not_exist 'migrate_okubo_to_active_recall' if options['migrate_data']
21
+ create_migration_file_if_not_exist "create_active_recall_tables"
22
+ create_migration_file_if_not_exist "add_active_recall_item_answer_counts"
23
+ create_migration_file_if_not_exist "migrate_okubo_to_active_recall" if options["migrate_data"]
24
24
  end
25
25
 
26
26
  private
@@ -9,11 +9,11 @@ class CreateActiveRecallTables < ActiveRecord::Migration[5.2]
9
9
  add_index :active_recall_decks, %i[user_id user_type]
10
10
 
11
11
  create_table :active_recall_items do |t|
12
- t.references :deck
13
- t.references :source, polymorphic: true
14
- t.integer :box, default: 0
15
- t.timestamp :last_reviewed
16
- t.timestamp :next_review
12
+ t.references :deck
13
+ t.references :source, polymorphic: true
14
+ t.integer :box, default: 0
15
+ t.timestamp :last_reviewed
16
+ t.timestamp :next_review
17
17
  t.timestamps
18
18
  end
19
19
  add_index :active_recall_items, %i[source_id source_type]
@@ -17,8 +17,8 @@ class MigrateOkuboToActiveRecall < ActiveRecord::Migration[5.2]
17
17
  deck_attributes[:id] == item_attributes[:deck_id]
18
18
  end.each do |item_attributes|
19
19
  item_create_attributes = item_attributes
20
- .except(:id, :created_at, :updated_at)
21
- .merge(deck_id: deck.id)
20
+ .except(:id, :created_at, :updated_at)
21
+ .merge(deck_id: deck.id)
22
22
  ActiveRecall::Item.create!(item_create_attributes)
23
23
  end
24
24
  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
4
+ version: 1.8.3
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: 2021-09-17 00:00:00.000000000 Z
12
+ date: 2023-06-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 5.2.3
77
77
  - - "<="
78
78
  - !ruby/object:Gem::Version
79
- version: '6.2'
79
+ version: '7.1'
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.2'
89
+ version: '7.1'
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.2'
99
+ version: '7.1'
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.2'
109
+ version: '7.1'
110
110
  description: A spaced-repetition system to be used with ActiveRecord models
111
111
  email:
112
112
  - robert.gravina@gmail.com
@@ -118,14 +118,13 @@ files:
118
118
  - ".github/workflows/tests.yml"
119
119
  - ".gitignore"
120
120
  - ".rspec"
121
- - ".ruby-version"
121
+ - ".tool-versions"
122
122
  - Gemfile
123
123
  - Gemfile.lock
124
124
  - LICENSE
125
125
  - README.md
126
126
  - Rakefile
127
127
  - active_recall.gemspec
128
- - bin/console
129
128
  - bin/setup
130
129
  - lib/active_recall.rb
131
130
  - lib/active_recall/algorithms/fibonacci_sequence.rb
@@ -154,14 +153,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
154
153
  requirements:
155
154
  - - ">="
156
155
  - !ruby/object:Gem::Version
157
- version: '0'
156
+ version: '2.6'
158
157
  required_rubygems_version: !ruby/object:Gem::Requirement
159
158
  requirements:
160
159
  - - ">="
161
160
  - !ruby/object:Gem::Version
162
161
  version: '0'
163
162
  requirements: []
164
- rubygems_version: 3.2.3
163
+ rubygems_version: 3.4.10
165
164
  signing_key:
166
165
  specification_version: 4
167
166
  summary: A spaced-repetition system
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.0.0
data/bin/console DELETED
File without changes