From 931798a4f0224bab7268ccbc73370379c87c804c Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 18 Dec 2018 13:11:47 +0530 Subject: [PATCH 01/53] First steps for rails 5. - Changed test db to use mysql2 - Removed squeel from Gemfile, need to remove any usages --- Gemfile | 8 +- Gemfile.lock | 91 ++- app/models/ability.rb | 4 +- app/models/user.rb | 3 +- bin/rails | 2 +- bin/setup | 34 + bin/update | 29 + config/application.rb | 33 +- config/boot.rb | 5 +- config/cable.yml | 9 + config/database.yml | 17 +- config/environment.rb | 6 +- config/environments/development.rb | 84 +- config/environments/production.rb | 82 +- config/environments/test.rb | 15 +- .../application_controller_renderer.rb | 6 + config/initializers/assets.rb | 20 + config/initializers/cookies_serializer.rb | 5 + config/initializers/inflections.rb | 6 +- config/initializers/mime_types.rb | 2 - config/initializers/new_framework_defaults.rb | 23 + config/initializers/session_store.rb | 2 +- config/initializers/wrap_parameters.rb | 4 +- config/puma.rb | 99 ++- config/routes.rb | 13 +- config/secrets.yml | 32 +- config/spring.rb | 6 + db/schema.rb | 733 ++++++++---------- 28 files changed, 711 insertions(+), 662 deletions(-) create mode 100755 bin/setup create mode 100755 bin/update create mode 100644 config/cable.yml create mode 100644 config/initializers/application_controller_renderer.rb create mode 100644 config/initializers/assets.rb create mode 100644 config/initializers/cookies_serializer.rb create mode 100644 config/initializers/new_framework_defaults.rb create mode 100644 config/spring.rb diff --git a/Gemfile b/Gemfile index a790d87a..9153c4f4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' -gem 'rails', '~> 4.2' -gem 'bootstrap-sass-backport', '~> 3.2.0' +gem 'rails', '>= 5.0.0.rc2', '< 5.1' +gem 'bootstrap-sass', '~> 3.2.0' gem 'jquery-rails' gem 'jquery-ui-rails' gem 'bootstrap-editable-rails' @@ -63,6 +63,7 @@ gem 'factory_bot_rails' gem 'log_file' group :test do + gem 'sqlite3' gem 'capybara' end @@ -98,9 +99,6 @@ gem 'bootstrap-wysihtml5-rails' gem 'momentjs-rails', '>= 2.9.0' gem 'bootstrap3-datetimepicker-rails', '~> 4.17.37' -#gem for improved WHERE querying -gem 'squeel', '~> 1.2' - #for nested forms gem 'cocoon' diff --git a/Gemfile.lock b/Gemfile.lock index 22995460..5c8a05bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -26,28 +26,32 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.11.1) - actionpack (= 4.2.11.1) - actionview (= 4.2.11.1) - activejob (= 4.2.11.1) + actioncable (5.0.0.rc2) + actionpack (= 5.0.0.rc2) + nio4r (~> 1.2) + websocket-driver (~> 0.6.1) + actionmailer (5.0.0.rc2) + actionpack (= 5.0.0.rc2) + actionview (= 5.0.0.rc2) + activejob (= 5.0.0.rc2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.11.1) - actionview (= 4.2.11.1) - activesupport (= 4.2.11.1) - rack (~> 1.6) - rack-test (~> 0.6.2) + actionpack (5.0.0.rc2) + actionview (= 5.0.0.rc2) + activesupport (= 5.0.0.rc2) + rack (~> 2.x) + rack-test (~> 0.6.3) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.11.1) - activesupport (= 4.2.11.1) + actionview (5.0.0.rc2) + activesupport (= 5.0.0.rc2) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_record-acts_as (3.1.0) - activerecord (>= 4.2, < 5.2.2.rc1) - activesupport (>= 4.2, < 5.2.2.rc1) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + active_record-acts_as (3.0.2) + activerecord (>= 4.2) + activesupport (>= 4.2) active_record_union (1.3.0) activerecord (>= 4.0) activeadmin (1.4.3) @@ -62,20 +66,21 @@ GEM ransack (>= 1.8.7) sass (~> 3.1) sprockets (< 4.1) - activejob (4.2.11.1) - activesupport (= 4.2.11.1) - globalid (>= 0.3.0) - activemodel (4.2.11.1) - activesupport (= 4.2.11.1) - builder (~> 3.1) - activerecord (4.2.11.1) - activemodel (= 4.2.11.1) - activesupport (= 4.2.11.1) - arel (~> 6.0) - activesupport (4.2.11.1) + activejob (5.0.0.rc2) + activesupport (= 5.0.0.rc2) + globalid (>= 0.3.6) + activemodel (5.0.0.rc2) + activesupport (= 5.0.0.rc2) + activerecord (5.0.0.rc2) + activemodel (= 5.0.0.rc2) + activesupport (= 5.0.0.rc2) + arel (~> 7.0) + activerecord-import (0.17.2) + activerecord (>= 3.2) + activesupport (5.0.0.rc2) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) acts-as-taggable-on (5.0.0) activerecord (>= 4.2.8) @@ -90,8 +95,8 @@ GEM rake (>= 10.4, < 13.0) arbre (1.2.1) activesupport (>= 3.0.0) - arel (6.0.4) - autoprefixer-rails (9.6.0) + arel (7.1.4) + autoprefixer-rails (9.2.1) execjs awesome_print (1.8.0) bcrypt (3.1.13) @@ -330,20 +335,21 @@ GEM nio4r (~> 2.0) rabl (0.14.1) activesupport (>= 2.3.14) - rack (1.6.12) + rack (2.0.6) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.11.1) - actionmailer (= 4.2.11.1) - actionpack (= 4.2.11.1) - actionview (= 4.2.11.1) - activejob (= 4.2.11.1) - activemodel (= 4.2.11.1) - activerecord (= 4.2.11.1) - activesupport (= 4.2.11.1) + rails (5.0.0.rc2) + actioncable (= 5.0.0.rc2) + actionmailer (= 5.0.0.rc2) + actionpack (= 5.0.0.rc2) + actionview (= 5.0.0.rc2) + activejob (= 5.0.0.rc2) + activemodel (= 5.0.0.rc2) + activerecord (= 5.0.0.rc2) + activesupport (= 5.0.0.rc2) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.11.1) - sprockets-rails + railties (= 5.0.0.rc2) + sprockets-rails (>= 2.0.0) rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) rails-dom-testing (1.0.9) @@ -471,6 +477,9 @@ GEM wannabe_bool (0.7.1) warden (1.2.7) rack (>= 1.0) + websocket-driver (0.6.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.3) xpath (3.2.0) nokogiri (~> 1.8) @@ -537,7 +546,7 @@ DEPENDENCIES pry puma (~> 4.3.5) rabl - rails (~> 4.2) + rails (>= 5.0.0.rc2, < 5.1) rails-erd! redcarpet remotipart diff --git a/app/models/ability.rb b/app/models/ability.rb index e0047c7b..f7e39b26 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -42,8 +42,8 @@ def initialize(user) # A user should only be able to update himself or herself (assuming no # other permissions granted below by the global role). can [:read, :index], User, User.visible_to_user(user) do |u| - u == user || u.course_enrollments.where{ - course_role_id != CourseRole::STUDENT_ID}.any? + u == user || u.course_enrollments + .where('course_role_id != ?', CourseRole::STUDENT_ID).any? end can [:edit, :update], User, id: user.id diff --git a/app/models/user.rb b/app/models/user.rb index 0063ae51..94cd6dc3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -289,8 +289,7 @@ def managed_workout_offerings_in_term(workout, course, term) enrollments.map { |e| if workout.kind_of?(String) workouts_with_name = Workout.where('lower(name) = ?', workout) - e.course_offering.workout_offerings.where{ - workout_id.in(workouts_with_name.select{id}) } + e.course_offering.workout_offerings.where('workout_id in ?', workouts_with_name.select(:id)) else e.course_offering.workout_offerings.where(workout: workout) end diff --git a/bin/rails b/bin/rails index 728cd85a..07396602 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/setup b/bin/setup new file mode 100755 index 00000000..e620b4da --- /dev/null +++ b/bin/setup @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # puts "\n== Copying sample files ==" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' + # end + + puts "\n== Preparing database ==" + system! 'bin/rails db:setup' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/update b/bin/update new file mode 100755 index 00000000..a8e4462f --- /dev/null +++ b/bin/update @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/config/application.rb b/config/application.rb index 4b34d59f..4f5b85e6 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,44 +1,23 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. -Bundler.require(:default, Rails.env) +Bundler.require(*Rails.groups) module CodeWorkout class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version + config.load_defaults 5.1 + Rails.application.config.active_record.belongs_to_required_by_default = false # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - config.assets.precompile += [ - Proc.new { |filename, path| - path =~ /app\/assets/ && - path !~ /bootstrap-social/ && - path !~ /active_admin/ && - %w(.js .css).include?(File.extname(filename)) - } - ] - - # other kinds of assets - config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif *.mustache.html) - - # Custom directories with classes and modules you want to be autoloadable. - config.autoload_paths += %W(#{config.root}/lib) - + # Timeout for feedback polls (milliseconds) # This is an initial value on application startup, but it might change config.feedback_timeout = 1700 config.feedback_timeout_padding = 300 - - config.active_record.raise_in_transactional_callbacks = true end end diff --git a/config/boot.rb b/config/boot.rb index 35967366..30f5120d 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,3 @@ -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 00000000..0bbde6f7 --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,9 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: redis://localhost:6379/1 diff --git a/config/database.yml b/config/database.yml index 01e132fc..fe4a5b6b 100644 --- a/config/database.yml +++ b/config/database.yml @@ -20,9 +20,16 @@ development: # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. +# test: +# adapter: sqlite3 +# database: db/test.sqlite3 +# # Pool: 16 puma threads + 10 SuckerPunch workers +# pool: 26 +# timeout: 5000 + test: - adapter: sqlite3 - database: db/test.sqlite3 - # Pool: 16 puma threads + 10 SuckerPunch workers - pool: 26 - timeout: 5000 + adapter: mysql2 + database: codeworkout_test + username: codeworkout + password: codeworkout + host: localhost diff --git a/config/environment.rb b/config/environment.rb index 03a2f462..426333bb 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,7 +1,5 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) -require 'rails_extensions' - +require_relative 'application' # Initialize the Rails application. -CodeWorkout::Application.initialize! +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 7fed104d..e64889cd 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,6 +1,5 @@ -CodeWorkout::Application.configure do - # Settings specified here will take precedence over those in - # config/application.rb. +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development @@ -10,32 +9,32 @@ # Do not eager load code on boot. config.eager_load = false - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + # Show full error reports. + config.consider_all_requests_local = true - # For SSEs - config.preload_frameworks = true - config.allow_concurrency = true + # Enable/disable caching. By default caching is disabled. + if Rails.root.join('tmp/caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=172800' + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = true - config.action_mailer.default_url_options = { :host => '192.168.33.20:3000' } - config.action_mailer.delivery_method = :smtp - config.action_mailer.smtp_settings = { - address: 'smtp.gmail.com', - port: 587, - domain: 'vt.edu', - authentication: 'plain', - enable_starttls_auto: true, - user_name: ENV['GMAIL_USERNAME'], - password: ENV['GMAIL_PASSWORD'] - } + config.action_mailer.raise_delivery_errors = false + + config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Raise an error on page load if there are pending migrations + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Debug mode disables concatenation and preprocessing of assets. @@ -43,40 +42,13 @@ # number of complex assets. config.assets.debug = true - # Do not fallback to assets pipeline if a precompiled asset is missed. - # config.assets.compile = false + # Suppress logger output for asset requests. + config.assets.quiet = true - # Generate digests for assets URLs. - # config.assets.digest = true + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true - - config.assets.initialize_on_precompile = true - - config.middleware.use LogFile::Display - config.log_level = :info - config.log_formatter = proc do |severity, datetime, progname, msg| - if severity == 'DEBUG' && msg.blank? - '' - else - case severity - when 'DEBUG' - severity_colored = "\033[36;40m[DEBUG]\033[0m" # cyan - when 'INFO' - severity_colored = "\033[32;40m[INFO]\033[0m" # green - when 'WARN' - severity_colored = "\033[35;40m[WARNING]\033[0m" # magenta - when 'ERROR' - severity_colored = "\033[31;40m[ERROR]\033[0m" # red - when 'FATAL' - severity_colored = "\033[7;31;40m[FATAL]\033[0m" # black, red bg - else - severity_colored = "[#{severity}]" # none - end - "%s %s %s\n" % [ - datetime.strftime('%Y-%m-%d %H:%M:%S'), - severity_colored, - String === msg ? msg : msg.inspect - ] - end - end + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + # config.file_watcher = ActiveSupport::EventedFileUpdateChecker end diff --git a/config/environments/production.rb b/config/environments/production.rb index 9c602bb9..14f1f1f7 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,11 +1,11 @@ -CodeWorkout::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both thread web servers + # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true @@ -14,13 +14,9 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Enable Rack::Cache to put a simple HTTP cache in front of your application - # Add `rack-cache` to your Gemfile before enabling this. - # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. - # config.action_dispatch.rack_cache = true - - # Disable Rails's static asset server (Apache or nginx will already do this). - config.serve_static_files = false + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -29,64 +25,62 @@ # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # Generate digests for assets URLs. - config.assets.digest = true + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # Version of your assets, change this if you want to expire all your assets. - config.assets.version = '1.0' + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true - # Set to :debug to see everything in the log. - config.log_level = :info - - config.log_formatter = proc do |severity, datetime, progname, msg| - if severity == 'DEBUG' && msg.blank? - '' - else - "%s [%s] %s\n" % [ - datetime.strftime('%Y-%m-%d %H:%M:%S'), - severity, - String === msg ? msg : msg.inspect - ] - end - end + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug # Prepend all log lines with the following tags. - # config.log_tags = [ :subdomain, :uuid ] - - # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + config.log_tags = [ :request_id ] # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = "http://assets.example.com" - - # Precompile additional assets. - # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. - # config.assets.precompile += %w( search.js ) + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "code_workout_#{Rails.env}" + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found). + # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify - # Disable automatic flushing of the log to improve performance. - # config.autoflush_log = false + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end - config.action_mailer.default_url_options = { :host => 'http://codeworkout.cs.vt.edu/' } - config.middleware.use LogFile::Display + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false end diff --git a/config/environments/test.rb b/config/environments/test.rb index 357fba0c..30587ef6 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,4 @@ -CodeWorkout::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's @@ -12,9 +12,11 @@ # preloads Rails for running tests, you may have to set it to true. config.eager_load = false - # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = "public, max-age=3600" + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=3600' + } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -25,6 +27,7 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the @@ -34,6 +37,6 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - config.action_mailer.default_url_options = { :host => 'localhost:3000' } - + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true end diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 00000000..51639b67 --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,6 @@ +# Be sure to restart your server when you modify this file. + +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb new file mode 100644 index 00000000..ca44ed1f --- /dev/null +++ b/config/initializers/assets.rb @@ -0,0 +1,20 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) + +Rails.application.config.assets.precompile = [ + Proc.new { |filename, path| + path =~ /app\/assets/ && + path !~ /bootstrap-social/ && + path !~ /active_admin/ && + %w(.js .css).include?(File.extname(filename)) + }, /application.(css|.js)$/ +] diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 00000000..1389e86a --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. +Rails.application.config.action_dispatch.cookies_serializer = :marshal diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 12b845d8..ac033bf9 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -11,6 +11,6 @@ # end # These inflection rules are supported but not enabled by default: -ActiveSupport::Inflector.inflections(:en) do |inflect| - inflect.acronym 'IRT' -end +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 9acb8d70..dc189968 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -2,5 +2,3 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone -Mime::Type.register "application/x-yaml", :yml diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb new file mode 100644 index 00000000..f6e72335 --- /dev/null +++ b/config/initializers/new_framework_defaults.rb @@ -0,0 +1,23 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.0 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Rails 5.0 release notes for more info on each option. + +# Enable per-form CSRF tokens. Previous versions had false. +Rails.application.config.action_controller.per_form_csrf_tokens = false + +# Enable origin-checking CSRF mitigation. Previous versions had false. +Rails.application.config.action_controller.forgery_protection_origin_check = false + +# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. +# Previous versions had false. +ActiveSupport.to_time_preserves_timezone = false + +# Require `belongs_to` associations by default. Previous versions had false. +Rails.application.config.active_record.belongs_to_required_by_default = false + +# Do not halt callback chains when a callback returns false. Previous versions had true. +ActiveSupport.halt_callback_chains_on_return_false = true diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index f71b4efb..ce299f9d 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -CodeWorkout::Application.config.session_store :cookie_store, key: '_code-practice_session' +Rails.application.config.session_store :cookie_store, key: '_code_workout_session' diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 33725e95..bbfc3961 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -5,10 +5,10 @@ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] if respond_to?(:wrap_parameters) + wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true +# self.include_root_in_json = true # end diff --git a/config/puma.rb b/config/puma.rb index e6fe5801..c7f311f8 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,52 +1,47 @@ -# Default to production -rails_env = rails_env || ENV['RAILS_ENV'] || 'production' -environment rails_env - -# For MRI, use workers instead of threads for greater parallelism -if rails_env == 'production' - workers 10 - threads 2, 2 - daemonize - preload_app! -elsif rails_env == 'staging' - workers 4 - threads 2, 8 - daemonize - preload_app! -else - # development settings are smaller; at least two workers, for SSE - workers 2 - threads 2, 4 -end - -app_dir = File.expand_path('../..', __FILE__) - -# Set up socket location -bind "unix://#{app_dir}/tmp/sockets/puma.sock" - -# Logging -stdout_redirect "#{app_dir}/log/puma.stdout.log", - "#{app_dir}/log/puma.stderr.log", - true - -puts "Running in evironment #{rails_env}" -puts "Running on platform #{RUBY_PLATFORM}" - -# Set master PID and state locations -pidfile "#{app_dir}/tmp/pids/puma.pid" -state_path "#{app_dir}/tmp/pids/puma.state" -activate_control_app - -on_worker_boot do - require 'active_record' - ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished - ActiveSupport.on_load(:active_record) do - ActiveRecord::Base.establish_connection( - YAML.load_file("#{app_dir}/config/database.yml")[rails_env]) - end -end - -before_fork do - require 'active_record' - ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished -end +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum, this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted this block will be run, if you are using `preload_app!` +# option you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart diff --git a/config/routes.rb b/config/routes.rb index ce848831..0636b176 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -CodeWorkout::Application.routes.draw do +Rails.application.routes.draw do root 'home#index' @@ -186,9 +186,16 @@ end get 'help' => 'help#index' - match 'help/:action', to: 'help', via: [:get] - match 'static_pages/:action', controller: 'static_pages', via: [:get] + get 'help/exercise_format' => 'help#exercise_format' + get 'help/lti_configuration' => 'help/lti_configuration' + get 'static_pages/mockup1' => 'static_pages#mockup1' + get 'static_pages/mockup2' => 'static_pages#mockup2' + get 'static_pages/mockup3' => 'static_pages#mockup3' + get 'static_pages/thumbnails' => 'static_pages#thumbnails' + + # match 'help/:action', to: 'help', via: [:get] + # match 'static_pages/:action', to: 'static_pages', via: [:get] end #== Route Map diff --git a/config/secrets.yml b/config/secrets.yml index 6d4cb2ec..7e8ea854 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -1,16 +1,22 @@ -development: - secret_key_base: 14d33115b12aa4f9f07d8575fea6ae6a57223f64d13cf1475ec6614cfd78b0e8e8fbd19baa83649b99ff0494fd06c9265753961df252d4301602afd3cd4be92b - facebook_id: ID - facebook_secret: SECRET - google_id: ID - google_secret: SECRET - devise_pepper: '46d41a459192e0210aa267ccf13d12ecb1fda9ba3deb015bf9069106b5aea043ea59df22eaf8c26768ee257b84a47f0df1e03700956dd8d7963a98c995cca2f4' +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rails secret` to generate a secure secret key. +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +development: + secret_key_base: eff0aae935bd44c6013779062036ce365082fadabfa7944f1b1455e9468fbf3ed613a988b884590965e40105c8db9ee47f3777802fb839e089ad9e565690e126 test: - secret_key_base: bb105787c6ba010a44ec6554df779c7dcd83952dfe3c9175bb0a5ceec79705f23eb08b8d2e4c27aa71b1ee87d40018b6be27d1fe82d02129590ae172fdb3ef80 - facebook_id: ID - facebook_secret: SECRET - google_id: ID - google_secret: SECRET - devise_pepper: '46d41a459192e0210aa267ccf13d12ecb1fda9ba3deb015bf9069106b5aea043ea59df22eaf8c26768ee257b84a47f0df1e03700956dd8d7963a98c995cca2f4' \ No newline at end of file + secret_key_base: 0394fa40ba5b3ac258de3ac21e19844491cc15f84775b31cc081103e856203148bf0cab364e6c9dee9c59852ab063554c7c67af503d65ee46aaf18a5d76cde90 + +# Do not keep production secrets in the repository, +# instead read values from the environment. +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 00000000..c9119b40 --- /dev/null +++ b/config/spring.rb @@ -0,0 +1,6 @@ +%w( + .ruby-version + .rbenv-vars + tmp/restart.txt + tmp/caching-dev.txt +).each { |path| Spring.watch(path) } diff --git a/db/schema.rb b/db/schema.rb index ea40e41e..f59a963c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -13,28 +12,27 @@ ActiveRecord::Schema.define(version: 20190712171251) do - create_table "active_admin_comments", force: :cascade do |t| - t.string "namespace", limit: 255 + create_table "active_admin_comments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "namespace" t.text "body", limit: 65535 - t.string "resource_id", limit: 255, default: "", null: false - t.string "resource_type", limit: 255, default: "", null: false - t.integer "author_id", limit: 4 - t.string "author_type", limit: 255 + t.string "resource_id", default: "", null: false + t.string "resource_type", default: "", null: false + t.integer "author_id" + t.string "author_type" t.datetime "created_at" t.datetime "updated_at" + t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id", using: :btree + t.index ["namespace"], name: "index_active_admin_comments_on_namespace", using: :btree + t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id", using: :btree end - add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id", using: :btree - add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace", using: :btree - add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id", using: :btree - - create_table "attempts", force: :cascade do |t| - t.integer "user_id", limit: 4, null: false - t.integer "exercise_version_id", limit: 4, null: false - t.datetime "submit_time", null: false - t.integer "submit_num", limit: 4, null: false - t.float "score", limit: 24, default: 0.0 - t.integer "experience_earned", limit: 4 + create_table "attempts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "user_id", null: false + t.integer "exercise_version_id", null: false + t.datetime "submit_time", null: false + t.integer "submit_num", null: false + t.float "score", limit: 24, default: 0.0 + t.integer "experience_earned" t.datetime "created_at" t.datetime "updated_at" t.integer "workout_score_id", limit: 4 @@ -43,124 +41,115 @@ t.decimal "time_taken", precision: 10 t.decimal "feedback_timeout", precision: 10 t.decimal "worker_time", precision: 10 + t.index ["active_score_id"], name: "index_attempts_on_active_score_id", using: :btree + t.index ["exercise_version_id"], name: "index_attempts_on_exercise_version_id", using: :btree + t.index ["user_id"], name: "index_attempts_on_user_id", using: :btree + t.index ["workout_score_id"], name: "index_attempts_on_workout_score_id", using: :btree end - add_index "attempts", ["active_score_id"], name: "index_attempts_on_active_score_id", using: :btree - add_index "attempts", ["exercise_version_id"], name: "index_attempts_on_exercise_version_id", using: :btree - add_index "attempts", ["user_id"], name: "index_attempts_on_user_id", using: :btree - add_index "attempts", ["workout_score_id"], name: "index_attempts_on_workout_score_id", using: :btree - - create_table "attempts_tag_user_scores", id: false, force: :cascade do |t| - t.integer "attempt_id", limit: 4 - t.integer "tag_user_score_id", limit: 4 + create_table "attempts_tag_user_scores", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "attempt_id" + t.integer "tag_user_score_id" + t.index ["attempt_id", "tag_user_score_id"], name: "attempts_tag_user_scores_idx", unique: true, using: :btree + t.index ["tag_user_score_id"], name: "attempts_tag_user_scores_tag_user_score_id_fk", using: :btree end - add_index "attempts_tag_user_scores", ["attempt_id", "tag_user_score_id"], name: "attempts_tag_user_scores_idx", unique: true, using: :btree - add_index "attempts_tag_user_scores", ["tag_user_score_id"], name: "attempts_tag_user_scores_tag_user_score_id_fk", using: :btree - - create_table "choices", force: :cascade do |t| - t.integer "multiple_choice_prompt_id", limit: 4, null: false - t.integer "position", limit: 4, null: false + create_table "choices", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "multiple_choice_prompt_id", null: false + t.integer "position", null: false t.text "feedback", limit: 65535 t.float "value", limit: 24, null: false t.datetime "created_at" t.datetime "updated_at" t.text "answer", limit: 65535, null: false + t.index ["multiple_choice_prompt_id"], name: "index_choices_on_multiple_choice_prompt_id", using: :btree end - add_index "choices", ["multiple_choice_prompt_id"], name: "index_choices_on_multiple_choice_prompt_id", using: :btree - - create_table "choices_multiple_choice_prompt_answers", id: false, force: :cascade do |t| - t.integer "choice_id", limit: 4 - t.integer "multiple_choice_prompt_answer_id", limit: 4 + create_table "choices_multiple_choice_prompt_answers", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "choice_id" + t.integer "multiple_choice_prompt_answer_id" + t.index ["choice_id", "multiple_choice_prompt_answer_id"], name: "choices_multiple_choice_prompt_answers_idx", unique: true, using: :btree + t.index ["multiple_choice_prompt_answer_id"], name: "choices_MC_prompt_answers_MC_prompt_answer_id_fk", using: :btree end - add_index "choices_multiple_choice_prompt_answers", ["choice_id", "multiple_choice_prompt_answer_id"], name: "choices_multiple_choice_prompt_answers_idx", unique: true, using: :btree - add_index "choices_multiple_choice_prompt_answers", ["multiple_choice_prompt_answer_id"], name: "choices_MC_prompt_answers_MC_prompt_answer_id_fk", using: :btree - - create_table "coding_prompt_answers", force: :cascade do |t| - t.text "answer", limit: 65535 - t.text "error", limit: 65535 - t.integer "error_line_no", limit: 4 + create_table "coding_prompt_answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.text "answer", limit: 65535 + t.text "error", limit: 65535 end - create_table "coding_prompts", force: :cascade do |t| + create_table "coding_prompts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.datetime "created_at" t.datetime "updated_at" - t.string "class_name", limit: 255 + t.string "class_name" t.text "wrapper_code", limit: 65535, null: false t.text "test_script", limit: 65535, null: false - t.string "method_name", limit: 255 + t.string "method_name" t.text "starter_code", limit: 65535 t.boolean "hide_examples", default: false, null: false end - create_table "course_enrollments", force: :cascade do |t| - t.integer "user_id", limit: 4, null: false - t.integer "course_offering_id", limit: 4, null: false - t.integer "course_role_id", limit: 4, null: false + create_table "course_enrollments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "user_id", null: false + t.integer "course_offering_id", null: false + t.integer "course_role_id", null: false + t.index ["course_offering_id"], name: "index_course_enrollments_on_course_offering_id", using: :btree + t.index ["course_role_id"], name: "index_course_enrollments_on_course_role_id", using: :btree + t.index ["user_id", "course_offering_id"], name: "index_course_enrollments_on_user_id_and_course_offering_id", unique: true, using: :btree + t.index ["user_id"], name: "index_course_enrollments_on_user_id", using: :btree end - add_index "course_enrollments", ["course_offering_id"], name: "index_course_enrollments_on_course_offering_id", using: :btree - add_index "course_enrollments", ["course_role_id"], name: "index_course_enrollments_on_course_role_id", using: :btree - add_index "course_enrollments", ["user_id", "course_offering_id"], name: "index_course_enrollments_on_user_id_and_course_offering_id", unique: true, using: :btree - add_index "course_enrollments", ["user_id"], name: "index_course_enrollments_on_user_id", using: :btree - - create_table "course_exercises", force: :cascade do |t| - t.integer "course_id", limit: 4, null: false - t.integer "exercise_id", limit: 4, null: false + create_table "course_exercises", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "course_id", null: false + t.integer "exercise_id", null: false t.datetime "created_at" t.datetime "updated_at" + t.index ["course_id"], name: "course_exercises_course_id_fk", using: :btree + t.index ["exercise_id"], name: "course_exercises_exercise_id_fk", using: :btree end - add_index "course_exercises", ["course_id"], name: "course_exercises_course_id_fk", using: :btree - add_index "course_exercises", ["exercise_id"], name: "course_exercises_exercise_id_fk", using: :btree - - create_table "course_offerings", force: :cascade do |t| - t.integer "course_id", limit: 4, null: false - t.integer "term_id", limit: 4, null: false - t.string "label", limit: 255, default: "", null: false - t.string "url", limit: 255 + create_table "course_offerings", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "course_id", null: false + t.integer "term_id", null: false + t.string "label", default: "", null: false + t.string "url" t.boolean "self_enrollment_allowed" t.datetime "created_at" t.datetime "updated_at" t.date "cutoff_date" - t.integer "lms_instance_id", limit: 4 + t.integer "lms_instance_id" + t.index ["course_id"], name: "index_course_offerings_on_course_id", using: :btree + t.index ["lms_instance_id"], name: "index_course_offerings_on_lms_instance_id", using: :btree + t.index ["term_id"], name: "index_course_offerings_on_term_id", using: :btree end - add_index "course_offerings", ["course_id"], name: "index_course_offerings_on_course_id", using: :btree - add_index "course_offerings", ["lms_instance_id"], name: "index_course_offerings_on_lms_instance_id", using: :btree - add_index "course_offerings", ["term_id"], name: "index_course_offerings_on_term_id", using: :btree - - create_table "course_roles", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false - t.boolean "can_manage_course", default: false, null: false - t.boolean "can_manage_assignments", default: false, null: false - t.boolean "can_grade_submissions", default: false, null: false - t.boolean "can_view_other_submissions", default: false, null: false - t.boolean "builtin", default: false, null: false + create_table "course_roles", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name", default: "", null: false + t.boolean "can_manage_course", default: false, null: false + t.boolean "can_manage_assignments", default: false, null: false + t.boolean "can_grade_submissions", default: false, null: false + t.boolean "can_view_other_submissions", default: false, null: false + t.boolean "builtin", default: false, null: false end - create_table "courses", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false - t.string "number", limit: 255, default: "", null: false - t.integer "organization_id", limit: 4, null: false + create_table "courses", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name", default: "", null: false + t.string "number", default: "", null: false + t.integer "organization_id", null: false t.datetime "created_at" t.datetime "updated_at" - t.integer "creator_id", limit: 4 - t.string "slug", limit: 255, default: "", null: false - t.integer "user_group_id", limit: 4 - t.boolean "is_hidden", default: false + t.integer "creator_id" + t.string "slug", default: "", null: false + t.integer "user_group_id" + t.boolean "is_hidden", default: false + t.index ["organization_id"], name: "index_courses_on_organization_id", using: :btree + t.index ["slug"], name: "index_courses_on_slug", using: :btree + t.index ["user_group_id"], name: "index_courses_on_user_group_id", using: :btree end - add_index "courses", ["organization_id"], name: "index_courses_on_organization_id", using: :btree - add_index "courses", ["slug"], name: "index_courses_on_slug", using: :btree - add_index "courses", ["user_group_id"], name: "index_courses_on_user_group_id", using: :btree - - create_table "errors", force: :cascade do |t| - t.string "usable_type", limit: 255 - t.integer "usable_id", limit: 4 - t.string "class_name", limit: 255 + create_table "errors", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "usable_type" + t.integer "usable_id" + t.string "class_name" t.text "message", limit: 65535 t.text "trace", limit: 65535 t.text "target_url", limit: 65535 @@ -169,43 +158,40 @@ t.text "user_agent", limit: 65535 t.datetime "created_at" t.datetime "updated_at" + t.index ["class_name"], name: "index_errors_on_class_name", using: :btree + t.index ["created_at"], name: "index_errors_on_created_at", using: :btree end - add_index "errors", ["class_name"], name: "index_errors_on_class_name", using: :btree - add_index "errors", ["created_at"], name: "index_errors_on_created_at", using: :btree - - create_table "exercise_collections", force: :cascade do |t| - t.string "name", limit: 255 + create_table "exercise_collections", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name" t.text "description", limit: 65535 - t.integer "user_group_id", limit: 4 - t.integer "license_id", limit: 4 + t.integer "user_group_id" + t.integer "license_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "user_id", limit: 4 - t.integer "course_offering_id", limit: 4 + t.integer "user_id" + t.integer "course_offering_id" + t.index ["course_offering_id"], name: "index_exercise_collections_on_course_offering_id", using: :btree + t.index ["license_id"], name: "index_exercise_collections_on_license_id", using: :btree + t.index ["user_group_id"], name: "index_exercise_collections_on_user_group_id", using: :btree + t.index ["user_id"], name: "index_exercise_collections_on_user_id", using: :btree end - add_index "exercise_collections", ["course_offering_id"], name: "index_exercise_collections_on_course_offering_id", using: :btree - add_index "exercise_collections", ["license_id"], name: "index_exercise_collections_on_license_id", using: :btree - add_index "exercise_collections", ["user_group_id"], name: "index_exercise_collections_on_user_group_id", using: :btree - add_index "exercise_collections", ["user_id"], name: "index_exercise_collections_on_user_id", using: :btree - - create_table "exercise_families", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false + create_table "exercise_families", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" end - create_table "exercise_owners", force: :cascade do |t| - t.integer "exercise_id", limit: 4, null: false - t.integer "owner_id", limit: 4, null: false + create_table "exercise_owners", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "exercise_id", null: false + t.integer "owner_id", null: false + t.index ["exercise_id", "owner_id"], name: "index_exercise_owners_on_exercise_id_and_owner_id", unique: true, using: :btree + t.index ["owner_id"], name: "exercise_owners_owner_id_fk", using: :btree end - add_index "exercise_owners", ["exercise_id", "owner_id"], name: "index_exercise_owners_on_exercise_id_and_owner_id", unique: true, using: :btree - add_index "exercise_owners", ["owner_id"], name: "exercise_owners_owner_id_fk", using: :btree - - create_table "exercise_versions", force: :cascade do |t| - t.integer "stem_id", limit: 4 + create_table "exercise_versions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "stem_id" t.datetime "created_at" t.datetime "updated_at" t.integer "exercise_id", limit: 4, null: false @@ -213,107 +199,100 @@ t.integer "creator_id", limit: 4 t.integer "irt_data_id", limit: 4 t.text "text_representation", limit: 16777215 + t.index ["creator_id"], name: "exercise_versions_creator_id_fk", using: :btree + t.index ["exercise_id"], name: "index_exercise_versions_on_exercise_id", using: :btree + t.index ["irt_data_id"], name: "exercise_versions_irt_data_id_fk", using: :btree + t.index ["stem_id"], name: "index_exercise_versions_on_stem_id", using: :btree end - add_index "exercise_versions", ["creator_id"], name: "exercise_versions_creator_id_fk", using: :btree - add_index "exercise_versions", ["exercise_id"], name: "index_exercise_versions_on_exercise_id", using: :btree - add_index "exercise_versions", ["irt_data_id"], name: "exercise_versions_irt_data_id_fk", using: :btree - add_index "exercise_versions", ["stem_id"], name: "index_exercise_versions_on_stem_id", using: :btree - - create_table "exercise_versions_resource_files", id: false, force: :cascade do |t| - t.integer "exercise_version_id", limit: 4, null: false - t.integer "resource_file_id", limit: 4, null: false + create_table "exercise_versions_resource_files", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "exercise_version_id", null: false + t.integer "resource_file_id", null: false + t.index ["exercise_version_id"], name: "index_exercise_versions_resource_files_on_exercise_version_id", using: :btree + t.index ["resource_file_id"], name: "index_exercise_versions_resource_files_on_resource_file_id", using: :btree end - add_index "exercise_versions_resource_files", ["exercise_version_id"], name: "index_exercise_versions_resource_files_on_exercise_version_id", using: :btree - add_index "exercise_versions_resource_files", ["resource_file_id"], name: "index_exercise_versions_resource_files_on_resource_file_id", using: :btree - - create_table "exercise_workouts", force: :cascade do |t| - t.integer "exercise_id", limit: 4, null: false - t.integer "workout_id", limit: 4, null: false - t.integer "position", limit: 4, null: false + create_table "exercise_workouts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "exercise_id", null: false + t.integer "workout_id", null: false + t.integer "position", null: false t.float "points", limit: 24, default: 1.0 t.datetime "created_at" t.datetime "updated_at" + t.index ["exercise_id"], name: "exercise_workouts_exercise_id_fk", using: :btree + t.index ["workout_id"], name: "exercise_workouts_workout_id_fk", using: :btree end - add_index "exercise_workouts", ["exercise_id"], name: "exercise_workouts_exercise_id_fk", using: :btree - add_index "exercise_workouts", ["workout_id"], name: "exercise_workouts_workout_id_fk", using: :btree - - create_table "exercises", force: :cascade do |t| - t.integer "question_type", limit: 4, null: false - t.integer "current_version_id", limit: 4 + create_table "exercises", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "question_type", null: false + t.integer "current_version_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "versions", limit: 4 - t.integer "exercise_family_id", limit: 4 - t.string "name", limit: 255 - t.boolean "is_public", default: false, null: false - t.integer "experience", limit: 4, null: false - t.integer "irt_data_id", limit: 4 - t.string "external_id", limit: 255 - t.integer "exercise_collection_id", limit: 4 + t.integer "versions" + t.integer "exercise_family_id" + t.string "name" + t.boolean "is_public", default: false, null: false + t.integer "experience", null: false + t.integer "irt_data_id" + t.string "external_id" + t.integer "exercise_collection_id" + t.index ["current_version_id"], name: "index_exercises_on_current_version_id", using: :btree + t.index ["exercise_collection_id"], name: "index_exercises_on_exercise_collection_id", using: :btree + t.index ["exercise_family_id"], name: "index_exercises_on_exercise_family_id", using: :btree + t.index ["external_id"], name: "index_exercises_on_external_id", unique: true, using: :btree + t.index ["irt_data_id"], name: "exercises_irt_data_id_fk", using: :btree + t.index ["is_public"], name: "index_exercises_on_is_public", using: :btree end - add_index "exercises", ["current_version_id"], name: "index_exercises_on_current_version_id", using: :btree - add_index "exercises", ["exercise_collection_id"], name: "index_exercises_on_exercise_collection_id", using: :btree - add_index "exercises", ["exercise_family_id"], name: "index_exercises_on_exercise_family_id", using: :btree - add_index "exercises", ["external_id"], name: "index_exercises_on_external_id", unique: true, using: :btree - add_index "exercises", ["irt_data_id"], name: "exercises_irt_data_id_fk", using: :btree - add_index "exercises", ["is_public"], name: "index_exercises_on_is_public", using: :btree - - create_table "friendly_id_slugs", force: :cascade do |t| - t.string "slug", limit: 255, default: "", null: false - t.integer "sluggable_id", limit: 4, null: false + create_table "friendly_id_slugs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "slug", default: "", null: false + t.integer "sluggable_id", null: false t.string "sluggable_type", limit: 50 t.string "scope", limit: 255 t.datetime "created_at" + t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree + t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree + t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree + t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree end - add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree - add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree - add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree - add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree - - create_table "global_roles", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false - t.boolean "can_manage_all_courses", default: false, null: false - t.boolean "can_edit_system_configuration", default: false, null: false - t.boolean "builtin", default: false, null: false + create_table "global_roles", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name", default: "", null: false + t.boolean "can_manage_all_courses", default: false, null: false + t.boolean "can_edit_system_configuration", default: false, null: false + t.boolean "builtin", default: false, null: false end - create_table "group_access_requests", force: :cascade do |t| - t.integer "user_id", limit: 4 - t.integer "user_group_id", limit: 4 - t.boolean "pending", default: true + create_table "group_access_requests", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "user_id" + t.integer "user_group_id" + t.boolean "pending", default: true t.boolean "decision" t.datetime "created_at" t.datetime "updated_at" + t.index ["user_group_id"], name: "index_group_access_requests_on_user_group_id", using: :btree + t.index ["user_id"], name: "index_group_access_requests_on_user_id", using: :btree end - add_index "group_access_requests", ["user_group_id"], name: "index_group_access_requests_on_user_group_id", using: :btree - add_index "group_access_requests", ["user_id"], name: "index_group_access_requests_on_user_id", using: :btree - - create_table "identities", force: :cascade do |t| - t.integer "user_id", limit: 4, null: false - t.string "provider", limit: 255, default: "", null: false - t.string "uid", limit: 255, default: "", null: false + create_table "identities", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "user_id", null: false + t.string "provider", default: "", null: false + t.string "uid", default: "", null: false t.datetime "created_at" t.datetime "updated_at" + t.index ["uid", "provider"], name: "index_identities_on_uid_and_provider", using: :btree + t.index ["user_id"], name: "index_identities_on_user_id", using: :btree end - add_index "identities", ["uid", "provider"], name: "index_identities_on_uid_and_provider", using: :btree - add_index "identities", ["user_id"], name: "index_identities_on_user_id", using: :btree - - create_table "irt_data", force: :cascade do |t| - t.integer "attempt_count", limit: 4, null: false + create_table "irt_data", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "attempt_count", null: false t.float "sum_of_scores", limit: 24, null: false t.float "difficulty", limit: 24, null: false t.float "discrimination", limit: 24, null: false end - create_table "license_policies", force: :cascade do |t| - t.string "name", limit: 255 + create_table "license_policies", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name" t.text "description", limit: 65535 t.boolean "can_fork" t.boolean "is_public" @@ -321,61 +300,56 @@ t.datetime "updated_at" end - create_table "licenses", force: :cascade do |t| - t.string "name", limit: 255 + create_table "licenses", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name" t.text "description", limit: 65535 - t.string "url", limit: 255 - t.integer "license_policy_id", limit: 4 + t.string "url" + t.integer "license_policy_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["license_policy_id"], name: "index_licenses_on_license_policy_id", using: :btree end - add_index "licenses", ["license_policy_id"], name: "index_licenses_on_license_policy_id", using: :btree - - create_table "lms_instances", force: :cascade do |t| - t.string "consumer_key", limit: 255 - t.string "consumer_secret", limit: 255 + create_table "lms_instances", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "consumer_key" + t.string "consumer_secret" t.datetime "created_at" t.datetime "updated_at" - t.string "url", limit: 255 - t.integer "lms_type_id", limit: 4 - t.integer "organization_id", limit: 4 + t.string "url" + t.integer "lms_type_id" + t.integer "organization_id" + t.index ["lms_type_id"], name: "lms_instances_lms_type_id_fk", using: :btree + t.index ["organization_id"], name: "index_lms_instances_on_organization_id", using: :btree + t.index ["url"], name: "index_lms_instances_on_url", unique: true, using: :btree end - add_index "lms_instances", ["lms_type_id"], name: "lms_instances_lms_type_id_fk", using: :btree - add_index "lms_instances", ["organization_id"], name: "index_lms_instances_on_organization_id", using: :btree - add_index "lms_instances", ["url"], name: "index_lms_instances_on_url", unique: true, using: :btree - - create_table "lms_types", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false + create_table "lms_types", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" + t.index ["name"], name: "index_lms_types_on_name", unique: true, using: :btree end - add_index "lms_types", ["name"], name: "index_lms_types_on_name", unique: true, using: :btree - - create_table "lti_identities", force: :cascade do |t| - t.string "lti_user_id", limit: 255 - t.integer "user_id", limit: 4 - t.integer "lms_instance_id", limit: 4 + create_table "lti_identities", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "lti_user_id" + t.integer "user_id" + t.integer "lms_instance_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["lms_instance_id"], name: "index_lti_identities_on_lms_instance_id", using: :btree + t.index ["user_id"], name: "index_lti_identities_on_user_id", using: :btree end - add_index "lti_identities", ["lms_instance_id"], name: "index_lti_identities_on_lms_instance_id", using: :btree - add_index "lti_identities", ["user_id"], name: "index_lti_identities_on_user_id", using: :btree - - create_table "lti_workouts", force: :cascade do |t| + create_table "lti_workouts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "workout_id", limit: 4 t.string "lms_assignment_id", limit: 255, null: false t.datetime "created_at" t.datetime "updated_at" t.integer "lms_instance_id", limit: 4 + t.index ["lms_instance_id"], name: "index_lti_workouts_on_lms_instance_id", using: :btree + t.index ["workout_id"], name: "index_lti_workouts_on_workout_id", using: :btree end - add_index "lti_workouts", ["lms_instance_id"], name: "index_lti_workouts_on_lms_instance_id", using: :btree - add_index "lti_workouts", ["workout_id"], name: "index_lti_workouts_on_workout_id", using: :btree - create_table "memberships", force: :cascade do |t| t.integer "user_id", limit: 4 t.integer "user_group_id", limit: 4 @@ -383,189 +357,177 @@ t.datetime "updated_at" end - create_table "multiple_choice_prompt_answers", force: :cascade do |t| + create_table "multiple_choice_prompt_answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| end - create_table "multiple_choice_prompts", force: :cascade do |t| + create_table "multiple_choice_prompts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.boolean "allow_multiple", default: false, null: false t.boolean "is_scrambled", default: true, null: false end - create_table "organizations", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false + create_table "organizations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" - t.string "abbreviation", limit: 255 - t.string "slug", limit: 255, default: "", null: false - t.boolean "is_hidden", default: false + t.string "abbreviation" + t.string "slug", default: "", null: false + t.boolean "is_hidden", default: false + t.index ["slug"], name: "index_organizations_on_slug", unique: true, using: :btree end - add_index "organizations", ["slug"], name: "index_organizations_on_slug", unique: true, using: :btree - - create_table "prompt_answers", force: :cascade do |t| - t.integer "attempt_id", limit: 4 - t.integer "prompt_id", limit: 4 - t.integer "actable_id", limit: 4 - t.string "actable_type", limit: 255 + create_table "prompt_answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "attempt_id" + t.integer "prompt_id" + t.integer "actable_id" + t.string "actable_type" + t.index ["actable_id"], name: "index_prompt_answers_on_actable_id", using: :btree + t.index ["attempt_id", "prompt_id"], name: "index_prompt_answers_on_attempt_id_and_prompt_id", unique: true, using: :btree + t.index ["attempt_id"], name: "index_prompt_answers_on_attempt_id", using: :btree + t.index ["prompt_id"], name: "index_prompt_answers_on_prompt_id", using: :btree end - add_index "prompt_answers", ["actable_id"], name: "index_prompt_answers_on_actable_id", using: :btree - add_index "prompt_answers", ["attempt_id", "prompt_id"], name: "index_prompt_answers_on_attempt_id_and_prompt_id", unique: true, using: :btree - add_index "prompt_answers", ["attempt_id"], name: "index_prompt_answers_on_attempt_id", using: :btree - add_index "prompt_answers", ["prompt_id"], name: "index_prompt_answers_on_prompt_id", using: :btree - - create_table "prompts", force: :cascade do |t| - t.integer "exercise_version_id", limit: 4, null: false + create_table "prompts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "exercise_version_id", null: false t.text "question", limit: 65535, null: false - t.integer "position", limit: 4, null: false + t.integer "position", null: false t.text "feedback", limit: 65535 t.datetime "created_at" t.datetime "updated_at" - t.integer "actable_id", limit: 4 - t.string "actable_type", limit: 255 - t.integer "irt_data_id", limit: 4 + t.integer "actable_id" + t.string "actable_type" + t.integer "irt_data_id" + t.index ["actable_id"], name: "index_prompts_on_actable_id", using: :btree + t.index ["exercise_version_id"], name: "index_prompts_on_exercise_version_id", using: :btree + t.index ["irt_data_id"], name: "prompts_irt_data_id_fk", using: :btree end - add_index "prompts", ["actable_id"], name: "index_prompts_on_actable_id", using: :btree - add_index "prompts", ["exercise_version_id"], name: "index_prompts_on_exercise_version_id", using: :btree - add_index "prompts", ["irt_data_id"], name: "prompts_irt_data_id_fk", using: :btree - - create_table "resource_files", force: :cascade do |t| - t.string "filename", limit: 255 - t.string "token", limit: 255, default: "", null: false - t.integer "user_id", limit: 4, null: false - t.boolean "public", default: true + create_table "resource_files", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "filename" + t.string "token", default: "", null: false + t.integer "user_id", null: false + t.boolean "public", default: true t.datetime "created_at" t.datetime "updated_at" + t.index ["token"], name: "index_resource_files_on_token", using: :btree + t.index ["user_id"], name: "index_resource_files_on_user_id", using: :btree end - add_index "resource_files", ["token"], name: "index_resource_files_on_token", using: :btree - add_index "resource_files", ["user_id"], name: "index_resource_files_on_user_id", using: :btree - - create_table "signups", force: :cascade do |t| - t.string "first_name", limit: 255 - t.string "last_name_name", limit: 255 - t.string "email", limit: 255 - t.string "institution", limit: 255 + create_table "signups", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "first_name" + t.string "last_name_name" + t.string "email" + t.string "institution" t.text "comments", limit: 65535 t.datetime "created_at" t.datetime "updated_at" end - create_table "stems", force: :cascade do |t| + create_table "stems", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.text "preamble", limit: 65535 t.datetime "created_at" t.datetime "updated_at" end - create_table "student_extensions", force: :cascade do |t| - t.integer "user_id", limit: 4 - t.integer "workout_offering_id", limit: 4 + create_table "student_extensions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "user_id" + t.integer "workout_offering_id" t.datetime "soft_deadline" t.datetime "hard_deadline" t.datetime "created_at" t.datetime "updated_at" t.integer "time_limit", limit: 4 t.datetime "opening_date" + t.index ["user_id"], name: "index_student_extensions_on_user_id", using: :btree + t.index ["workout_offering_id"], name: "index_student_extensions_on_workout_offering_id", using: :btree end - add_index "student_extensions", ["user_id"], name: "index_student_extensions_on_user_id", using: :btree - add_index "student_extensions", ["workout_offering_id"], name: "index_student_extensions_on_workout_offering_id", using: :btree - - create_table "tag_user_scores", force: :cascade do |t| - t.integer "user_id", limit: 4, null: false - t.integer "experience", limit: 4, default: 0 + create_table "tag_user_scores", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "user_id", null: false + t.integer "experience", default: 0 t.datetime "created_at" t.datetime "updated_at" - t.integer "completed_exercises", limit: 4, default: 0 + t.integer "completed_exercises", default: 0 + t.index ["user_id"], name: "index_tag_user_scores_on_user_id", using: :btree end - add_index "tag_user_scores", ["user_id"], name: "index_tag_user_scores_on_user_id", using: :btree - - create_table "taggings", force: :cascade do |t| - t.integer "tag_id", limit: 4 - t.integer "taggable_id", limit: 4 - t.string "taggable_type", limit: 255 - t.integer "tagger_id", limit: 4 - t.string "tagger_type", limit: 255 + create_table "taggings", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" t.string "context", limit: 128 t.datetime "created_at" + t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree + t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree end - add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree - add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree - - create_table "tags", force: :cascade do |t| - t.string "name", limit: 255 - t.integer "taggings_count", limit: 4, default: 0 + create_table "tags", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name" + t.integer "taggings_count", default: 0 + t.index ["name"], name: "index_tags_on_name", unique: true, using: :btree end - add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree - - create_table "terms", force: :cascade do |t| - t.integer "season", limit: 4, null: false - t.date "starts_on", null: false - t.date "ends_on", null: false - t.integer "year", limit: 4, null: false + create_table "terms", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "season", null: false + t.date "starts_on", null: false + t.date "ends_on", null: false + t.integer "year", null: false t.datetime "created_at" t.datetime "updated_at" - t.string "slug", limit: 255, default: "", null: false + t.string "slug", default: "", null: false + t.index ["slug"], name: "index_terms_on_slug", unique: true, using: :btree + t.index ["year", "season"], name: "index_terms_on_year_and_season", using: :btree end - add_index "terms", ["slug"], name: "index_terms_on_slug", unique: true, using: :btree - add_index "terms", ["year", "season"], name: "index_terms_on_year_and_season", using: :btree - - create_table "test_case_results", force: :cascade do |t| - t.integer "test_case_id", limit: 4, null: false - t.integer "user_id", limit: 4, null: false + create_table "test_case_results", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "test_case_id", null: false + t.integer "user_id", null: false t.text "execution_feedback", limit: 65535 - t.integer "feedback_line_no", limit: 4 t.datetime "created_at" t.datetime "updated_at" t.boolean "pass", null: false - t.integer "coding_prompt_answer_id", limit: 4 + t.integer "coding_prompt_answer_id" + t.index ["coding_prompt_answer_id"], name: "index_test_case_results_on_coding_prompt_answer_id", using: :btree + t.index ["test_case_id"], name: "index_test_case_results_on_test_case_id", using: :btree + t.index ["user_id"], name: "index_test_case_results_on_user_id", using: :btree end - add_index "test_case_results", ["coding_prompt_answer_id"], name: "index_test_case_results_on_coding_prompt_answer_id", using: :btree - add_index "test_case_results", ["test_case_id"], name: "index_test_case_results_on_test_case_id", using: :btree - add_index "test_case_results", ["user_id"], name: "index_test_case_results_on_user_id", using: :btree - - create_table "test_cases", force: :cascade do |t| + create_table "test_cases", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.text "negative_feedback", limit: 65535 t.float "weight", limit: 24, null: false t.text "description", limit: 65535 t.datetime "created_at" t.datetime "updated_at" - t.integer "coding_prompt_id", limit: 4, null: false + t.integer "coding_prompt_id", null: false t.text "input", limit: 65535, null: false t.text "expected_output", limit: 65535, null: false t.boolean "static", default: false, null: false t.boolean "screening", default: false, null: false t.boolean "example", default: false, null: false t.boolean "hidden", default: false, null: false + t.index ["coding_prompt_id"], name: "index_test_cases_on_coding_prompt_id", using: :btree end - add_index "test_cases", ["coding_prompt_id"], name: "index_test_cases_on_coding_prompt_id", using: :btree - - create_table "time_zones", force: :cascade do |t| - t.string "name", limit: 255 - t.string "zone", limit: 255 - t.string "display_as", limit: 255 + create_table "time_zones", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name" + t.string "zone" + t.string "display_as" t.datetime "created_at" t.datetime "updated_at" end - create_table "user_groups", force: :cascade do |t| - t.string "name", limit: 255 + create_table "user_groups", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name" t.datetime "created_at" t.datetime "updated_at" t.text "description", limit: 65535 end - create_table "users", force: :cascade do |t| - t.string "email", limit: 255, default: "", null: false - t.string "encrypted_password", limit: 255, default: "", null: false - t.string "reset_password_token", limit: 255 + create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" t.integer "sign_in_count", limit: 4, default: 0, null: false @@ -578,70 +540,65 @@ t.datetime "confirmation_sent_at" t.datetime "created_at" t.datetime "updated_at" - t.string "first_name", limit: 255 - t.string "last_name", limit: 255 - t.integer "global_role_id", limit: 4, null: false - t.string "avatar", limit: 255 - t.string "slug", limit: 255, default: "", null: false - t.integer "current_workout_score_id", limit: 4 - t.integer "time_zone_id", limit: 4 + t.string "first_name" + t.string "last_name" + t.integer "global_role_id", null: false + t.string "avatar" + t.string "slug", default: "", null: false + t.integer "current_workout_score_id" + t.integer "time_zone_id" + t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree + t.index ["current_workout_score_id"], name: "index_users_on_current_workout_score_id", unique: true, using: :btree + t.index ["email"], name: "index_users_on_email", unique: true, using: :btree + t.index ["global_role_id"], name: "index_users_on_global_role_id", using: :btree + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree + t.index ["slug"], name: "index_users_on_slug", unique: true, using: :btree + t.index ["time_zone_id"], name: "index_users_on_time_zone_id", using: :btree end - add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree - add_index "users", ["current_workout_score_id"], name: "index_users_on_current_workout_score_id", unique: true, using: :btree - add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree - add_index "users", ["global_role_id"], name: "index_users_on_global_role_id", using: :btree - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree - add_index "users", ["slug"], name: "index_users_on_slug", unique: true, using: :btree - add_index "users", ["time_zone_id"], name: "index_users_on_time_zone_id", using: :btree - - create_table "visualization_loggings", force: :cascade do |t| + create_table "visualization_loggings", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "user_id", limit: 4 t.integer "exercise_id", limit: 4 t.integer "workout_id", limit: 4 t.integer "workout_offering_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" + t.index ["exercise_id"], name: "index_visualization_loggings_on_exercise_id", using: :btree + t.index ["user_id"], name: "index_visualization_loggings_on_user_id", using: :btree + t.index ["workout_id"], name: "index_visualization_loggings_on_workout_id", using: :btree + t.index ["workout_offering_id"], name: "index_visualization_loggings_on_workout_offering_id", using: :btree end - add_index "visualization_loggings", ["exercise_id"], name: "index_visualization_loggings_on_exercise_id", using: :btree - add_index "visualization_loggings", ["user_id"], name: "index_visualization_loggings_on_user_id", using: :btree - add_index "visualization_loggings", ["workout_id"], name: "index_visualization_loggings_on_workout_id", using: :btree - add_index "visualization_loggings", ["workout_offering_id"], name: "index_visualization_loggings_on_workout_offering_id", using: :btree - - create_table "workout_offerings", force: :cascade do |t| - t.integer "course_offering_id", limit: 4, null: false - t.integer "workout_id", limit: 4, null: false + create_table "workout_offerings", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "course_offering_id", null: false + t.integer "workout_id", null: false t.datetime "created_at" t.datetime "updated_at" t.datetime "opening_date" t.datetime "soft_deadline" t.datetime "hard_deadline" - t.boolean "published", default: true, null: false - t.integer "time_limit", limit: 4 - t.integer "workout_policy_id", limit: 4 - t.integer "continue_from_workout_id", limit: 4 - t.string "lms_assignment_id", limit: 255 - t.boolean "most_recent", default: true - t.string "lms_assignment_url", limit: 255 - t.integer "attempt_limit", limit: 4 - end - - add_index "workout_offerings", ["continue_from_workout_id"], name: "workout_offerings_continue_from_workout_id_fk", using: :btree - add_index "workout_offerings", ["course_offering_id"], name: "index_workout_offerings_on_course_offering_id", using: :btree - add_index "workout_offerings", ["lms_assignment_id"], name: "index_workout_offerings_on_lms_assignment_id", using: :btree - add_index "workout_offerings", ["workout_id"], name: "index_workout_offerings_on_workout_id", using: :btree - add_index "workout_offerings", ["workout_policy_id"], name: "index_workout_offerings_on_workout_policy_id", using: :btree - - create_table "workout_owners", force: :cascade do |t| - t.integer "workout_id", limit: 4, null: false - t.integer "owner_id", limit: 4, null: false - end - - add_index "workout_owners", ["owner_id"], name: "workout_owners_owner_id_fk", using: :btree - add_index "workout_owners", ["workout_id", "owner_id"], name: "index_workout_owners_on_workout_id_and_owner_id", unique: true, using: :btree - - create_table "workout_policies", force: :cascade do |t| + t.boolean "published", default: true, null: false + t.integer "time_limit" + t.integer "workout_policy_id" + t.integer "continue_from_workout_id" + t.string "lms_assignment_id" + t.boolean "most_recent", default: true + t.string "lms_assignment_url" + t.index ["continue_from_workout_id"], name: "workout_offerings_continue_from_workout_id_fk", using: :btree + t.index ["course_offering_id"], name: "index_workout_offerings_on_course_offering_id", using: :btree + t.index ["lms_assignment_id"], name: "index_workout_offerings_on_lms_assignment_id", using: :btree + t.index ["workout_id"], name: "index_workout_offerings_on_workout_id", using: :btree + t.index ["workout_policy_id"], name: "index_workout_offerings_on_workout_policy_id", using: :btree + end + + create_table "workout_owners", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "workout_id", null: false + t.integer "owner_id", null: false + t.index ["owner_id"], name: "workout_owners_owner_id_fk", using: :btree + t.index ["workout_id", "owner_id"], name: "index_workout_owners_on_workout_id_and_owner_id", unique: true, using: :btree + end + + create_table "workout_policies", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.boolean "hide_thumbnails_before_start" t.boolean "hide_feedback_before_finish" t.boolean "hide_compilation_feedback_before_finish" @@ -657,9 +614,9 @@ t.string "description", limit: 255 end - create_table "workout_scores", force: :cascade do |t| - t.integer "workout_id", limit: 4, null: false - t.integer "user_id", limit: 4, null: false + create_table "workout_scores", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.integer "workout_id", null: false + t.integer "user_id", null: false t.float "score", limit: 24 t.boolean "completed" t.datetime "completed_at" @@ -668,33 +625,29 @@ t.integer "exercises_remaining", limit: 4 t.datetime "created_at" t.datetime "updated_at" - t.integer "workout_offering_id", limit: 4 - t.string "lis_outcome_service_url", limit: 255 - t.string "lis_result_sourcedid", limit: 255 - t.integer "lti_workout_id", limit: 4 + t.integer "workout_offering_id" + t.string "lis_outcome_service_url" + t.string "lis_result_sourcedid" + t.index ["user_id"], name: "index_workout_scores_on_user_id", using: :btree + t.index ["workout_id"], name: "index_workout_scores_on_workout_id", using: :btree + t.index ["workout_offering_id"], name: "workout_scores_workout_offering_id_fk", using: :btree end - add_index "workout_scores", ["lti_workout_id"], name: "index_workout_scores_on_lti_workout_id", using: :btree - add_index "workout_scores", ["user_id"], name: "index_workout_scores_on_user_id", using: :btree - add_index "workout_scores", ["workout_id"], name: "index_workout_scores_on_workout_id", using: :btree - add_index "workout_scores", ["workout_offering_id"], name: "workout_scores_workout_offering_id_fk", using: :btree - - create_table "workouts", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false + create_table "workouts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.string "name", default: "", null: false t.boolean "scrambled", default: false t.datetime "created_at" t.datetime "updated_at" t.text "description", limit: 65535 - t.integer "points_multiplier", limit: 4 - t.integer "creator_id", limit: 4 - t.string "external_id", limit: 255 + t.integer "points_multiplier" + t.integer "creator_id" + t.string "external_id" t.boolean "is_public" + t.index ["creator_id"], name: "workouts_creator_id_fk", using: :btree + t.index ["external_id"], name: "index_workouts_on_external_id", unique: true, using: :btree + t.index ["is_public"], name: "index_workouts_on_is_public", using: :btree end - add_index "workouts", ["creator_id"], name: "workouts_creator_id_fk", using: :btree - add_index "workouts", ["external_id"], name: "index_workouts_on_external_id", unique: true, using: :btree - add_index "workouts", ["is_public"], name: "index_workouts_on_is_public", using: :btree - add_foreign_key "attempts", "exercise_versions", name: "attempts_exercise_version_id_fk" add_foreign_key "attempts", "users", name: "attempts_user_id_fk" add_foreign_key "attempts", "workout_scores", column: "active_score_id", name: "attempts_active_score_id_fk" @@ -727,7 +680,7 @@ add_foreign_key "exercises", "irt_data", column: "irt_data_id", name: "exercises_irt_data_id_fk" add_foreign_key "identities", "users", name: "identities_user_id_fk" add_foreign_key "lms_instances", "lms_types", name: "lms_instances_lms_type_id_fk" - add_foreign_key "lti_workouts", "lms_instances" + add_foreign_key "lti_workouts", "lms_instances", name: "lti_workouts_lms_instance_id_fk" add_foreign_key "prompt_answers", "attempts", name: "prompt_answers_attempt_id_fk" add_foreign_key "prompt_answers", "prompts", name: "prompt_answers_prompt_id_fk" add_foreign_key "prompts", "exercise_versions", name: "prompts_exercise_version_id_fk" @@ -749,7 +702,7 @@ add_foreign_key "workout_offerings", "workouts", name: "workout_offerings_workout_id_fk" add_foreign_key "workout_owners", "users", column: "owner_id", name: "workout_owners_owner_id_fk" add_foreign_key "workout_owners", "workouts", name: "workout_owners_workout_id_fk" - add_foreign_key "workout_scores", "lti_workouts" + add_foreign_key "workout_scores", "lti_workouts", name: "workout_scores_lti_workout_id_fk" add_foreign_key "workout_scores", "users", name: "workout_scores_user_id_fk" add_foreign_key "workout_scores", "workout_offerings", name: "workout_scores_workout_offering_id_fk" add_foreign_key "workout_scores", "workouts", name: "workout_scores_workout_id_fk" From 72a75061091432ea7378e3e70aac8ec517310d1c Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 18 Dec 2018 13:44:26 +0530 Subject: [PATCH 02/53] Fix exercise-related active-record queries and asset precompilation which got overridden by bin/update --- app/models/exercise.rb | 19 ++++++++++--------- app/models/user.rb | 2 +- config/initializers/assets.rb | 3 ++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/models/exercise.rb b/app/models/exercise.rb index ae9adacc..6c2781c1 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -98,11 +98,6 @@ class Exercise < ActiveRecord::Base 'C++' => 'cpp' } - - scope :visible_through_user, -> (u) { joins{exercise_owners.outer}.joins{exercise_collection.outer}. - where{ (exercise_owners.owner == u) | (exercise_collection.user == u) } } - - #~ Class methods ............................................................ # ------------------------------------------------------------- @@ -136,8 +131,13 @@ def self.search(terms, user = nil) end end + def self.visible_through_user(user) + return Exercise.left_outer_joins(:exercise_owners) + .left_outer_joins(:exercise_collection) + .where('exercise_owners.owner_id = ? or exercise_collections.user_id = ?', + user.id, user.id) + end - # ------------------------------------------------------------- # Get a list of Exercises that are visible to the specified user. # # It is the union of exercises that are publicly visible, created or owned by the user, @@ -163,9 +163,9 @@ def self.visible_to_user(user) visible_through_user_group = Exercise.visible_through_user_group(user) return visible_through_user - .union(publicly_visible) + .union(Exercise.publicly_visible) .union(visible_through_course_offering) - .union(visible_through_user_group) + .union(Exercise.visible_through_user_group(user)) end @@ -186,7 +186,8 @@ def self.publicly_visible public_exercise = Exercise.where(is_public: true) - return public_exercise.union(public_license) + return Exercise.joins(exercise_collection: [ license: :license_policy ]) + .where('(exercises.is_public is null and license_policies.is_public = true) or exercises.is_public = true') end diff --git a/app/models/user.rb b/app/models/user.rb index 94cd6dc3..6f557d97 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -107,7 +107,7 @@ class User < ActiveRecord::Base } scope :alphabetical, -> { order('last_name asc, first_name asc, email asc') } - scope :visible_to_user, -> (u) { joins{course_enrollments.outer}. + scope :visible_to_user, -> (u) { left_outer_joins(:course_enrollments) where{ (id == u.id) | (course_enrollments.course_role_id != CourseRole::STUDENT_ID) } } diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index ca44ed1f..8690d4a5 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -16,5 +16,6 @@ path !~ /bootstrap-social/ && path !~ /active_admin/ && %w(.js .css).include?(File.extname(filename)) - }, /application.(css|.js)$/ + }, /application.(css|.js)$/, + %w(*.png *.jpg *.jpeg *.gif *.mustache.html) ] From 2e81b94fed8d4ef25f8de30261e9008c14f66e41 Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 18 Dec 2018 20:23:39 +0530 Subject: [PATCH 03/53] Use SQL instead of ActiveRecord hashes for complex where queries, because rails is not inferring table names correctly. --- app/models/user.rb | 28 +++++++++++++--------------- app/models/workout.rb | 7 ++++--- config/initializers/inflections.rb | 5 +++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 6f557d97..4135a9bf 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -224,23 +224,21 @@ def managed_course_offerings(options = {}) course_enrollments.where(course_roles: { can_manage_course: true }). map(&:course_offering) elsif course.nil? - course_enrollments.joins(:course_offering). - where(course_roles: - { can_manage_course: true }, course_offering: - { term: term } - ).map(&:course_offering) + course_enrollments.joins(:course_offering) + .where('course_roles.can_manage_course = true and + course_offerings.term_id = ?', term.id) + .map(&:course_offering) elsif term.nil? - course_enrollments.joins(:course_offering). - where(course_roles: - { can_manage_course: true }, course_offering: - { course: course } - ).map(&:course_offering) + course_enrollments.joins(:course_offering) + .where('course_roles.can_manage_course = true and + course_offerings.course_id = ?', course.id) + .map(&:course_offering) else - course_enrollments.joins(:course_offering). - where(course_roles: - { can_manage_course: true }, course_offering: - { course: course, term: term } - ).map(&:course_offering) + course_enrollments.joins(:course_offering) + .where('course_roles.can_manage_course = true and + course_offerings.course_id = ? and course_offerings.term_id = ?', + course.id, term.id) + .map(&:course_offering) end end diff --git a/app/models/workout.rb b/app/models/workout.rb index 3e9897a2..973ea794 100644 --- a/app/models/workout.rb +++ b/app/models/workout.rb @@ -72,12 +72,13 @@ class Workout < ActiveRecord::Base #~ Hooks .................................................................... - scope :visible_to_user, -> (u) { where { (creator_id == u.id) | (is_public == true) } } # paginates_per 1 - #~ Class methods ............................................................ + def self.visible_to_user(user) + return Workout.where(creator_id: user.id).or(Workout.where(is_public: true)) + end #~ Instance methods ......................................................... @@ -359,7 +360,7 @@ def self.search(terms, user, course, searching_offerings) if user available_workouts = Workout.where( - id: (Workout.visible_to_user(user) + user.managed_workouts) + id: (Workout.visible_to_user(user).union(user.managed_workouts)) .map(&:id) ) diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ac033bf9..01553713 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -3,12 +3,13 @@ # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: -# ActiveSupport::Inflector.inflections(:en) do |inflect| +ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) -# end + inflect.acronym 'IRT' +end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| From b622a460d61675b100bdf714b5c0485fcaf039a2 Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Thu, 20 Dec 2018 12:28:04 +0530 Subject: [PATCH 04/53] Replace squeel usage with vanilla active record. --- app/models/ability.rb | 26 +++++++++++++------------- app/models/workout_score.rb | 21 ++++++++++++--------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index f7e39b26..247374e0 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -210,12 +210,12 @@ def process_exercises(user) can :practice, Exercise do |e| now = Time.now - e.visible_to?(user) || WorkoutOffering. - joins{workout.exercises}.joins{course_offering.course_enrollments}. - where{ - ((starts_on == nil) | (starts_on <= now)) & - course_offering.course_enrollments.user_id == user.id - }.any? + e.visible_to?(user) || WorkoutOffering + .joins(workout: :exercises, course_offering: [:course_enrollments, :term]) + .where( + '(terms.starts_on is ? or terms.starts_on <= ?) and + course_enrollments.user_id = ?', nil, now, now + ).any? end can [ :gym_practice, :embed ], Exercise do |e| @@ -224,13 +224,13 @@ def process_exercises(user) can :evaluate, Exercise do |e| now = Time.now - WorkoutOffering. - joins{workout.exercises}.joins{course_offering.course_enrollments}. - where{ - ((starts_on == nil) | (starts_on <= now)) & - ((hard_deadline >= now) | (soft_deadline >= now)) & - course_offering.course_enrollments.user_id == user.id - }.any? + WorkoutOffering + .joins(workout: :exercises, course_offering: [:course_enrollments, :term]) + .where( + '(terms.starts_on is ? or terms.starts_on <= ?) + and (workout_offerings.hard_deadline >= ? or workout_offerings.soft_deadline >= ?) + and course_enrollments.user_id = ?', nil, now, now, now, user.id + ).any? end # can :create, Exercise if user.global_role.is_instructor? # can :edit, Exercise do |e| diff --git a/app/models/workout_score.rb b/app/models/workout_score.rb index 582a21fb..306cdfbc 100644 --- a/app/models/workout_score.rb +++ b/app/models/workout_score.rb @@ -183,16 +183,19 @@ def attempts_left_for_exercise_version(exercise_version) # ------------------------------------------------------------- def scoring_attempt_for(exercise) workout_score = self - Attempt.joins{exercise_version}. - where{(active_score_id == workout_score.id) & - (exercise_version.exercise_id == exercise.id)}.first + Attempt.joins(:exercise_version) + .where( + 'attempts.active_score_id = ? and + exericise_versions.exercise_id = ?', workout_score.id, exercise.id + ).first end # ------------------------------------------------------------- def previous_attempt_for(exercise) - attempts.joins{exercise_version}. - where{exercise_version.exercise_id == exercise.id}.first + attempts.joins(:exercise_version) + .where('exercise_versions.exercise_id = ?', exercise.id) + .first end @@ -309,7 +312,7 @@ def retotal # Class method to find workout scores that were computed after # they were closed. Outputs a list of workout scores. def self.late(options={}) - WorkoutScore.joins{ workout_offering } + WorkoutScore.joins(:workout_offering) .joins('inner join student_extensions on student_extensions.workout_offering_id = workout_offerings.id and student_extensions.user_id = workout_scores.user_id') .where('workout_scores.last_attempted_at > @@ -329,9 +332,9 @@ def self.score_fix1 end end ws.workout.exercises.each do |e| - a = ws.attempts.joins{exercise_version}. - where{(exercise_version.exercise_id == e.id)}. - order('submit_time DESC').first + a = ws.attempts.joins(:exercise_version) + .where('exercise_versions.exercise_id = ?', e.id) + .order('submit_time DESC').first if a a.active_score = ws if !a.save From 8562ecba65b218f5963e96d2d6d5a4d067966566 Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 22 Jan 2019 11:12:19 -0500 Subject: [PATCH 05/53] Manually fix merge conflicts in lock file --- Gemfile.lock | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5c8a05bd..1459baba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -284,6 +284,7 @@ GEM modernizr-rails (2.7.1) momentjs-rails (2.20.1) railties (>= 3.1) + momentjs-rails (2.20.1) multi_json (1.13.1) multi_xml (0.6.0) multipart-post (2.1.1) @@ -384,6 +385,7 @@ GEM actionpack (>= 4.2.0, < 6.0) railties (>= 4.2.0, < 6.0) rest-client (2.0.2) + diff-lcs (>= 1.2.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) @@ -472,11 +474,8 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.6) - unicode-display_width (1.6.0) - unicode_utils (1.4.0) wannabe_bool (0.7.1) warden (1.2.7) - rack (>= 1.0) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) From 350854453ef356c0c3b01542b30fa350eabd83a2 Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 22 Jan 2019 12:02:42 -0500 Subject: [PATCH 06/53] Update factory bot for incoming changes --- db/schema.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index f59a963c..46174b2e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -556,11 +556,11 @@ t.index ["time_zone_id"], name: "index_users_on_time_zone_id", using: :btree end - create_table "visualization_loggings", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "user_id", limit: 4 - t.integer "exercise_id", limit: 4 - t.integer "workout_id", limit: 4 - t.integer "workout_offering_id", limit: 4 + create_table "visualization_loggings", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| + t.integer "user_id" + t.integer "exercise_id" + t.integer "workout_id" + t.integer "workout_offering_id" t.datetime "created_at" t.datetime "updated_at" t.index ["exercise_id"], name: "index_visualization_loggings_on_exercise_id", using: :btree From 0fd6b2293a3a63b7e78fe973dc7d48e5c9c44df8 Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 22 Jan 2019 14:14:55 -0500 Subject: [PATCH 07/53] Rails 5.1 --- Gemfile | 9 +- Gemfile.lock | 129 +++++++++--------- app/helpers/application_helper.rb | 3 +- app/views/sse/_ajax_feedback.html.haml | 2 +- bin/setup | 4 + bin/yarn | 11 ++ config/application.rb | 2 +- config/cable.yml | 1 + config/environments/development.rb | 4 +- config/environments/production.rb | 7 +- config/environments/test.rb | 2 +- config/initializers/assets.rb | 8 +- config/initializers/cookies_serializer.rb | 2 +- .../new_framework_defaults_5_1.rb | 14 ++ config/locales/en.yml | 10 ++ config/puma.rb | 23 +++- config/secrets.yml | 18 ++- 17 files changed, 162 insertions(+), 87 deletions(-) create mode 100755 bin/yarn create mode 100644 config/initializers/new_framework_defaults_5_1.rb diff --git a/Gemfile b/Gemfile index 9153c4f4..8d53d5d2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -gem 'rails', '>= 5.0.0.rc2', '< 5.1' +gem 'rails', '~> 5.1' gem 'bootstrap-sass', '~> 3.2.0' gem 'jquery-rails' gem 'jquery-ui-rails' @@ -12,7 +12,7 @@ gem 'formtastic-bootstrap' gem 'sucker_punch', '~> 1.0' gem 'haml', '>= 3.1.4' gem 'haml-rails' -gem 'coffee-rails', '~> 4.0.0' +gem 'coffee-rails', '~> 4.2' gem 'coffee-script-source' gem 'test-unit', '~> 3.0.9' gem 'nokogiri', '~> 1.10.4' @@ -48,14 +48,11 @@ group :development, :test do gem 'thin' gem 'byebug' gem 'sqlite3', '~> 1.3.0' + gem 'listen' gem 'rspec-rails' gem 'annotate' gem 'rails-erd', github: 'voormedia/rails-erd' gem 'faker' - # Needed for debugging support in Aptana Studio. Disabled, since these - # two gems do not support Ruby 2.0 yet :-(. - # gem 'ruby-debug-base' - # gem 'ruby-debug-ide' gem 'pry' gem 'request-log-analyzer' end diff --git a/Gemfile.lock b/Gemfile.lock index 1459baba..b19531ae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -26,29 +26,29 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.0.0.rc2) - actionpack (= 5.0.0.rc2) - nio4r (~> 1.2) + actioncable (5.1.1) + actionpack (= 5.1.1) + nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.0.rc2) - actionpack (= 5.0.0.rc2) - actionview (= 5.0.0.rc2) - activejob (= 5.0.0.rc2) + actionmailer (5.1.1) + actionpack (= 5.1.1) + actionview (= 5.1.1) + activejob (= 5.1.1) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (5.0.0.rc2) - actionview (= 5.0.0.rc2) - activesupport (= 5.0.0.rc2) - rack (~> 2.x) + rails-dom-testing (~> 2.0) + actionpack (5.1.1) + actionview (= 5.1.1) + activesupport (= 5.1.1) + rack (~> 2.0) rack-test (~> 0.6.3) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.0.rc2) - activesupport (= 5.0.0.rc2) + actionview (5.1.1) + activesupport (= 5.1.1) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) active_record-acts_as (3.0.2) activerecord (>= 4.2) activesupport (>= 4.2) @@ -66,18 +66,18 @@ GEM ransack (>= 1.8.7) sass (~> 3.1) sprockets (< 4.1) - activejob (5.0.0.rc2) - activesupport (= 5.0.0.rc2) + activejob (5.1.1) + activesupport (= 5.1.1) globalid (>= 0.3.6) - activemodel (5.0.0.rc2) - activesupport (= 5.0.0.rc2) - activerecord (5.0.0.rc2) - activemodel (= 5.0.0.rc2) - activesupport (= 5.0.0.rc2) - arel (~> 7.0) + activemodel (5.1.1) + activesupport (= 5.1.1) + activerecord (5.1.1) + activemodel (= 5.1.1) + activesupport (= 5.1.1) + arel (~> 8.0) activerecord-import (0.17.2) activerecord (>= 3.2) - activesupport (5.0.0.rc2) + activesupport (5.1.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@ -95,7 +95,7 @@ GEM rake (>= 10.4, < 13.0) arbre (1.2.1) activesupport (>= 3.0.0) - arel (7.1.4) + arel (8.0.0) autoprefixer-rails (9.2.1) execjs awesome_print (1.8.0) @@ -155,9 +155,9 @@ GEM codemirror-rails (5.16.0) railties (>= 3.0, < 6.0) coderay (1.1.2) - coffee-rails (4.0.1) + coffee-rails (4.2.2) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) + railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs @@ -179,7 +179,7 @@ GEM diff-lcs (1.3) domain_name (0.5.20180417) unf (>= 0.0.5, < 1.0.0) - equatable (0.6.1) + erubi (1.8.0) erubis (2.7.0) eventmachine (1.2.7) exception_handler (0.8.0.0) @@ -268,6 +268,10 @@ GEM activerecord kaminari-core (= 1.2.1) kaminari-core (1.2.1) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) log_file (0.0.3) loofah (2.5.0) crass (~> 1.0.2) @@ -293,9 +297,12 @@ GEM net-ssh (>= 2.6.5, < 6.0.0) net-ssh (5.2.0) netrc (0.11.0) - nio4r (2.5.2) - nokogiri (1.10.9) - mini_portile2 (~> 2.4.0) + multi_json (~> 1.3) + multi_xml (~> 0.5) + rack (>= 1.2, < 3) + nio4r (2.3.1) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) oauth (0.5.4) oauth2 (1.4.1) faraday (>= 0.8, < 0.16.0) @@ -339,29 +346,27 @@ GEM rack (2.0.6) rack-test (0.6.3) rack (>= 1.0) - rails (5.0.0.rc2) - actioncable (= 5.0.0.rc2) - actionmailer (= 5.0.0.rc2) - actionpack (= 5.0.0.rc2) - actionview (= 5.0.0.rc2) - activejob (= 5.0.0.rc2) - activemodel (= 5.0.0.rc2) - activerecord (= 5.0.0.rc2) - activesupport (= 5.0.0.rc2) + rails (5.1.1) + actioncable (= 5.1.1) + actionmailer (= 5.1.1) + actionpack (= 5.1.1) + actionview (= 5.1.1) + activejob (= 5.1.1) + activemodel (= 5.1.1) + activerecord (= 5.1.1) + activesupport (= 5.1.1) bundler (>= 1.3.0, < 2.0) - railties (= 5.0.0.rc2) + railties (= 5.1.1) sprockets-rails (>= 2.0.0) - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.9) - activesupport (>= 4.2.0, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.3.0) - loofah (~> 2.3) - railties (4.2.11.1) - actionpack (= 4.2.11.1) - activesupport (= 4.2.11.1) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.0.4) + loofah (~> 2.2, >= 2.2.2) + railties (5.1.1) + actionpack (= 5.1.1) + activesupport (= 5.1.1) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (12.3.3) @@ -405,9 +410,10 @@ GEM rspec-expectations (~> 3.8.0) rspec-mocks (~> 3.8.0) rspec-support (~> 3.8.0) - rspec-support (3.8.2) - ruby-graphviz (1.2.4) - ruby_parser (3.13.1) + rspec-support (3.8.0) + ruby-graphviz (1.2.3) + ruby_dep (1.5.0) + ruby_parser (3.11.0) sexp_processor (~> 4.9) rubyzip (1.3.0) sass (3.7.4) @@ -509,7 +515,7 @@ DEPENDENCIES capybara cocoon codemirror-rails - coffee-rails (~> 4.0.0) + coffee-rails (~> 4.2) coffee-script-source css3-progress-bar-rails csv_shaper @@ -529,7 +535,8 @@ DEPENDENCIES jquery-rails jquery-ui-rails js-routes - kaminari (~> 1.2.1) + kaminari + listen log_file loofah (>= 2.3.1) modernizr-rails @@ -545,7 +552,7 @@ DEPENDENCIES pry puma (~> 4.3.5) rabl - rails (>= 5.0.0.rc2, < 5.1) + rails (~> 5.1) rails-erd! redcarpet remotipart diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 66e36d00..4c8553b2 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -205,7 +205,8 @@ def button_to_with_style( puts "html_options = #{html_options}" button_to_without_style(name, options, html_options, &block) end - alias_method_chain :button_to, :style + alias_method :button_to_without_style, :button_to + alias_method :button_to, :button_to_with_style # ------------------------------------------------------------- diff --git a/app/views/sse/_ajax_feedback.html.haml b/app/views/sse/_ajax_feedback.html.haml index 0b4d5f3f..1172ca74 100644 --- a/app/views/sse/_ajax_feedback.html.haml +++ b/app/views/sse/_ajax_feedback.html.haml @@ -49,7 +49,7 @@ %th Behavior %th Result %tbody - - answer.test_case_results(true).each do |tcr| + - answer.test_case_results.each do |tcr| %tr - if tcr.pass %td.pass diff --git a/bin/setup b/bin/setup index e620b4da..78c4e861 100755 --- a/bin/setup +++ b/bin/setup @@ -18,6 +18,10 @@ chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') # cp 'config/database.yml.sample', 'config/database.yml' diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 00000000..c2bacef8 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +VENDOR_PATH = File.expand_path('..', __dir__) +Dir.chdir(VENDOR_PATH) do + begin + exec "yarnpkg #{ARGV.join(" ")}" + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config/application.rb b/config/application.rb index 4f5b85e6..d95398a5 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,7 +8,7 @@ module CodeWorkout class Application < Rails::Application - # Initialize configuration defaults for originally generated Rails version + # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.1 Rails.application.config.active_record.belongs_to_required_by_default = false # Settings in config/environments/* take precedence over those specified here. diff --git a/config/cable.yml b/config/cable.yml index 0bbde6f7..156e7a0b 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -7,3 +7,4 @@ test: production: adapter: redis url: redis://localhost:6379/1 + channel_prefix: code_workout_production diff --git a/config/environments/development.rb b/config/environments/development.rb index e64889cd..5187e221 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -18,7 +18,7 @@ config.cache_store = :memory_store config.public_file_server.headers = { - 'Cache-Control' => 'public, max-age=172800' + 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" } else config.action_controller.perform_caching = false @@ -50,5 +50,5 @@ # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. - # config.file_watcher = ActiveSupport::EventedFileUpdateChecker + config.file_watcher = ActiveSupport::EventedFileUpdateChecker end diff --git a/config/environments/production.rb b/config/environments/production.rb index 14f1f1f7..0b701344 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -14,6 +14,11 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true + # Attempt to read encrypted secrets from `config/secrets.yml.enc`. + # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or + # `config/secrets.yml.key`. + config.read_encrypted_secrets = true + # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? @@ -78,7 +83,7 @@ if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) + config.logger = ActiveSupport::TaggedLogging.new(logger) end # Do not dump schema after migrations. diff --git a/config/environments/test.rb b/config/environments/test.rb index 30587ef6..8e5cbde5 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -15,7 +15,7 @@ # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - 'Cache-Control' => 'public, max-age=3600' + 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}" } # Show full error reports and disable caching. diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 8690d4a5..05850aa8 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -10,6 +10,12 @@ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # Rails.application.config.assets.precompile += %w( search.js ) +# Add additional assets to the asset load path. +# Rails.application.config.assets.paths << Emoji.images_path +# Add Yarn node_modules folder to the asset load path. +Rails.application.config.assets.paths << Rails.root.join('node_modules') +Rails.application.config.assets.paths << Rails.root.join('public') + Rails.application.config.assets.precompile = [ Proc.new { |filename, path| path =~ /app\/assets/ && @@ -17,5 +23,5 @@ path !~ /active_admin/ && %w(.js .css).include?(File.extname(filename)) }, /application.(css|.js)$/, - %w(*.png *.jpg *.jpeg *.gif *.mustache.html) + %w(*.png *.jpg *.jpeg *.gif *.mustache.html, *.ico) ] diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 1389e86a..5a6a32d3 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -2,4 +2,4 @@ # Specify a serializer for the signed and encrypted cookie jars. # Valid options are :json, :marshal, and :hybrid. -Rails.application.config.action_dispatch.cookies_serializer = :marshal +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/new_framework_defaults_5_1.rb b/config/initializers/new_framework_defaults_5_1.rb new file mode 100644 index 00000000..9010abd5 --- /dev/null +++ b/config/initializers/new_framework_defaults_5_1.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.1 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make `form_with` generate non-remote forms. +Rails.application.config.action_view.form_with_generates_remote_forms = false + +# Unknown asset fallback will return the path passed in when the given +# asset is not present in the asset pipeline. +# Rails.application.config.assets.unknown_asset_fallback = false diff --git a/config/locales/en.yml b/config/locales/en.yml index b1934892..4a4a2d6e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -16,6 +16,16 @@ # # This would use the information in config/locales/es.yml. # +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# # To learn more, please read the Rails Internationalization guide # available at http://guides.rubyonrails.org/i18n.html. diff --git a/config/puma.rb b/config/puma.rb index c7f311f8..1e19380d 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,13 +1,13 @@ # Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers a minimum and maximum. +# The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum, this matches the default thread size of Active Record. +# and maximum; this matches the default thread size of Active Record. # -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } threads threads_count, threads_count -# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. # port ENV.fetch("PORT") { 3000 } @@ -32,16 +32,25 @@ # # preload_app! +# If you are preloading your application and using Active Record, it's +# recommended that you close any connections to the database before workers +# are forked to prevent connection leakage. +# +# before_fork do +# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) +# end + # The code in the `on_worker_boot` will be called if you are using # clustered mode by specifying a number of `workers`. After each worker -# process is booted this block will be run, if you are using `preload_app!` -# option you will want to use this block to reconnect to any threads -# or connections that may have been created at application boot, Ruby +# process is booted, this block will be run. If you are using the `preload_app!` +# option, you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, as Ruby # cannot share connections between processes. # # on_worker_boot do # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) # end +# # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart diff --git a/config/secrets.yml b/config/secrets.yml index 7e8ea854..01d254be 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -10,13 +10,23 @@ # Make sure the secrets in this file are kept private # if you're sharing your code publicly. +# Shared secrets are available across all environments. + +# shared: +# api_key: a1B2c3D4e5F6 + +# Environmental secrets are only available for that specific environment. + development: - secret_key_base: eff0aae935bd44c6013779062036ce365082fadabfa7944f1b1455e9468fbf3ed613a988b884590965e40105c8db9ee47f3777802fb839e089ad9e565690e126 + secret_key_base: 99d725b98ec18eac5e0491b3bfa7dc56c397dbd9ac48e72b55cf642fb6f89fb0214795e4d4b243d9d6337f14a5463c6d974c8d02146c663e03da838c5ff9c3db test: - secret_key_base: 0394fa40ba5b3ac258de3ac21e19844491cc15f84775b31cc081103e856203148bf0cab364e6c9dee9c59852ab063554c7c67af503d65ee46aaf18a5d76cde90 + secret_key_base: 2f5b62caef54d44556fea8ffe3b0a57b1c670b4dee5c338b3c65f4b5a0bda073d9cc51888ef8101ce274640df51e6cce32c50489dbde5eb0ba712a65302c81d8 + +# Do not keep production secrets in the unencrypted secrets file. +# Instead, either read values from the environment. +# Or, use `bin/rails secrets:setup` to configure encrypted secrets +# and move the `production:` environment over there. -# Do not keep production secrets in the repository, -# instead read values from the environment. production: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> From aeb2902bc9ef8ed53c5b7a5228a5c328d0d5ff71 Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 22 Jan 2019 15:14:39 -0500 Subject: [PATCH 08/53] Rails 5.2 --- Gemfile | 3 +- Gemfile.lock | 206 +++++++++--------- bin/bundle | 2 +- bin/setup | 4 +- bin/update | 6 +- bin/yarn | 6 +- config/boot.rb | 1 + config/cable.yml | 2 +- config/environments/development.rb | 11 +- config/environments/production.rb | 11 +- config/environments/test.rb | 6 +- .../application_controller_renderer.rb | 10 +- .../initializers/content_security_policy.rb | 25 +++ .../new_framework_defaults_5_2.rb | 38 ++++ config/storage.yml | 34 +++ 15 files changed, 242 insertions(+), 123 deletions(-) create mode 100644 config/initializers/content_security_policy.rb create mode 100644 config/initializers/new_framework_defaults_5_2.rb create mode 100644 config/storage.yml diff --git a/Gemfile b/Gemfile index 8d53d5d2..5a308b73 100644 --- a/Gemfile +++ b/Gemfile @@ -18,7 +18,7 @@ gem 'test-unit', '~> 3.0.9' gem 'nokogiri', '~> 1.10.4' gem 'csv_shaper' gem 'andand', github: 'raganwald/andand' -gem 'responders' # Can't move above 1.1 until migrating to rails 4.2+ +gem 'responders' gem 'friendly_id', '~> 5' gem 'active_record-acts_as' gem 'acts_as_list' @@ -32,6 +32,7 @@ gem 'active_record_union' gem 'mysql2', '~> 0.3.20' gem 'modernizr-rails' gem 'rubyzip', '>= 1.3.0' +gem 'bootsnap' # Added during Rails 5.2 upgrade # For JSON support gem 'rabl' diff --git a/Gemfile.lock b/Gemfile.lock index b19531ae..6f984859 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,13 @@ +GIT + remote: git://github.com/activeadmin-plugins/active_admin_import.git + revision: 859d94e2fd00620034bffd803d528c8beefdc7ce + specs: + active_admin_import (4.1.0) + activeadmin (>= 1.0.0.pre2) + activerecord-import (~> 0.27) + rchardet (~> 1.6) + rubyzip (~> 1.2) + GIT remote: git://github.com/raganwald/andand.git revision: d6c4545b6649c70495c26e2038206c5fdb2d14d6 @@ -15,7 +25,7 @@ GIT GIT remote: git://github.com/voormedia/rails-erd.git - revision: 0fbb1cdf2c84b06afd12974baace8d512bb798da + revision: e666706a11b703607542f1b14576204c7987ca67 specs: rails-erd (1.6.0) activerecord (>= 4.2) @@ -26,25 +36,25 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.1.1) - actionpack (= 5.1.1) + actioncable (5.2.2) + actionpack (= 5.2.2) nio4r (~> 2.0) - websocket-driver (~> 0.6.1) - actionmailer (5.1.1) - actionpack (= 5.1.1) - actionview (= 5.1.1) - activejob (= 5.1.1) + websocket-driver (>= 0.6.1) + actionmailer (5.2.2) + actionpack (= 5.2.2) + actionview (= 5.2.2) + activejob (= 5.2.2) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.1) - actionview (= 5.1.1) - activesupport (= 5.1.1) + actionpack (5.2.2) + actionview (= 5.2.2) + activesupport (= 5.2.2) rack (~> 2.0) - rack-test (~> 0.6.3) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.1) - activesupport (= 5.1.1) + actionview (5.2.2) + activesupport (= 5.2.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) @@ -66,40 +76,46 @@ GEM ransack (>= 1.8.7) sass (~> 3.1) sprockets (< 4.1) - activejob (5.1.1) - activesupport (= 5.1.1) + activejob (5.2.2) + activesupport (= 5.2.2) globalid (>= 0.3.6) - activemodel (5.1.1) - activesupport (= 5.1.1) - activerecord (5.1.1) - activemodel (= 5.1.1) - activesupport (= 5.1.1) - arel (~> 8.0) - activerecord-import (0.17.2) + activemodel (5.2.2) + activesupport (= 5.2.2) + activerecord (5.2.2) + activemodel (= 5.2.2) + activesupport (= 5.2.2) + arel (>= 9.0) + activerecord-import (0.28.1) activerecord (>= 3.2) - activesupport (5.1.1) + activestorage (5.2.2) + actionpack (= 5.2.2) + activerecord (= 5.2.2) + marcel (~> 0.3.1) + activesupport (5.2.2) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (~> 0.7) + i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - acts-as-taggable-on (5.0.0) - activerecord (>= 4.2.8) - acts_as_list (0.9.19) + acts-as-taggable-on (6.0.0) + activerecord (~> 5.0) + acts_as_list (0.9.17) activerecord (>= 3.0) addressable (2.6.0) public_suffix (>= 2.0.2, < 4.0) - airbrussh (1.3.2) + airbrussh (1.3.1) sshkit (>= 1.6.1, != 1.7.0) annotate (2.7.5) activerecord (>= 3.2, < 7.0) rake (>= 10.4, < 13.0) arbre (1.2.1) activesupport (>= 3.0.0) - arel (8.0.0) - autoprefixer-rails (9.2.1) + arel (9.0.0) + autoprefixer-rails (9.4.6) execjs awesome_print (1.8.0) - bcrypt (3.1.13) + bcrypt (3.1.12) + bootsnap (1.3.2) + msgpack (~> 1.0) bootstrap-editable-rails (0.0.9) railties (>= 3.1) sass-rails @@ -117,7 +133,7 @@ GEM i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (1.6.0) + capistrano-bundler (1.5.0) capistrano (~> 3.1) capistrano-rails (1.4.0) capistrano (~> 3.1) @@ -125,7 +141,7 @@ GEM capistrano-rvm (0.1.2) capistrano (~> 3.0) sshkit (~> 1.2) - capybara (3.15.1) + capybara (3.12.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -194,16 +210,11 @@ GEM railties (>= 4.2.0) faker (1.9.4) i18n (>= 0.7) - pastel (~> 0.7.2) - thor (~> 0.20.0) - tty-pager (~> 0.12.0) - tty-screen (~> 0.6.5) - tty-tree (~> 0.3.0) faraday (0.15.4) multipart-post (>= 1.2, < 3) - ffi (1.11.1) - font-awesome-rails (4.7.0.5) - railties (>= 3.2, < 6.1) + ffi (1.10.0) + font-awesome-rails (4.7.0.4) + railties (>= 3.2, < 6.0) formtastic (3.1.5) actionpack (>= 3.2.13) formtastic-bootstrap (3.1.1) @@ -234,7 +245,7 @@ GEM ruby_parser (~> 3.5) http-cookie (1.0.3) domain_name (~> 0.5) - i18n (0.9.5) + i18n (1.5.3) concurrent-ruby (~> 1.0) immigrant (0.3.6) activerecord (>= 3.0) @@ -278,28 +289,28 @@ GEM nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) method_source (0.9.2) mime-types (3.2.2) mime-types-data (~> 3.2015) - mime-types-data (3.2019.0331) + mime-types-data (3.2018.0812) + mimemagic (0.3.3) mini_mime (1.0.1) mini_portile2 (2.4.0) minitest (5.14.1) modernizr-rails (2.7.1) momentjs-rails (2.20.1) railties (>= 3.1) - momentjs-rails (2.20.1) + msgpack (1.2.6) multi_json (1.13.1) multi_xml (0.6.0) multipart-post (2.1.1) mysql2 (0.3.21) - net-scp (2.0.0) - net-ssh (>= 2.6.5, < 6.0.0) - net-ssh (5.2.0) + net-scp (1.2.1) + net-ssh (>= 2.6.5) + net-ssh (5.1.0) netrc (0.11.0) - multi_json (~> 1.3) - multi_xml (~> 0.5) - rack (>= 1.2, < 3) nio4r (2.3.1) nokogiri (1.8.1) mini_portile2 (~> 2.3.0) @@ -321,7 +332,7 @@ GEM omniauth (~> 1.2) omniauth-facebook (5.0.0) omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (0.7.0) + omniauth-google-oauth2 (0.6.0) jwt (>= 2.0) omniauth (>= 1.1.1) omniauth-oauth2 (>= 1.5) @@ -329,59 +340,55 @@ GEM oauth2 (~> 1.1) omniauth (~> 1.9) orm_adapter (0.5.0) - pastel (0.7.3) - equatable (~> 0.6) - tty-color (~> 0.5) - polyamorous (1.1.0) - activerecord (>= 3.0) - power_assert (1.1.4) + power_assert (1.1.3) pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) - public_suffix (3.1.1) - puma (4.3.5) - nio4r (~> 2.0) - rabl (0.14.1) + public_suffix (3.0.3) + puma (3.12.0) + rabl (0.14.0) activesupport (>= 2.3.14) rack (2.0.6) - rack-test (0.6.3) - rack (>= 1.0) - rails (5.1.1) - actioncable (= 5.1.1) - actionmailer (= 5.1.1) - actionpack (= 5.1.1) - actionview (= 5.1.1) - activejob (= 5.1.1) - activemodel (= 5.1.1) - activerecord (= 5.1.1) - activesupport (= 5.1.1) - bundler (>= 1.3.0, < 2.0) - railties (= 5.1.1) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.2) + actioncable (= 5.2.2) + actionmailer (= 5.2.2) + actionpack (= 5.2.2) + actionview (= 5.2.2) + activejob (= 5.2.2) + activemodel (= 5.2.2) + activerecord (= 5.2.2) + activestorage (= 5.2.2) + activesupport (= 5.2.2) + bundler (>= 1.3.0) + railties (= 5.2.2) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.0.4) loofah (~> 2.2, >= 2.2.2) - railties (5.1.1) - actionpack (= 5.1.1) - activesupport (= 5.1.1) + railties (5.2.2) + actionpack (= 5.2.2) + activesupport (= 5.2.2) method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (12.3.3) - ransack (1.8.10) - actionpack (>= 3.0, < 5.2) - activerecord (>= 3.0, < 5.2) - activesupport (>= 3.0, < 5.2) + thor (>= 0.19.0, < 2.0) + rake (12.3.2) + ransack (2.1.1) + actionpack (>= 5.0) + activerecord (>= 5.0) + activesupport (>= 5.0) i18n rb-fsevent (0.10.3) rb-inotify (0.10.0) ffi (~> 1.0) + rchardet (1.8.0) rdoc (6.1.1) redcarpet (3.4.0) - regexp_parser (1.5.1) - remotipart (1.4.3) + regexp_parser (1.3.0) + remotipart (1.4.2) representable (2.4.1) declarative (~> 0.0.5) uber (~> 0.0.15) @@ -390,16 +397,15 @@ GEM actionpack (>= 4.2.0, < 6.0) railties (>= 4.2.0, < 6.0) rest-client (2.0.2) - diff-lcs (>= 1.2.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rspec-core (3.8.2) + rspec-core (3.8.0) rspec-support (~> 3.8.0) - rspec-expectations (3.8.4) + rspec-expectations (3.8.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) - rspec-mocks (3.8.1) + rspec-mocks (3.8.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) rspec-rails (3.8.2) @@ -411,12 +417,12 @@ GEM rspec-mocks (~> 3.8.0) rspec-support (~> 3.8.0) rspec-support (3.8.0) - ruby-graphviz (1.2.3) + ruby-graphviz (1.2.4) ruby_dep (1.5.0) - ruby_parser (3.11.0) + ruby_parser (3.12.0) sexp_processor (~> 4.9) - rubyzip (1.3.0) - sass (3.7.4) + rubyzip (1.2.2) + sass (3.7.3) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) @@ -438,11 +444,7 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) - squeel (1.2.3) - activerecord (>= 3.0) - activesupport (>= 3.0) - polyamorous (~> 1.1.0) - sshkit (1.19.1) + sshkit (1.18.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) strings (0.1.5) @@ -481,8 +483,9 @@ GEM unf_ext unf_ext (0.0.7.6) wannabe_bool (0.7.1) - warden (1.2.7) - websocket-driver (0.6.5) + warden (1.2.8) + rack (>= 2.0.6) + websocket-driver (0.7.0) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) xpath (3.2.0) @@ -501,6 +504,7 @@ DEPENDENCIES annotate autoprefixer-rails awesome_print + bootsnap bootstrap-editable-rails bootstrap-sass-backport (~> 3.2.0) bootstrap-wysihtml5-rails diff --git a/bin/bundle b/bin/bundle index 66e9889e..f19acf5b 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,3 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) load Gem.bin_path('bundler', 'bundle') diff --git a/bin/setup b/bin/setup index 78c4e861..94fd4d79 100755 --- a/bin/setup +++ b/bin/setup @@ -1,10 +1,9 @@ #!/usr/bin/env ruby -require 'pathname' require 'fileutils' include FileUtils # path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = File.expand_path('..', __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") @@ -21,7 +20,6 @@ chdir APP_ROOT do # Install JavaScript dependencies if using Yarn # system('bin/yarn') - # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') # cp 'config/database.yml.sample', 'config/database.yml' diff --git a/bin/update b/bin/update index a8e4462f..58bfaed5 100755 --- a/bin/update +++ b/bin/update @@ -1,10 +1,9 @@ #!/usr/bin/env ruby -require 'pathname' require 'fileutils' include FileUtils # path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = File.expand_path('..', __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") @@ -18,6 +17,9 @@ chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + puts "\n== Updating database ==" system! 'bin/rails db:migrate' diff --git a/bin/yarn b/bin/yarn index c2bacef8..460dd565 100755 --- a/bin/yarn +++ b/bin/yarn @@ -1,8 +1,8 @@ #!/usr/bin/env ruby -VENDOR_PATH = File.expand_path('..', __dir__) -Dir.chdir(VENDOR_PATH) do +APP_ROOT = File.expand_path('..', __dir__) +Dir.chdir(APP_ROOT) do begin - exec "yarnpkg #{ARGV.join(" ")}" + exec "yarnpkg", *ARGV rescue Errno::ENOENT $stderr.puts "Yarn executable was not detected in the system." $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" diff --git a/config/boot.rb b/config/boot.rb index 30f5120d..b9e460ce 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,4 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. +require 'bootsnap/setup' # Speed up boot time by caching expensive operations. diff --git a/config/cable.yml b/config/cable.yml index 156e7a0b..546768c1 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -6,5 +6,5 @@ test: production: adapter: redis - url: redis://localhost:6379/1 + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> channel_prefix: code_workout_production diff --git a/config/environments/development.rb b/config/environments/development.rb index 5187e221..1311e3e4 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -13,12 +13,13 @@ config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. - if Rails.root.join('tmp/caching-dev.txt').exist? + # Run rails dev:cache to toggle caching. + if Rails.root.join('tmp', 'caching-dev.txt').exist? config.action_controller.perform_caching = true config.cache_store = :memory_store config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" + 'Cache-Control' => "public, max-age=#{2.days.to_i}" } else config.action_controller.perform_caching = false @@ -26,6 +27,9 @@ config.cache_store = :null_store end + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local + # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false @@ -37,6 +41,9 @@ # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load + # Highlight code that triggered database queries in logs. + config.active_record.verbose_query_logs = true + # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. diff --git a/config/environments/production.rb b/config/environments/production.rb index 0b701344..0da40324 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -14,10 +14,9 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Attempt to read encrypted secrets from `config/secrets.yml.enc`. - # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or - # `config/secrets.yml.key`. - config.read_encrypted_secrets = true + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. @@ -39,6 +38,9 @@ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local + # Mount Action Cable outside main process or domain # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' @@ -60,6 +62,7 @@ # Use a real queuing backend for Active Job (and separate queues per environment) # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "code_workout_#{Rails.env}" + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. diff --git a/config/environments/test.rb b/config/environments/test.rb index 8e5cbde5..0a38fd3c 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -15,7 +15,7 @@ # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}" + 'Cache-Control' => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. @@ -27,6 +27,10 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + + # Store uploaded files on the local file system in a temporary directory + config.active_storage.service = :test + config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb index 51639b67..89d2efab 100644 --- a/config/initializers/application_controller_renderer.rb +++ b/config/initializers/application_controller_renderer.rb @@ -1,6 +1,8 @@ # Be sure to restart your server when you modify this file. -# ApplicationController.renderer.defaults.merge!( -# http_host: 'example.org', -# https: false -# ) +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb new file mode 100644 index 00000000..d3bcaa5e --- /dev/null +++ b/config/initializers/content_security_policy.rb @@ -0,0 +1,25 @@ +# Be sure to restart your server when you modify this file. + +# Define an application-wide content security policy +# For further information see the following documentation +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy + +# Rails.application.config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https + +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end + +# If you are using UJS then enable automatic nonce generation +# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } + +# Report CSP violations to a specified URI +# For further information see the following documentation: +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only +# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/new_framework_defaults_5_2.rb b/config/initializers/new_framework_defaults_5_2.rb new file mode 100644 index 00000000..c383d072 --- /dev/null +++ b/config/initializers/new_framework_defaults_5_2.rb @@ -0,0 +1,38 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.2 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make Active Record use stable #cache_key alongside new #cache_version method. +# This is needed for recyclable cache keys. +# Rails.application.config.active_record.cache_versioning = true + +# Use AES-256-GCM authenticated encryption for encrypted cookies. +# Also, embed cookie expiry in signed or encrypted cookies for increased security. +# +# This option is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 5.2. +# +# Existing cookies will be converted on read then written with the new scheme. +# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true + +# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages +# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true. +# Rails.application.config.active_support.use_authenticated_message_encryption = true + +# Add default protection from forgery to ActionController::Base instead of in +# ApplicationController. +# Rails.application.config.action_controller.default_protect_from_forgery = true + +# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and +# 'f' after migrating old data. +# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true + +# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header. +# Rails.application.config.active_support.use_sha1_digests = true + +# Make `form_with` generate id attributes for any generated HTML tags. +# Rails.application.config.action_view.form_with_generates_ids = true diff --git a/config/storage.yml b/config/storage.yml new file mode 100644 index 00000000..d32f76e8 --- /dev/null +++ b/config/storage.yml @@ -0,0 +1,34 @@ +test: + service: Disk + root: <%= Rails.root.join("tmp/storage") %> + +local: + service: Disk + root: <%= Rails.root.join("storage") %> + +# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) +# amazon: +# service: S3 +# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> +# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> +# region: us-east-1 +# bucket: your_own_bucket + +# Remember not to checkin your GCS keyfile to a repository +# google: +# service: GCS +# project: your_project +# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> +# bucket: your_own_bucket + +# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) +# microsoft: +# service: AzureStorage +# storage_account_name: your_account_name +# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> +# container: your_container_name + +# mirror: +# service: Mirror +# primary: local +# mirrors: [ amazon, google, microsoft ] From 9a5b61879c54f25607d528b77bb6801f0391cf92 Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 22 Jan 2019 15:29:39 -0500 Subject: [PATCH 09/53] Fix deploy syntax --- config/deploy/staging.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index fdf4cd0c..9fdcd097 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -17,7 +17,7 @@ # definition into the server list. The second argument # something that quacks like a hash can be used to set # extended properties on the server. -server 'codeworkoutdev.cs.vt.edu', user: 'codeworkout', roles: %w{web app db}, branch: 'staging', my_property: :my_value +server 'codeworkoutdev.cs.vt.edu', user: 'codeworkout', roles: %w{web app db}, branch: 'rails-5-upgrade', my_property: :my_value # you can set custom ssh options # it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options From e026bb37671b550e603010315061f9af4e85950d Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 22 Jan 2019 15:35:15 -0500 Subject: [PATCH 10/53] Remove obsolete config option; update mysql2 --- Gemfile | 2 +- Gemfile.lock | 8 ++++---- config/initializers/new_framework_defaults.rb | 3 --- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index 5a308b73..5dd67eae 100644 --- a/Gemfile +++ b/Gemfile @@ -29,7 +29,7 @@ gem 'loofah', '>= 2.3.1' gem 'truncate_html' gem 'tzinfo' # For timezone support gem 'active_record_union' -gem 'mysql2', '~> 0.3.20' +gem 'mysql2', '~> 0.4' gem 'modernizr-rails' gem 'rubyzip', '>= 1.3.0' gem 'bootsnap' # Added during Rails 5.2 upgrade diff --git a/Gemfile.lock b/Gemfile.lock index 6f984859..b81abe39 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -305,8 +305,8 @@ GEM msgpack (1.2.6) multi_json (1.13.1) multi_xml (0.6.0) - multipart-post (2.1.1) - mysql2 (0.3.21) + multipart-post (2.0.0) + mysql2 (0.5.2) net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (5.1.0) @@ -545,8 +545,8 @@ DEPENDENCIES loofah (>= 2.3.1) modernizr-rails momentjs-rails (>= 2.9.0) - mysql2 (~> 0.3.20) - nokogiri (~> 1.10.4) + mysql2 (~> 0.4) + nokogiri (= 1.8.1) oj (~> 2.16) oj_mimic_json omniauth diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb index f6e72335..2cb708e7 100644 --- a/config/initializers/new_framework_defaults.rb +++ b/config/initializers/new_framework_defaults.rb @@ -18,6 +18,3 @@ # Require `belongs_to` associations by default. Previous versions had false. Rails.application.config.active_record.belongs_to_required_by_default = false - -# Do not halt callback chains when a callback returns false. Previous versions had true. -ActiveSupport.halt_callback_chains_on_return_false = true From 867339bdc9324f4834419b8bdd846804fb1d04dc Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 9 Jun 2020 15:36:22 -0400 Subject: [PATCH 11/53] Fix schema issues and start Dockerizing --- .ruby-version | 2 +- Dockerfile | 92 +++++++ Gemfile | 3 +- Gemfile.lock | 419 ++++++++++++++--------------- app/assets/config/manifest.js | 3 + code-workout.sublime-project | 8 - config/application.rb | 2 +- config/environments/development.rb | 1 + db/development.db | 0 db/schema.rb | 108 ++++---- docker-run.sh | 33 +++ runservers.sh | 2 +- start.sh | 45 ++++ 13 files changed, 433 insertions(+), 285 deletions(-) create mode 100644 Dockerfile create mode 100644 app/assets/config/manifest.js delete mode 100644 code-workout.sublime-project delete mode 100644 db/development.db create mode 100644 docker-run.sh create mode 100755 start.sh diff --git a/.ruby-version b/.ruby-version index bc4abe86..24ba9a38 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.8 +2.7.0 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..f5f1ae75 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,92 @@ +FROM ruby:2.7.1 +#FROM ruby:2.3.3 + +MAINTAINER Jihane Najdi + +#Default environment +ARG RAILS_ENV='development' +ARG BASEDIR='/code-workout/' + +ENV TZ=America/New_York +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +#install 'development tools' build-essential dkms curl libxslt-dev libpq-dev python-dev python-pip python-feedvalidator python-software-properties python-sphinx libmariadbclient-dev libcurl4-gnutls-dev libevent-dev libffi-dev libssl-dev stunnel4 libsqlite3-dev +# libmariadbclient-dev +RUN apt-get update -qq \ + && apt-get install -y apt-utils build-essential libpq-dev vim cron curl \ + && apt-get install -y nodejs npm python-pip git-core zlib1g-dev libssl-dev libreadline-dev libyaml-dev libevent-dev libsqlite3-dev libsqlite3-dev libxml2-dev libxml2 libxslt1-dev libffi-dev libxslt-dev sqlite3 dkms python-dev python-feedvalidator python-sphinx \ + && pip install --upgrade pip +#// libcurl4-openssl-dev +# #// libcurl4 + +#RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7 \ +# && apt-get install -y apt-transport-https ca-certificates \ +# && sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main > /etc/apt/sources.list.d/passenger.list' \ +# && apt-get update \ +# && apt-get install -y passenger + +# install rubygems +ENV GEM_HOME /usr/local/bundle +ENV PATH $GEM_HOME/bin:$PATH +ENV BUNDLER_VERSION 2.1.4 +ENV RAILS_ENV=$RAILS_ENV + +RUN gem install bundler -v $BUNDLER_VERSION \ + && bundle config --global path "$GEM_HOME" \ + && bundle config --global bin "$GEM_HOME/bin" \ + && bundle config git.allow_insecure true + +# Create a user with the same UID as host user so we have permissions +# RUN useradd -r -u ${UID} appuser +# USER appuser + +VOLUME ${BASEDIR} +WORKDIR ${BASEDIR} + +COPY Gemfile Gemfile +COPY Gemfile.lock Gemfile.lock + +RUN bundle update +RUN bundle check || bundle install + +COPY runservers.sh runservers.sh + +RUN find /code-workout -type d -exec chmod 2775 {} \; +RUN find /code-workout -type f -exec chmod 0644 {} \; +RUN find ./runservers.sh -type f -exec chmod +x {} \; + +EXPOSE 80 +#EXPOSE 3000 + +# Create the log file +# RUN touch /code-workout/log/development.log + +# Redirecting logs to Dockerlog collector accesslogs (/proc/1/fd/1) errorlogs (/proc/self/fd/2) +#RUN ln -sf /proc/1/fd/1 /opendsa-lti/log/development.log + +# Clone OpenDSA +# RUN mkdir /opendsa +# RUN git clone https://github.com/OpenDSA/OpenDSA.git /opendsa +# RUN pip install -r /opendsa/requirements.txt --upgrade +# RUN ln -s /opendsa /opendsa-lti/public/OpenDSA +# RUN ln -s "$(which nodejs)" /usr/local/bin/node +# RUN cp /opendsa-lti/postprocessor.py /opendsa-lti/public/OpenDSA/tools/postprocessor.py + +## JAVA INSTALLATION +RUN apt-get install -y default-jre + +### OpenDSA libraries for Python 2.7 +# RUN pip install --upgrade beautifulsoup4 +# RUN pip install --upgrade html5lib + +#ln -s /opendsa/RST /opendsa-lti/RST +#ln -s /opendsa/config /opendsa-lti/Configuration +#rm /opendsa-ltiConfiguration/config +#rm /opendsa-lti/RST/RST + +##RUN bundle +#RUN echo $PATH + +CMD ["bash", "./runservers.sh"] + +#CMD tail -f /dev/null & wait diff --git a/Gemfile b/Gemfile index 5dd67eae..842b93d7 100644 --- a/Gemfile +++ b/Gemfile @@ -56,13 +56,12 @@ group :development, :test do gem 'faker' gem 'pry' gem 'request-log-analyzer' + gem 'capybara', '~> 3.12.0' end gem 'factory_bot_rails' gem 'log_file' group :test do - gem 'sqlite3' - gem 'capybara' end group :production, :staging, :deploy do diff --git a/Gemfile.lock b/Gemfile.lock index b81abe39..b53b069b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,22 +1,12 @@ GIT - remote: git://github.com/activeadmin-plugins/active_admin_import.git - revision: 859d94e2fd00620034bffd803d528c8beefdc7ce - specs: - active_admin_import (4.1.0) - activeadmin (>= 1.0.0.pre2) - activerecord-import (~> 0.27) - rchardet (~> 1.6) - rubyzip (~> 1.2) - -GIT - remote: git://github.com/raganwald/andand.git + remote: https://github.com/raganwald/andand.git revision: d6c4545b6649c70495c26e2038206c5fdb2d14d6 specs: andand (1.3.3) GIT - remote: git://github.com/seuros/capistrano-puma.git - revision: 6112323390cff15539d947882d72d937622cfdf4 + remote: https://github.com/seuros/capistrano-puma.git + revision: 87bfd747bd43a19b5d214e0272b76fb723cf1f5f specs: capistrano3-puma (4.0.0) capistrano (~> 3.7) @@ -24,8 +14,8 @@ GIT puma (~> 4.0) GIT - remote: git://github.com/voormedia/rails-erd.git - revision: e666706a11b703607542f1b14576204c7987ca67 + remote: https://github.com/voormedia/rails-erd.git + revision: 0fbb1cdf2c84b06afd12974baace8d512bb798da specs: rails-erd (1.6.0) activerecord (>= 4.2) @@ -36,106 +26,103 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.2.2) - actionpack (= 5.2.2) + actioncable (5.2.4.3) + actionpack (= 5.2.4.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.2) - actionpack (= 5.2.2) - actionview (= 5.2.2) - activejob (= 5.2.2) + actionmailer (5.2.4.3) + actionpack (= 5.2.4.3) + actionview (= 5.2.4.3) + activejob (= 5.2.4.3) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.2) - actionview (= 5.2.2) - activesupport (= 5.2.2) - rack (~> 2.0) + actionpack (5.2.4.3) + actionview (= 5.2.4.3) + activesupport (= 5.2.4.3) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.2) - activesupport (= 5.2.2) + actionview (5.2.4.3) + activesupport (= 5.2.4.3) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_record-acts_as (3.0.2) + active_record-acts_as (4.0.1) activerecord (>= 4.2) activesupport (>= 4.2) active_record_union (1.3.0) activerecord (>= 4.0) - activeadmin (1.4.3) - arbre (>= 1.1.1) - coffee-rails + activeadmin (2.7.0) + arbre (~> 1.2, >= 1.2.1) formtastic (~> 3.1) - formtastic_i18n - inherited_resources (>= 1.9.0) - jquery-rails (>= 4.2.0) - kaminari (>= 0.15) - railties (>= 4.2, < 5.3) - ransack (>= 1.8.7) - sass (~> 3.1) - sprockets (< 4.1) - activejob (5.2.2) - activesupport (= 5.2.2) + formtastic_i18n (~> 0.4) + inherited_resources (~> 1.7) + jquery-rails (~> 4.2) + kaminari (~> 1.0, >= 1.0.1) + railties (>= 5.2, < 6.1) + ransack (~> 2.1, >= 2.1.1) + sassc-rails (~> 2.1) + sprockets (>= 3.0, < 4.1) + activejob (5.2.4.3) + activesupport (= 5.2.4.3) globalid (>= 0.3.6) - activemodel (5.2.2) - activesupport (= 5.2.2) - activerecord (5.2.2) - activemodel (= 5.2.2) - activesupport (= 5.2.2) + activemodel (5.2.4.3) + activesupport (= 5.2.4.3) + activerecord (5.2.4.3) + activemodel (= 5.2.4.3) + activesupport (= 5.2.4.3) arel (>= 9.0) - activerecord-import (0.28.1) - activerecord (>= 3.2) - activestorage (5.2.2) - actionpack (= 5.2.2) - activerecord (= 5.2.2) + activestorage (5.2.4.3) + actionpack (= 5.2.4.3) + activerecord (= 5.2.4.3) marcel (~> 0.3.1) - activesupport (5.2.2) + activesupport (5.2.4.3) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - acts-as-taggable-on (6.0.0) - activerecord (~> 5.0) - acts_as_list (0.9.17) - activerecord (>= 3.0) - addressable (2.6.0) - public_suffix (>= 2.0.2, < 4.0) - airbrussh (1.3.1) + acts-as-taggable-on (6.5.0) + activerecord (>= 5.0, < 6.1) + acts_as_list (1.0.1) + activerecord (>= 4.2) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - annotate (2.7.5) + annotate (3.1.1) activerecord (>= 3.2, < 7.0) - rake (>= 10.4, < 13.0) + rake (>= 10.4, < 14.0) arbre (1.2.1) activesupport (>= 3.0.0) arel (9.0.0) - autoprefixer-rails (9.4.6) + autoprefixer-rails (9.7.6) execjs awesome_print (1.8.0) - bcrypt (3.1.12) - bootsnap (1.3.2) + bcrypt (3.1.13) + bootsnap (1.4.6) msgpack (~> 1.0) bootstrap-editable-rails (0.0.9) railties (>= 3.1) sass-rails - bootstrap-sass-backport (3.2.0.2) + bootstrap-sass (3.2.0.4) sass (~> 3.2) bootstrap-wysihtml5-rails (0.3.3.8) railties (>= 3.0) bootstrap3-datetimepicker-rails (4.17.47) momentjs-rails (>= 2.8.1) builder (3.2.4) - byebug (11.0.1) - cancancan (3.0.1) - capistrano (3.11.0) + byebug (11.1.3) + cancancan (3.1.0) + capistrano (3.14.0) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (1.5.0) + capistrano-bundler (1.6.0) capistrano (~> 3.1) - capistrano-rails (1.4.0) + capistrano-rails (1.5.0) capistrano (~> 3.1) capistrano-bundler (~> 1.1) capistrano-rvm (0.1.2) @@ -170,7 +157,7 @@ GEM cocoon (1.2.14) codemirror-rails (5.16.0) railties (>= 3.0, < 6.0) - coderay (1.1.2) + coderay (1.1.3) coffee-rails (4.2.2) coffee-script (>= 2.2.0) railties (>= 4.0.0) @@ -182,7 +169,7 @@ GEM crass (1.0.6) css3-progress-bar-rails (0.5.1) rails (>= 3.1) - csv_shaper (1.3.0) + csv_shaper (1.3.1) activesupport (>= 3.0.0) daemons (1.3.1) declarative (0.0.10) @@ -193,9 +180,9 @@ GEM responders warden (~> 1.2.3) diff-lcs (1.3) - domain_name (0.5.20180417) + domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - erubi (1.8.0) + erubi (1.9.0) erubis (2.7.0) eventmachine (1.2.7) exception_handler (0.8.0.0) @@ -203,67 +190,68 @@ GEM rails (>= 4.2.0) responders execjs (2.7.0) - factory_bot (5.0.2) + factory_bot (5.2.0) activesupport (>= 4.2.0) - factory_bot_rails (5.0.2) - factory_bot (~> 5.0.2) + factory_bot_rails (5.2.0) + factory_bot (~> 5.2.0) railties (>= 4.2.0) - faker (1.9.4) - i18n (>= 0.7) - faraday (0.15.4) + faker (2.12.0) + i18n (>= 1.6, < 2) + faraday (1.0.1) multipart-post (>= 1.2, < 3) - ffi (1.10.0) - font-awesome-rails (4.7.0.4) - railties (>= 3.2, < 6.0) + ffi (1.13.0) + font-awesome-rails (4.7.0.5) + railties (>= 3.2, < 6.1) formtastic (3.1.5) actionpack (>= 3.2.13) formtastic-bootstrap (3.1.1) formtastic (>= 3.0) formtastic_i18n (0.6.0) - friendly_id (5.2.5) + friendly_id (5.3.0) activerecord (>= 4.0.0) globalid (0.4.2) activesupport (>= 4.2.0) gravtastic (3.2.6) - haml (5.1.1) + haml (5.1.2) temple (>= 0.8.0) tilt - haml-rails (1.0.0) - actionpack (>= 4.0.1) - activesupport (>= 4.0.1) + haml-rails (2.0.1) + actionpack (>= 5.1) + activesupport (>= 5.1) haml (>= 4.0.6, < 6.0) html2haml (>= 1.0.1) - railties (>= 4.0.1) + railties (>= 5.1) has_scope (0.7.2) actionpack (>= 4.1) activesupport (>= 4.1) - hashie (3.6.0) + hashie (4.1.0) html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) nokogiri (>= 1.6.0) ruby_parser (~> 3.5) + http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) - i18n (1.5.3) + i18n (1.8.3) concurrent-ruby (~> 1.0) immigrant (0.3.6) activerecord (>= 3.0) ims-lti (1.1.13) builder oauth (>= 0.4.5, < 0.6) - inherited_resources (1.9.0) - actionpack (>= 4.2, < 5.3) + inherited_resources (1.11.0) + actionpack (>= 5.0, < 6.1) has_scope (~> 0.6) - railties (>= 4.2, < 5.3) - responders - jquery-rails (4.3.5) + railties (>= 5.0, < 6.1) + responders (>= 2, < 4) + jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - js-routes (1.4.7) + js-routes (1.4.9) railties (>= 4) sprockets-rails jwt (2.2.1) @@ -279,10 +267,9 @@ GEM activerecord kaminari-core (= 1.2.1) kaminari-core (1.2.1) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) + listen (3.2.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) log_file (0.0.3) loofah (2.5.0) crass (~> 1.0.2) @@ -291,152 +278,160 @@ GEM mini_mime (>= 0.1.1) marcel (0.3.3) mimemagic (~> 0.3.2) - method_source (0.9.2) - mime-types (3.2.2) + method_source (1.0.0) + mime-types (3.3.1) mime-types-data (~> 3.2015) - mime-types-data (3.2018.0812) - mimemagic (0.3.3) - mini_mime (1.0.1) + mime-types-data (3.2020.0512) + mimemagic (0.3.5) + mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.1) modernizr-rails (2.7.1) momentjs-rails (2.20.1) railties (>= 3.1) - msgpack (1.2.6) - multi_json (1.13.1) + msgpack (1.3.3) + multi_json (1.14.1) multi_xml (0.6.0) - multipart-post (2.0.0) - mysql2 (0.5.2) - net-scp (1.2.1) - net-ssh (>= 2.6.5) - net-ssh (5.1.0) + multipart-post (2.1.1) + mysql2 (0.5.3) + net-scp (3.0.0) + net-ssh (>= 2.6.5, < 7.0.0) + net-ssh (6.0.2) netrc (0.11.0) - nio4r (2.3.1) - nokogiri (1.8.1) - mini_portile2 (~> 2.3.0) + nio4r (2.5.2) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) oauth (0.5.4) - oauth2 (1.4.1) - faraday (>= 0.8, < 0.16.0) + oauth2 (1.4.4) + faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) oj (2.18.5) oj_mimic_json (1.0.1) - omniauth (1.9.0) - hashie (>= 3.4.6, < 3.7.0) + omniauth (1.9.1) + hashie (>= 3.4.6) rack (>= 1.6.2, < 3) omniauth-cas (1.1.1) addressable (~> 2.3) nokogiri (~> 1.5) omniauth (~> 1.2) - omniauth-facebook (5.0.0) + omniauth-facebook (6.0.0) omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (0.6.0) + omniauth-google-oauth2 (0.8.0) jwt (>= 2.0) omniauth (>= 1.1.1) - omniauth-oauth2 (>= 1.5) + omniauth-oauth2 (>= 1.6) omniauth-oauth2 (1.6.0) oauth2 (~> 1.1) omniauth (~> 1.9) orm_adapter (0.5.0) - power_assert (1.1.3) - pry (0.12.2) - coderay (~> 1.1.0) - method_source (~> 0.9.0) - public_suffix (3.0.3) - puma (3.12.0) - rabl (0.14.0) + polyamorous (2.3.2) + activerecord (>= 5.2.1) + power_assert (1.2.0) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.5) + puma (4.3.5) + nio4r (~> 2.0) + rabl (0.14.3) activesupport (>= 2.3.14) - rack (2.0.6) + rack (2.2.2) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.2) - actioncable (= 5.2.2) - actionmailer (= 5.2.2) - actionpack (= 5.2.2) - actionview (= 5.2.2) - activejob (= 5.2.2) - activemodel (= 5.2.2) - activerecord (= 5.2.2) - activestorage (= 5.2.2) - activesupport (= 5.2.2) + rails (5.2.4.3) + actioncable (= 5.2.4.3) + actionmailer (= 5.2.4.3) + actionpack (= 5.2.4.3) + actionview (= 5.2.4.3) + activejob (= 5.2.4.3) + activemodel (= 5.2.4.3) + activerecord (= 5.2.4.3) + activestorage (= 5.2.4.3) + activesupport (= 5.2.4.3) bundler (>= 1.3.0) - railties (= 5.2.2) + railties (= 5.2.4.3) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) - railties (5.2.2) - actionpack (= 5.2.2) - activesupport (= 5.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (5.2.4.3) + actionpack (= 5.2.4.3) + activesupport (= 5.2.4.3) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) - rake (12.3.2) - ransack (2.1.1) - actionpack (>= 5.0) - activerecord (>= 5.0) - activesupport (>= 5.0) + rake (13.0.1) + ransack (2.3.2) + activerecord (>= 5.2.1) + activesupport (>= 5.2.1) i18n - rb-fsevent (0.10.3) - rb-inotify (0.10.0) + polyamorous (= 2.3.2) + rb-fsevent (0.10.4) + rb-inotify (0.10.1) ffi (~> 1.0) - rchardet (1.8.0) - rdoc (6.1.1) - redcarpet (3.4.0) - regexp_parser (1.3.0) - remotipart (1.4.2) + rdoc (6.2.1) + redcarpet (3.5.0) + regexp_parser (1.7.1) + remotipart (1.4.4) representable (2.4.1) declarative (~> 0.0.5) uber (~> 0.0.15) request-log-analyzer (1.13.4) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) - rest-client (2.0.2) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rspec-core (3.8.0) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) + rexml (3.2.4) + rspec-core (3.9.2) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.0) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-rails (3.8.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.0) - ruby-graphviz (1.2.4) - ruby_dep (1.5.0) - ruby_parser (3.12.0) + rspec-support (~> 3.9.0) + rspec-rails (4.0.1) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.9) + rspec-expectations (~> 3.9) + rspec-mocks (~> 3.9) + rspec-support (~> 3.9) + rspec-support (3.9.3) + ruby-graphviz (1.2.5) + rexml + ruby_parser (3.14.2) sexp_processor (~> 4.9) - rubyzip (1.2.2) - sass (3.7.3) + rubyzip (2.3.0) + sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - sdoc (1.0.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + sdoc (1.1.0) rdoc (>= 5.0) - sexp_processor (4.12.1) - sprockets (3.7.2) + sexp_processor (4.14.1) + sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) @@ -444,50 +439,37 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) - sshkit (1.18.0) + sshkit (1.21.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - strings (0.1.5) - strings-ansi (~> 0.1) - unicode-display_width (~> 1.5) - unicode_utils (~> 1.4) - strings-ansi (0.1.0) sucker_punch (1.6.0) celluloid (~> 0.17.2) - temple (0.8.1) + temple (0.8.2) test-unit (3.0.9) power_assert thin (1.7.2) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - thor (0.20.3) + thor (1.0.1) thread_safe (0.3.6) - tilt (2.0.9) + tilt (2.0.10) timers (4.3.0) truncate_html (0.9.3) - tty-color (0.5.0) - tty-pager (0.12.1) - strings (~> 0.1.4) - tty-screen (~> 0.6) - tty-which (~> 0.4) - tty-screen (0.6.5) - tty-tree (0.3.0) - tty-which (0.4.1) tzinfo (1.2.7) thread_safe (~> 0.1) uber (0.0.15) - uglifier (4.1.20) + uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.7.6) + unf_ext (0.0.7.7) wannabe_bool (0.7.1) warden (1.2.8) rack (>= 2.0.6) - websocket-driver (0.7.0) + websocket-driver (0.7.2) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) + websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) @@ -506,7 +488,7 @@ DEPENDENCIES awesome_print bootsnap bootstrap-editable-rails - bootstrap-sass-backport (~> 3.2.0) + bootstrap-sass (~> 3.2.0) bootstrap-wysihtml5-rails bootstrap3-datetimepicker-rails (~> 4.17.37) byebug @@ -516,7 +498,7 @@ DEPENDENCIES capistrano-rails capistrano-rvm capistrano3-puma! - capybara + capybara (~> 3.12.0) cocoon codemirror-rails coffee-rails (~> 4.2) @@ -539,14 +521,14 @@ DEPENDENCIES jquery-rails jquery-ui-rails js-routes - kaminari + kaminari (~> 1.2.1) listen log_file loofah (>= 2.3.1) modernizr-rails momentjs-rails (>= 2.9.0) mysql2 (~> 0.4) - nokogiri (= 1.8.1) + nokogiri (~> 1.10.4) oj (~> 2.16) oj_mimic_json omniauth @@ -569,7 +551,6 @@ DEPENDENCIES sass-rails sdoc sqlite3 (~> 1.3.0) - squeel (~> 1.2) sucker_punch (~> 1.0) test-unit (~> 3.0.9) thin @@ -579,4 +560,4 @@ DEPENDENCIES wannabe_bool BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 00000000..b16e53d6 --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,3 @@ +//= link_tree ../images +//= link_directory ../javascripts .js +//= link_directory ../stylesheets .css diff --git a/code-workout.sublime-project b/code-workout.sublime-project deleted file mode 100644 index 24db3031..00000000 --- a/code-workout.sublime-project +++ /dev/null @@ -1,8 +0,0 @@ -{ - "folders": - [ - { - "path": "." - } - ] -} diff --git a/config/application.rb b/config/application.rb index d95398a5..d784fc03 100644 --- a/config/application.rb +++ b/config/application.rb @@ -9,7 +9,7 @@ module CodeWorkout class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 5.1 + config.load_defaults 5.2 Rails.application.config.active_record.belongs_to_required_by_default = false # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers diff --git a/config/environments/development.rb b/config/environments/development.rb index 1311e3e4..2cd5bb4d 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,5 +1,6 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. + Rails.env = 'development' # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development diff --git a/db/development.db b/db/development.db deleted file mode 100644 index e69de29b..00000000 diff --git a/db/schema.rb b/db/schema.rb index 46174b2e..fcd92fe9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -12,7 +12,7 @@ ActiveRecord::Schema.define(version: 20190712171251) do - create_table "active_admin_comments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "active_admin_comments", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "namespace" t.text "body", limit: 65535 t.string "resource_id", default: "", null: false @@ -26,7 +26,7 @@ t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id", using: :btree end - create_table "attempts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "attempts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "user_id", null: false t.integer "exercise_version_id", null: false t.datetime "submit_time", null: false @@ -54,7 +54,7 @@ t.index ["tag_user_score_id"], name: "attempts_tag_user_scores_tag_user_score_id_fk", using: :btree end - create_table "choices", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "choices", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "multiple_choice_prompt_id", null: false t.integer "position", null: false t.text "feedback", limit: 65535 @@ -72,12 +72,12 @@ t.index ["multiple_choice_prompt_answer_id"], name: "choices_MC_prompt_answers_MC_prompt_answer_id_fk", using: :btree end - create_table "coding_prompt_answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "coding_prompt_answers", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.text "answer", limit: 65535 t.text "error", limit: 65535 end - create_table "coding_prompts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "coding_prompts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.datetime "created_at" t.datetime "updated_at" t.string "class_name" @@ -88,7 +88,7 @@ t.boolean "hide_examples", default: false, null: false end - create_table "course_enrollments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "course_enrollments", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "user_id", null: false t.integer "course_offering_id", null: false t.integer "course_role_id", null: false @@ -98,7 +98,7 @@ t.index ["user_id"], name: "index_course_enrollments_on_user_id", using: :btree end - create_table "course_exercises", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "course_exercises", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "course_id", null: false t.integer "exercise_id", null: false t.datetime "created_at" @@ -107,7 +107,7 @@ t.index ["exercise_id"], name: "course_exercises_exercise_id_fk", using: :btree end - create_table "course_offerings", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "course_offerings", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "course_id", null: false t.integer "term_id", null: false t.string "label", default: "", null: false @@ -122,7 +122,7 @@ t.index ["term_id"], name: "index_course_offerings_on_term_id", using: :btree end - create_table "course_roles", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "course_roles", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name", default: "", null: false t.boolean "can_manage_course", default: false, null: false t.boolean "can_manage_assignments", default: false, null: false @@ -131,7 +131,7 @@ t.boolean "builtin", default: false, null: false end - create_table "courses", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "courses", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name", default: "", null: false t.string "number", default: "", null: false t.integer "organization_id", null: false @@ -146,7 +146,7 @@ t.index ["user_group_id"], name: "index_courses_on_user_group_id", using: :btree end - create_table "errors", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "errors", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "usable_type" t.integer "usable_id" t.string "class_name" @@ -162,7 +162,7 @@ t.index ["created_at"], name: "index_errors_on_created_at", using: :btree end - create_table "exercise_collections", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "exercise_collections", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name" t.text "description", limit: 65535 t.integer "user_group_id" @@ -177,20 +177,20 @@ t.index ["user_id"], name: "index_exercise_collections_on_user_id", using: :btree end - create_table "exercise_families", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "exercise_families", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" end - create_table "exercise_owners", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "exercise_owners", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "exercise_id", null: false t.integer "owner_id", null: false t.index ["exercise_id", "owner_id"], name: "index_exercise_owners_on_exercise_id_and_owner_id", unique: true, using: :btree t.index ["owner_id"], name: "exercise_owners_owner_id_fk", using: :btree end - create_table "exercise_versions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "exercise_versions", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "stem_id" t.datetime "created_at" t.datetime "updated_at" @@ -212,7 +212,7 @@ t.index ["resource_file_id"], name: "index_exercise_versions_resource_files_on_resource_file_id", using: :btree end - create_table "exercise_workouts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "exercise_workouts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "exercise_id", null: false t.integer "workout_id", null: false t.integer "position", null: false @@ -223,7 +223,7 @@ t.index ["workout_id"], name: "exercise_workouts_workout_id_fk", using: :btree end - create_table "exercises", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "exercises", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "question_type", null: false t.integer "current_version_id" t.datetime "created_at" @@ -244,7 +244,7 @@ t.index ["is_public"], name: "index_exercises_on_is_public", using: :btree end - create_table "friendly_id_slugs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "friendly_id_slugs", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "slug", default: "", null: false t.integer "sluggable_id", null: false t.string "sluggable_type", limit: 50 @@ -256,14 +256,14 @@ t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree end - create_table "global_roles", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "global_roles", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name", default: "", null: false t.boolean "can_manage_all_courses", default: false, null: false t.boolean "can_edit_system_configuration", default: false, null: false t.boolean "builtin", default: false, null: false end - create_table "group_access_requests", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "group_access_requests", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "user_id" t.integer "user_group_id" t.boolean "pending", default: true @@ -274,7 +274,7 @@ t.index ["user_id"], name: "index_group_access_requests_on_user_id", using: :btree end - create_table "identities", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "identities", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "user_id", null: false t.string "provider", default: "", null: false t.string "uid", default: "", null: false @@ -284,14 +284,14 @@ t.index ["user_id"], name: "index_identities_on_user_id", using: :btree end - create_table "irt_data", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "irt_data", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "attempt_count", null: false t.float "sum_of_scores", limit: 24, null: false t.float "difficulty", limit: 24, null: false t.float "discrimination", limit: 24, null: false end - create_table "license_policies", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "license_policies", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name" t.text "description", limit: 65535 t.boolean "can_fork" @@ -300,7 +300,7 @@ t.datetime "updated_at" end - create_table "licenses", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "licenses", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name" t.text "description", limit: 65535 t.string "url" @@ -310,7 +310,7 @@ t.index ["license_policy_id"], name: "index_licenses_on_license_policy_id", using: :btree end - create_table "lms_instances", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "lms_instances", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "consumer_key" t.string "consumer_secret" t.datetime "created_at" @@ -323,14 +323,14 @@ t.index ["url"], name: "index_lms_instances_on_url", unique: true, using: :btree end - create_table "lms_types", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "lms_types", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" t.index ["name"], name: "index_lms_types_on_name", unique: true, using: :btree end - create_table "lti_identities", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "lti_identities", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "lti_user_id" t.integer "user_id" t.integer "lms_instance_id" @@ -340,7 +340,7 @@ t.index ["user_id"], name: "index_lti_identities_on_user_id", using: :btree end - create_table "lti_workouts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "lti_workouts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "workout_id", limit: 4 t.string "lms_assignment_id", limit: 255, null: false t.datetime "created_at" @@ -350,22 +350,22 @@ t.index ["workout_id"], name: "index_lti_workouts_on_workout_id", using: :btree end - create_table "memberships", force: :cascade do |t| + create_table "memberships", id: :integer, force: :cascade do |t| t.integer "user_id", limit: 4 t.integer "user_group_id", limit: 4 t.datetime "created_at" t.datetime "updated_at" end - create_table "multiple_choice_prompt_answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "multiple_choice_prompt_answers", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| end - create_table "multiple_choice_prompts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "multiple_choice_prompts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.boolean "allow_multiple", default: false, null: false t.boolean "is_scrambled", default: true, null: false end - create_table "organizations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "organizations", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" @@ -375,7 +375,7 @@ t.index ["slug"], name: "index_organizations_on_slug", unique: true, using: :btree end - create_table "prompt_answers", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "prompt_answers", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "attempt_id" t.integer "prompt_id" t.integer "actable_id" @@ -386,7 +386,7 @@ t.index ["prompt_id"], name: "index_prompt_answers_on_prompt_id", using: :btree end - create_table "prompts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "prompts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "exercise_version_id", null: false t.text "question", limit: 65535, null: false t.integer "position", null: false @@ -401,7 +401,7 @@ t.index ["irt_data_id"], name: "prompts_irt_data_id_fk", using: :btree end - create_table "resource_files", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "resource_files", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "filename" t.string "token", default: "", null: false t.integer "user_id", null: false @@ -412,7 +412,7 @@ t.index ["user_id"], name: "index_resource_files_on_user_id", using: :btree end - create_table "signups", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "signups", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "first_name" t.string "last_name_name" t.string "email" @@ -422,13 +422,13 @@ t.datetime "updated_at" end - create_table "stems", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "stems", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.text "preamble", limit: 65535 t.datetime "created_at" t.datetime "updated_at" end - create_table "student_extensions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "student_extensions", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "user_id" t.integer "workout_offering_id" t.datetime "soft_deadline" @@ -441,7 +441,7 @@ t.index ["workout_offering_id"], name: "index_student_extensions_on_workout_offering_id", using: :btree end - create_table "tag_user_scores", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "tag_user_scores", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "user_id", null: false t.integer "experience", default: 0 t.datetime "created_at" @@ -450,7 +450,7 @@ t.index ["user_id"], name: "index_tag_user_scores_on_user_id", using: :btree end - create_table "taggings", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "taggings", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "tag_id" t.integer "taggable_id" t.string "taggable_type" @@ -462,13 +462,13 @@ t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree end - create_table "tags", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "tags", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name" t.integer "taggings_count", default: 0 t.index ["name"], name: "index_tags_on_name", unique: true, using: :btree end - create_table "terms", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "terms", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "season", null: false t.date "starts_on", null: false t.date "ends_on", null: false @@ -480,7 +480,7 @@ t.index ["year", "season"], name: "index_terms_on_year_and_season", using: :btree end - create_table "test_case_results", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "test_case_results", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "test_case_id", null: false t.integer "user_id", null: false t.text "execution_feedback", limit: 65535 @@ -493,7 +493,7 @@ t.index ["user_id"], name: "index_test_case_results_on_user_id", using: :btree end - create_table "test_cases", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "test_cases", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.text "negative_feedback", limit: 65535 t.float "weight", limit: 24, null: false t.text "description", limit: 65535 @@ -509,7 +509,7 @@ t.index ["coding_prompt_id"], name: "index_test_cases_on_coding_prompt_id", using: :btree end - create_table "time_zones", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "time_zones", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name" t.string "zone" t.string "display_as" @@ -517,14 +517,14 @@ t.datetime "updated_at" end - create_table "user_groups", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "user_groups", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name" t.datetime "created_at" t.datetime "updated_at" t.text "description", limit: 65535 end - create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "users", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" @@ -556,7 +556,7 @@ t.index ["time_zone_id"], name: "index_users_on_time_zone_id", using: :btree end - create_table "visualization_loggings", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| + create_table "visualization_loggings", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| t.integer "user_id" t.integer "exercise_id" t.integer "workout_id" @@ -569,7 +569,7 @@ t.index ["workout_offering_id"], name: "index_visualization_loggings_on_workout_offering_id", using: :btree end - create_table "workout_offerings", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "workout_offerings", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "course_offering_id", null: false t.integer "workout_id", null: false t.datetime "created_at" @@ -591,14 +591,14 @@ t.index ["workout_policy_id"], name: "index_workout_offerings_on_workout_policy_id", using: :btree end - create_table "workout_owners", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "workout_owners", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "workout_id", null: false t.integer "owner_id", null: false t.index ["owner_id"], name: "workout_owners_owner_id_fk", using: :btree t.index ["workout_id", "owner_id"], name: "index_workout_owners_on_workout_id_and_owner_id", unique: true, using: :btree end - create_table "workout_policies", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "workout_policies", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.boolean "hide_thumbnails_before_start" t.boolean "hide_feedback_before_finish" t.boolean "hide_compilation_feedback_before_finish" @@ -614,7 +614,7 @@ t.string "description", limit: 255 end - create_table "workout_scores", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "workout_scores", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.integer "workout_id", null: false t.integer "user_id", null: false t.float "score", limit: 24 @@ -628,12 +628,14 @@ t.integer "workout_offering_id" t.string "lis_outcome_service_url" t.string "lis_result_sourcedid" + t.integer "lti_workout_id", limit: 4 + t.index ["lti_workout_id"], name: "index_workout_scores_on_lti_workout_id", using: :btree t.index ["user_id"], name: "index_workout_scores_on_user_id", using: :btree t.index ["workout_id"], name: "index_workout_scores_on_workout_id", using: :btree t.index ["workout_offering_id"], name: "workout_scores_workout_offering_id_fk", using: :btree end - create_table "workouts", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "workouts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| t.string "name", default: "", null: false t.boolean "scrambled", default: false t.datetime "created_at" diff --git a/docker-run.sh b/docker-run.sh new file mode 100644 index 00000000..1311af5e --- /dev/null +++ b/docker-run.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +container_name=code-workout + +echo "Stop Container: $container_name" +docker container stop $container_name + +echo "Remove Container: $container_name" +docker container rm $container_name + +echo "Build Container: $container_name" + +docker build \ + -t $container_name . \ + --build-arg RAILS_ENV='development' \ + --build-arg UID=$(echo $UID) + +echo "Start Container: $container_name" +docker run \ + -v $PWD:/code-workout \ + --name $container_name \ + -p 9292:9292 $container_name:latest + +#docker container ps +#docker exec -it $container_name /bin/bash + + + +#docker build -t opendsa-lti . --build-arg RAILS_ENV='development' +#docker run -p 3000:3000 -it opendsa-lti /bin/bash +# +#bundle exec thin start --ssl --ssl-key-file server.key --ssl-cert-file server.crt -p 3000 +#bundle exec thin start -p 3000 diff --git a/runservers.sh b/runservers.sh index 9c772d3f..ad5ebf1b 100755 --- a/runservers.sh +++ b/runservers.sh @@ -1 +1 @@ -bundle exec thin start --ssl --ssl-key-file server.key --ssl-cert-file server.crt -p 9292 --debug +RUBYOPT='-W:no-deprecated' RAILS_ENV=development bundle exec thin start --ssl --ssl-key-file server.key --ssl-cert-file server.crt -p 9292 --debug diff --git a/start.sh b/start.sh new file mode 100755 index 00000000..9d398199 --- /dev/null +++ b/start.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +#LOCALHOST +APP_DIR="/code-workout/" +# EFS_DIR="/var/tmp/credentials" +#EFS_DIR="${APP_DIR}" + +PORT="80" +#PORT="3000" + +ENVIRONMENT=$RAILS_ENV + +ERROR_FOUND=false; + +# echo "Copying files from NFS conf directory" +# cp "${EFS_DIR}/database.yml" "${APP_DIR}/config/database.yml" || ERROR_FOUND=true +#chmod +x "${APP_DIR}/email_notification.sh" + + +#echo "rm -rf /opendsa/Books/" +#rm -rf /opendsa/Books/ +#cd /opendsa +#find -type l -delete + +# echo "ln -s /var/tmp/credentials/opendsa/Books /opendsa" +# ln -s /var/tmp/credentials/opendsa/Books /opendsa + +#echo "Script finished." + +if [[ "${ERROR_FOUND}" == true ]]; then exit 1; fi; + +echo "Start cron process in foreground." + +cd "${APP_DIR}" + +echo "RAILS_ENV=$RAILS_ENV bundle exec thin start -p ${PORT}" + +#lsof -t -i tcp:${PORT} | xargs kill -9 + +#echo "RAILS_ENV=$RAILS_ENV rails s -b 0.0.0.0 -p ${PORT}" +#RAILS_ENV=${ENVIRONMENT} rails s -b 0.0.0.0 -p ${PORT} >> /var/log/opendsa-lti.log 2>&1 + +# Start process ithe background - Executes delayed_jobs +nohup bash -c "rake jobs:work >> /code-workout/log/development.log 2>&1" +RAILS_ENV=${ENVIRONMENT} bundle exec thin start -p ${PORT} >> /var/log/code-workout.log 2>&1 From 0ad6022bc7fc95206fa93950f013bb8a0388af79 Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 9 Jun 2020 15:59:09 -0400 Subject: [PATCH 12/53] Regress sprockets to < 4 for the time being --- Gemfile | 1 + Gemfile.lock | 3 ++- app/assets/config/manifest.js | 3 --- 3 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 app/assets/config/manifest.js diff --git a/Gemfile b/Gemfile index 842b93d7..5360d438 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,7 @@ source 'https://rubygems.org' gem 'rails', '~> 5.1' +gem 'sprockets', '~> 3.7.2' # 4.0 requires ruby 2.5 gem 'bootstrap-sass', '~> 3.2.0' gem 'jquery-rails' gem 'jquery-ui-rails' diff --git a/Gemfile.lock b/Gemfile.lock index b53b069b..5ed774d7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -431,7 +431,7 @@ GEM sdoc (1.1.0) rdoc (>= 5.0) sexp_processor (4.14.1) - sprockets (4.0.2) + sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.1) @@ -550,6 +550,7 @@ DEPENDENCIES rubyzip (>= 1.3.0) sass-rails sdoc + sprockets (~> 3.7.2) sqlite3 (~> 1.3.0) sucker_punch (~> 1.0) test-unit (~> 3.0.9) diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js deleted file mode 100644 index b16e53d6..00000000 --- a/app/assets/config/manifest.js +++ /dev/null @@ -1,3 +0,0 @@ -//= link_tree ../images -//= link_directory ../javascripts .js -//= link_directory ../stylesheets .css From eb0e28a7f76cac484774a0dfbdd67a0d650136ac Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 9 Jun 2020 23:47:52 -0400 Subject: [PATCH 13/53] Docker-compose for databases --- .dockerignore | 8 ++++++ Dockerfile | 46 ++---------------------------- config/database.yml | 4 +-- config/environments/development.rb | 1 - docker-compose.yml | 37 ++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 46 deletions(-) create mode 100644 .dockerignore create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..8b248e71 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.bundle +.circleci +.git +vendor/bundle +log/* +!/log/.keep +tmp/* +!/tmp/.keep diff --git a/Dockerfile b/Dockerfile index f5f1ae75..8b59deb9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ FROM ruby:2.7.1 -#FROM ruby:2.3.3 MAINTAINER Jihane Najdi -#Default environment +# Default environment ARG RAILS_ENV='development' +# Ruby changed the way optional params are done, but Rails hasn't caught up +ARG RUBYOPT='-W:no-deprecated' ARG BASEDIR='/code-workout/' ENV TZ=America/New_York @@ -16,14 +17,6 @@ RUN apt-get update -qq \ && apt-get install -y apt-utils build-essential libpq-dev vim cron curl \ && apt-get install -y nodejs npm python-pip git-core zlib1g-dev libssl-dev libreadline-dev libyaml-dev libevent-dev libsqlite3-dev libsqlite3-dev libxml2-dev libxml2 libxslt1-dev libffi-dev libxslt-dev sqlite3 dkms python-dev python-feedvalidator python-sphinx \ && pip install --upgrade pip -#// libcurl4-openssl-dev -# #// libcurl4 - -#RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7 \ -# && apt-get install -y apt-transport-https ca-certificates \ -# && sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main > /etc/apt/sources.list.d/passenger.list' \ -# && apt-get update \ -# && apt-get install -y passenger # install rubygems ENV GEM_HOME /usr/local/bundle @@ -36,10 +29,6 @@ RUN gem install bundler -v $BUNDLER_VERSION \ && bundle config --global bin "$GEM_HOME/bin" \ && bundle config git.allow_insecure true -# Create a user with the same UID as host user so we have permissions -# RUN useradd -r -u ${UID} appuser -# USER appuser - VOLUME ${BASEDIR} WORKDIR ${BASEDIR} @@ -56,37 +45,8 @@ RUN find /code-workout -type f -exec chmod 0644 {} \; RUN find ./runservers.sh -type f -exec chmod +x {} \; EXPOSE 80 -#EXPOSE 3000 - -# Create the log file -# RUN touch /code-workout/log/development.log - -# Redirecting logs to Dockerlog collector accesslogs (/proc/1/fd/1) errorlogs (/proc/self/fd/2) -#RUN ln -sf /proc/1/fd/1 /opendsa-lti/log/development.log - -# Clone OpenDSA -# RUN mkdir /opendsa -# RUN git clone https://github.com/OpenDSA/OpenDSA.git /opendsa -# RUN pip install -r /opendsa/requirements.txt --upgrade -# RUN ln -s /opendsa /opendsa-lti/public/OpenDSA -# RUN ln -s "$(which nodejs)" /usr/local/bin/node -# RUN cp /opendsa-lti/postprocessor.py /opendsa-lti/public/OpenDSA/tools/postprocessor.py ## JAVA INSTALLATION RUN apt-get install -y default-jre -### OpenDSA libraries for Python 2.7 -# RUN pip install --upgrade beautifulsoup4 -# RUN pip install --upgrade html5lib - -#ln -s /opendsa/RST /opendsa-lti/RST -#ln -s /opendsa/config /opendsa-lti/Configuration -#rm /opendsa-ltiConfiguration/config -#rm /opendsa-lti/RST/RST - -##RUN bundle -#RUN echo $PATH - CMD ["bash", "./runservers.sh"] - -#CMD tail -f /dev/null & wait diff --git a/config/database.yml b/config/database.yml index fe4a5b6b..b6ff2606 100644 --- a/config/database.yml +++ b/config/database.yml @@ -8,7 +8,7 @@ development: database: codeworkout username: codeworkout password: codeworkout - host: localhost + host: db_dev # development: # adapter: sqlite3 @@ -32,4 +32,4 @@ test: database: codeworkout_test username: codeworkout password: codeworkout - host: localhost + host: db_test diff --git a/config/environments/development.rb b/config/environments/development.rb index 2cd5bb4d..1311e3e4 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,6 +1,5 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - Rails.env = 'development' # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..ed42f107 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,37 @@ +version: '3.8' +services: + db_dev: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_USER: codeworkout + MYSQL_PASSWORD: codeworkout + MYSQL_DATABASE: codeworkout + ports: + - "3307:3306" + db_test: + image: mysql:5.7 + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_USER: codeworkout + MYSQL_PASSWORD: codeworkout + MYSQL_DATABASE: codeworkout_test + ports: + - "3308:3306" + web: + depends_on: + - "db_dev" + - "db_test" + build: . + ports: + - "9292:9292" + environment: + RUBYOPT: -W:no-deprecated + DB_USERNAME: codeworkout + DB_PASSWORD: codeworkout + DB_DATABASE: codeworkout + DB_PORT: 3306 + DB_HOST: db + RAILS_ENV: development + volumes: + - ".:/code-workout" From 5ea1de6f3f55e19e0b71a6bd560529abca3bd89d Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Thu, 2 Jul 2020 15:53:11 -0400 Subject: [PATCH 14/53] Dockerfile and Compose file improvements --- Dockerfile | 29 +++++++++++++++++++++++++++-- docker-compose.yml | 6 +++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8b59deb9..4c179147 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,8 +14,33 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone #install 'development tools' build-essential dkms curl libxslt-dev libpq-dev python-dev python-pip python-feedvalidator python-software-properties python-sphinx libmariadbclient-dev libcurl4-gnutls-dev libevent-dev libffi-dev libssl-dev stunnel4 libsqlite3-dev # libmariadbclient-dev RUN apt-get update -qq \ - && apt-get install -y apt-utils build-essential libpq-dev vim cron curl \ - && apt-get install -y nodejs npm python-pip git-core zlib1g-dev libssl-dev libreadline-dev libyaml-dev libevent-dev libsqlite3-dev libsqlite3-dev libxml2-dev libxml2 libxslt1-dev libffi-dev libxslt-dev sqlite3 dkms python-dev python-feedvalidator python-sphinx \ + && apt-get install -y \ + apt-utils \ + build-essential \ + libpq-dev \ + vim \ + cron \ + curl \ + nodejs \ + python-pip \ + git-core \ + zlib1g-dev \ + libssl-dev \ + libreadline-dev \ + libyaml-dev \ + libevent-dev \ + libsqlite3-dev \ + libsqlite3-dev \ + libxml2-dev \ + libxml2 \ + libxslt1-dev \ + libffi-dev \ + libxslt-dev \ + sqlite3 \ + dkms \ + python-dev \ + python-feedvalidator \ + python-sphinx \ && pip install --upgrade pip # install rubygems diff --git a/docker-compose.yml b/docker-compose.yml index ed42f107..18abd987 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,8 @@ services: MYSQL_DATABASE: codeworkout ports: - "3307:3306" + volumes: + - dbdata:/var/lib/mysql:delegated db_test: image: mysql:5.7 environment: @@ -34,4 +36,6 @@ services: DB_HOST: db RAILS_ENV: development volumes: - - ".:/code-workout" + - .:/code-workout +volumes: + dbdata: From 947b93a40936df45d9a851172f1cf3cf80833ff6 Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Thu, 2 Jul 2020 17:08:57 -0400 Subject: [PATCH 15/53] exception_handler config updates --- config/application.rb | 5 + db/migrate/20150331153411_create_errors.rb | 18 - db/schema.rb | 837 ++++++++++----------- 3 files changed, 422 insertions(+), 438 deletions(-) delete mode 100644 db/migrate/20150331153411_create_errors.rb diff --git a/config/application.rb b/config/application.rb index d784fc03..2ff74cf1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -14,6 +14,11 @@ class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. + + # exception_handler configuration (no longer relies on an initializer) + config.exception_handler = { + db: true + } # Timeout for feedback polls (milliseconds) # This is an initial value on application startup, but it might change diff --git a/db/migrate/20150331153411_create_errors.rb b/db/migrate/20150331153411_create_errors.rb deleted file mode 100644 index 02d6fb77..00000000 --- a/db/migrate/20150331153411_create_errors.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateErrors < ActiveRecord::Migration - def change - create_table :errors do |t| - t.string :usable_type - t.integer :usable_id - t.text :class_name - t.text :message - t.text :trace - t.text :target_url - t.text :referer_url - t.text :params - t.text :user_agent - t.timestamps - end - add_index :errors, :class_name - add_index :errors, :created_at - end -end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index fcd92fe9..8e4f824a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,644 +10,641 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20190712171251) do +ActiveRecord::Schema.define(version: 2019_07_12_171251) do - create_table "active_admin_comments", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "namespace" - t.text "body", limit: 65535 - t.string "resource_id", default: "", null: false - t.string "resource_type", default: "", null: false - t.integer "author_id" - t.string "author_type" + create_table "active_admin_comments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "namespace" + t.text "body" + t.string "resource_id", default: "", null: false + t.string "resource_type", default: "", null: false + t.integer "author_id" + t.string "author_type" t.datetime "created_at" t.datetime "updated_at" - t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id", using: :btree - t.index ["namespace"], name: "index_active_admin_comments_on_namespace", using: :btree - t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id", using: :btree + t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id" + t.index ["namespace"], name: "index_active_admin_comments_on_namespace" + t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id" end - create_table "attempts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "user_id", null: false - t.integer "exercise_version_id", null: false - t.datetime "submit_time", null: false - t.integer "submit_num", null: false - t.float "score", limit: 24, default: 0.0 - t.integer "experience_earned" + create_table "attempts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "user_id", null: false + t.integer "exercise_version_id", null: false + t.datetime "submit_time", null: false + t.integer "submit_num", null: false + t.float "score", default: 0.0 + t.integer "experience_earned" t.datetime "created_at" t.datetime "updated_at" - t.integer "workout_score_id", limit: 4 - t.integer "active_score_id", limit: 4 - t.boolean "feedback_ready" - t.decimal "time_taken", precision: 10 - t.decimal "feedback_timeout", precision: 10 - t.decimal "worker_time", precision: 10 - t.index ["active_score_id"], name: "index_attempts_on_active_score_id", using: :btree - t.index ["exercise_version_id"], name: "index_attempts_on_exercise_version_id", using: :btree - t.index ["user_id"], name: "index_attempts_on_user_id", using: :btree - t.index ["workout_score_id"], name: "index_attempts_on_workout_score_id", using: :btree + t.integer "workout_score_id" + t.integer "active_score_id" + t.boolean "feedback_ready" + t.decimal "time_taken", precision: 10 + t.decimal "feedback_timeout", precision: 10 + t.decimal "worker_time", precision: 10 + t.index ["active_score_id"], name: "index_attempts_on_active_score_id" + t.index ["exercise_version_id"], name: "index_attempts_on_exercise_version_id" + t.index ["user_id"], name: "index_attempts_on_user_id" + t.index ["workout_score_id"], name: "index_attempts_on_workout_score_id" end - create_table "attempts_tag_user_scores", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "attempts_tag_user_scores", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.integer "attempt_id" t.integer "tag_user_score_id" - t.index ["attempt_id", "tag_user_score_id"], name: "attempts_tag_user_scores_idx", unique: true, using: :btree - t.index ["tag_user_score_id"], name: "attempts_tag_user_scores_tag_user_score_id_fk", using: :btree + t.index ["attempt_id", "tag_user_score_id"], name: "attempts_tag_user_scores_idx", unique: true + t.index ["tag_user_score_id"], name: "attempts_tag_user_scores_tag_user_score_id_fk" end - create_table "choices", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "multiple_choice_prompt_id", null: false - t.integer "position", null: false - t.text "feedback", limit: 65535 - t.float "value", limit: 24, null: false + create_table "choices", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "multiple_choice_prompt_id", null: false + t.integer "position", null: false + t.text "feedback" + t.float "value", null: false t.datetime "created_at" t.datetime "updated_at" - t.text "answer", limit: 65535, null: false - t.index ["multiple_choice_prompt_id"], name: "index_choices_on_multiple_choice_prompt_id", using: :btree + t.text "answer", null: false + t.index ["multiple_choice_prompt_id"], name: "index_choices_on_multiple_choice_prompt_id" end - create_table "choices_multiple_choice_prompt_answers", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "choices_multiple_choice_prompt_answers", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.integer "choice_id" t.integer "multiple_choice_prompt_answer_id" - t.index ["choice_id", "multiple_choice_prompt_answer_id"], name: "choices_multiple_choice_prompt_answers_idx", unique: true, using: :btree - t.index ["multiple_choice_prompt_answer_id"], name: "choices_MC_prompt_answers_MC_prompt_answer_id_fk", using: :btree + t.index ["choice_id", "multiple_choice_prompt_answer_id"], name: "choices_multiple_choice_prompt_answers_idx", unique: true + t.index ["multiple_choice_prompt_answer_id"], name: "choices_MC_prompt_answers_MC_prompt_answer_id_fk" end - create_table "coding_prompt_answers", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.text "answer", limit: 65535 - t.text "error", limit: 65535 + create_table "coding_prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.text "answer" + t.text "error" end - create_table "coding_prompts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "coding_prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.datetime "created_at" t.datetime "updated_at" - t.string "class_name" - t.text "wrapper_code", limit: 65535, null: false - t.text "test_script", limit: 65535, null: false - t.string "method_name" - t.text "starter_code", limit: 65535 - t.boolean "hide_examples", default: false, null: false + t.string "class_name" + t.text "wrapper_code", null: false + t.text "test_script", null: false + t.string "method_name" + t.text "starter_code" + t.boolean "hide_examples", default: false, null: false end - create_table "course_enrollments", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "user_id", null: false + create_table "course_enrollments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "user_id", null: false t.integer "course_offering_id", null: false - t.integer "course_role_id", null: false - t.index ["course_offering_id"], name: "index_course_enrollments_on_course_offering_id", using: :btree - t.index ["course_role_id"], name: "index_course_enrollments_on_course_role_id", using: :btree - t.index ["user_id", "course_offering_id"], name: "index_course_enrollments_on_user_id_and_course_offering_id", unique: true, using: :btree - t.index ["user_id"], name: "index_course_enrollments_on_user_id", using: :btree + t.integer "course_role_id", null: false + t.index ["course_offering_id"], name: "index_course_enrollments_on_course_offering_id" + t.index ["course_role_id"], name: "index_course_enrollments_on_course_role_id" + t.index ["user_id", "course_offering_id"], name: "index_course_enrollments_on_user_id_and_course_offering_id", unique: true + t.index ["user_id"], name: "index_course_enrollments_on_user_id" end - create_table "course_exercises", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "course_id", null: false - t.integer "exercise_id", null: false + create_table "course_exercises", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "course_id", null: false + t.integer "exercise_id", null: false t.datetime "created_at" t.datetime "updated_at" - t.index ["course_id"], name: "course_exercises_course_id_fk", using: :btree - t.index ["exercise_id"], name: "course_exercises_exercise_id_fk", using: :btree + t.index ["course_id"], name: "course_exercises_course_id_fk" + t.index ["exercise_id"], name: "course_exercises_exercise_id_fk" end - create_table "course_offerings", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "course_id", null: false - t.integer "term_id", null: false - t.string "label", default: "", null: false - t.string "url" - t.boolean "self_enrollment_allowed" + create_table "course_offerings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "course_id", null: false + t.integer "term_id", null: false + t.string "label", default: "", null: false + t.string "url" + t.boolean "self_enrollment_allowed" t.datetime "created_at" t.datetime "updated_at" - t.date "cutoff_date" - t.integer "lms_instance_id" - t.index ["course_id"], name: "index_course_offerings_on_course_id", using: :btree - t.index ["lms_instance_id"], name: "index_course_offerings_on_lms_instance_id", using: :btree - t.index ["term_id"], name: "index_course_offerings_on_term_id", using: :btree + t.date "cutoff_date" + t.integer "lms_instance_id" + t.index ["course_id"], name: "index_course_offerings_on_course_id" + t.index ["lms_instance_id"], name: "index_course_offerings_on_lms_instance_id" + t.index ["term_id"], name: "index_course_offerings_on_term_id" end - create_table "course_roles", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name", default: "", null: false - t.boolean "can_manage_course", default: false, null: false - t.boolean "can_manage_assignments", default: false, null: false - t.boolean "can_grade_submissions", default: false, null: false + create_table "course_roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false + t.boolean "can_manage_course", default: false, null: false + t.boolean "can_manage_assignments", default: false, null: false + t.boolean "can_grade_submissions", default: false, null: false t.boolean "can_view_other_submissions", default: false, null: false - t.boolean "builtin", default: false, null: false + t.boolean "builtin", default: false, null: false end - create_table "courses", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name", default: "", null: false - t.string "number", default: "", null: false - t.integer "organization_id", null: false + create_table "courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false + t.string "number", default: "", null: false + t.integer "organization_id", null: false t.datetime "created_at" t.datetime "updated_at" - t.integer "creator_id" - t.string "slug", default: "", null: false - t.integer "user_group_id" - t.boolean "is_hidden", default: false - t.index ["organization_id"], name: "index_courses_on_organization_id", using: :btree - t.index ["slug"], name: "index_courses_on_slug", using: :btree - t.index ["user_group_id"], name: "index_courses_on_user_group_id", using: :btree + t.integer "creator_id" + t.string "slug", default: "", null: false + t.integer "user_group_id" + t.boolean "is_hidden", default: false + t.index ["organization_id"], name: "index_courses_on_organization_id" + t.index ["slug"], name: "index_courses_on_slug" + t.index ["user_group_id"], name: "index_courses_on_user_group_id" end - create_table "errors", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "usable_type" - t.integer "usable_id" - t.string "class_name" - t.text "message", limit: 65535 - t.text "trace", limit: 65535 - t.text "target_url", limit: 65535 - t.text "referer_url", limit: 65535 - t.text "params", limit: 65535 - t.text "user_agent", limit: 65535 - t.datetime "created_at" - t.datetime "updated_at" - t.index ["class_name"], name: "index_errors_on_class_name", using: :btree - t.index ["created_at"], name: "index_errors_on_created_at", using: :btree + create_table "errors", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.text "class_name" + t.text "status" + t.text "message" + t.text "trace" + t.text "target" + t.text "referrer" + t.text "params" + t.text "user_agent" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "exercise_collections", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name" - t.text "description", limit: 65535 - t.integer "user_group_id" - t.integer "license_id" + create_table "exercise_collections", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name" + t.text "description" + t.integer "user_group_id" + t.integer "license_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "user_id" - t.integer "course_offering_id" - t.index ["course_offering_id"], name: "index_exercise_collections_on_course_offering_id", using: :btree - t.index ["license_id"], name: "index_exercise_collections_on_license_id", using: :btree - t.index ["user_group_id"], name: "index_exercise_collections_on_user_group_id", using: :btree - t.index ["user_id"], name: "index_exercise_collections_on_user_id", using: :btree + t.integer "user_id" + t.integer "course_offering_id" + t.index ["course_offering_id"], name: "index_exercise_collections_on_course_offering_id" + t.index ["license_id"], name: "index_exercise_collections_on_license_id" + t.index ["user_group_id"], name: "index_exercise_collections_on_user_group_id" + t.index ["user_id"], name: "index_exercise_collections_on_user_id" end - create_table "exercise_families", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name", default: "", null: false + create_table "exercise_families", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" end - create_table "exercise_owners", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "exercise_owners", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.integer "exercise_id", null: false - t.integer "owner_id", null: false - t.index ["exercise_id", "owner_id"], name: "index_exercise_owners_on_exercise_id_and_owner_id", unique: true, using: :btree - t.index ["owner_id"], name: "exercise_owners_owner_id_fk", using: :btree + t.integer "owner_id", null: false + t.index ["exercise_id", "owner_id"], name: "index_exercise_owners_on_exercise_id_and_owner_id", unique: true + t.index ["owner_id"], name: "exercise_owners_owner_id_fk" end - create_table "exercise_versions", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "stem_id" + create_table "exercise_versions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "stem_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "exercise_id", limit: 4, null: false - t.integer "version", limit: 4, null: false - t.integer "creator_id", limit: 4 - t.integer "irt_data_id", limit: 4 - t.text "text_representation", limit: 16777215 - t.index ["creator_id"], name: "exercise_versions_creator_id_fk", using: :btree - t.index ["exercise_id"], name: "index_exercise_versions_on_exercise_id", using: :btree - t.index ["irt_data_id"], name: "exercise_versions_irt_data_id_fk", using: :btree - t.index ["stem_id"], name: "index_exercise_versions_on_stem_id", using: :btree + t.integer "exercise_id", null: false + t.integer "version", null: false + t.integer "creator_id" + t.integer "irt_data_id" + t.text "text_representation", limit: 16777215 + t.index ["creator_id"], name: "exercise_versions_creator_id_fk" + t.index ["exercise_id"], name: "index_exercise_versions_on_exercise_id" + t.index ["irt_data_id"], name: "exercise_versions_irt_data_id_fk" + t.index ["stem_id"], name: "index_exercise_versions_on_stem_id" end - create_table "exercise_versions_resource_files", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "exercise_versions_resource_files", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.integer "exercise_version_id", null: false - t.integer "resource_file_id", null: false - t.index ["exercise_version_id"], name: "index_exercise_versions_resource_files_on_exercise_version_id", using: :btree - t.index ["resource_file_id"], name: "index_exercise_versions_resource_files_on_resource_file_id", using: :btree + t.integer "resource_file_id", null: false + t.index ["exercise_version_id"], name: "index_exercise_versions_resource_files_on_exercise_version_id" + t.index ["resource_file_id"], name: "index_exercise_versions_resource_files_on_resource_file_id" end - create_table "exercise_workouts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "exercise_id", null: false - t.integer "workout_id", null: false - t.integer "position", null: false - t.float "points", limit: 24, default: 1.0 + create_table "exercise_workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "exercise_id", null: false + t.integer "workout_id", null: false + t.integer "position", null: false + t.float "points", default: 1.0 t.datetime "created_at" t.datetime "updated_at" - t.index ["exercise_id"], name: "exercise_workouts_exercise_id_fk", using: :btree - t.index ["workout_id"], name: "exercise_workouts_workout_id_fk", using: :btree + t.index ["exercise_id"], name: "exercise_workouts_exercise_id_fk" + t.index ["workout_id"], name: "exercise_workouts_workout_id_fk" end - create_table "exercises", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "question_type", null: false - t.integer "current_version_id" + create_table "exercises", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "question_type", null: false + t.integer "current_version_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "versions" - t.integer "exercise_family_id" - t.string "name" - t.boolean "is_public", default: false, null: false - t.integer "experience", null: false - t.integer "irt_data_id" - t.string "external_id" - t.integer "exercise_collection_id" - t.index ["current_version_id"], name: "index_exercises_on_current_version_id", using: :btree - t.index ["exercise_collection_id"], name: "index_exercises_on_exercise_collection_id", using: :btree - t.index ["exercise_family_id"], name: "index_exercises_on_exercise_family_id", using: :btree - t.index ["external_id"], name: "index_exercises_on_external_id", unique: true, using: :btree - t.index ["irt_data_id"], name: "exercises_irt_data_id_fk", using: :btree - t.index ["is_public"], name: "index_exercises_on_is_public", using: :btree + t.integer "versions" + t.integer "exercise_family_id" + t.string "name" + t.boolean "is_public", default: false, null: false + t.integer "experience", null: false + t.integer "irt_data_id" + t.string "external_id" + t.integer "exercise_collection_id" + t.index ["current_version_id"], name: "index_exercises_on_current_version_id" + t.index ["exercise_collection_id"], name: "index_exercises_on_exercise_collection_id" + t.index ["exercise_family_id"], name: "index_exercises_on_exercise_family_id" + t.index ["external_id"], name: "index_exercises_on_external_id", unique: true + t.index ["irt_data_id"], name: "exercises_irt_data_id_fk" + t.index ["is_public"], name: "index_exercises_on_is_public" end - create_table "friendly_id_slugs", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "slug", default: "", null: false - t.integer "sluggable_id", null: false - t.string "sluggable_type", limit: 50 - t.string "scope", limit: 255 + create_table "friendly_id_slugs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "slug", default: "", null: false + t.integer "sluggable_id", null: false + t.string "sluggable_type", limit: 50 + t.string "scope" t.datetime "created_at" - t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree - t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree - t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree - t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree + t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true + t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" + t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" + t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" end - create_table "global_roles", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name", default: "", null: false - t.boolean "can_manage_all_courses", default: false, null: false + create_table "global_roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false + t.boolean "can_manage_all_courses", default: false, null: false t.boolean "can_edit_system_configuration", default: false, null: false - t.boolean "builtin", default: false, null: false + t.boolean "builtin", default: false, null: false end - create_table "group_access_requests", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "user_id" - t.integer "user_group_id" - t.boolean "pending", default: true - t.boolean "decision" + create_table "group_access_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "user_id" + t.integer "user_group_id" + t.boolean "pending", default: true + t.boolean "decision" t.datetime "created_at" t.datetime "updated_at" - t.index ["user_group_id"], name: "index_group_access_requests_on_user_group_id", using: :btree - t.index ["user_id"], name: "index_group_access_requests_on_user_id", using: :btree + t.index ["user_group_id"], name: "index_group_access_requests_on_user_group_id" + t.index ["user_id"], name: "index_group_access_requests_on_user_id" end - create_table "identities", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "user_id", null: false - t.string "provider", default: "", null: false - t.string "uid", default: "", null: false + create_table "identities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "user_id", null: false + t.string "provider", default: "", null: false + t.string "uid", default: "", null: false t.datetime "created_at" t.datetime "updated_at" - t.index ["uid", "provider"], name: "index_identities_on_uid_and_provider", using: :btree - t.index ["user_id"], name: "index_identities_on_user_id", using: :btree + t.index ["uid", "provider"], name: "index_identities_on_uid_and_provider" + t.index ["user_id"], name: "index_identities_on_user_id" end - create_table "irt_data", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "attempt_count", null: false - t.float "sum_of_scores", limit: 24, null: false - t.float "difficulty", limit: 24, null: false - t.float "discrimination", limit: 24, null: false + create_table "irt_data", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "attempt_count", null: false + t.float "sum_of_scores", null: false + t.float "difficulty", null: false + t.float "discrimination", null: false end - create_table "license_policies", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name" - t.text "description", limit: 65535 - t.boolean "can_fork" - t.boolean "is_public" + create_table "license_policies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name" + t.text "description" + t.boolean "can_fork" + t.boolean "is_public" t.datetime "created_at" t.datetime "updated_at" end - create_table "licenses", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name" - t.text "description", limit: 65535 - t.string "url" - t.integer "license_policy_id" + create_table "licenses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name" + t.text "description" + t.string "url" + t.integer "license_policy_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["license_policy_id"], name: "index_licenses_on_license_policy_id", using: :btree + t.index ["license_policy_id"], name: "index_licenses_on_license_policy_id" end - create_table "lms_instances", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "consumer_key" - t.string "consumer_secret" + create_table "lms_instances", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "consumer_key" + t.string "consumer_secret" t.datetime "created_at" t.datetime "updated_at" - t.string "url" - t.integer "lms_type_id" - t.integer "organization_id" - t.index ["lms_type_id"], name: "lms_instances_lms_type_id_fk", using: :btree - t.index ["organization_id"], name: "index_lms_instances_on_organization_id", using: :btree - t.index ["url"], name: "index_lms_instances_on_url", unique: true, using: :btree + t.string "url" + t.integer "lms_type_id" + t.integer "organization_id" + t.index ["lms_type_id"], name: "lms_instances_lms_type_id_fk" + t.index ["organization_id"], name: "index_lms_instances_on_organization_id" + t.index ["url"], name: "index_lms_instances_on_url", unique: true end - create_table "lms_types", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name", default: "", null: false + create_table "lms_types", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" - t.index ["name"], name: "index_lms_types_on_name", unique: true, using: :btree + t.index ["name"], name: "index_lms_types_on_name", unique: true end - create_table "lti_identities", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "lti_user_id" - t.integer "user_id" - t.integer "lms_instance_id" + create_table "lti_identities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "lti_user_id" + t.integer "user_id" + t.integer "lms_instance_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["lms_instance_id"], name: "index_lti_identities_on_lms_instance_id", using: :btree - t.index ["user_id"], name: "index_lti_identities_on_user_id", using: :btree + t.index ["lms_instance_id"], name: "index_lti_identities_on_lms_instance_id" + t.index ["user_id"], name: "index_lti_identities_on_user_id" end - create_table "lti_workouts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "workout_id", limit: 4 - t.string "lms_assignment_id", limit: 255, null: false + create_table "lti_workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "workout_id" + t.string "lms_assignment_id", null: false t.datetime "created_at" t.datetime "updated_at" - t.integer "lms_instance_id", limit: 4 - t.index ["lms_instance_id"], name: "index_lti_workouts_on_lms_instance_id", using: :btree - t.index ["workout_id"], name: "index_lti_workouts_on_workout_id", using: :btree + t.integer "lms_instance_id" + t.index ["lms_instance_id"], name: "index_lti_workouts_on_lms_instance_id" + t.index ["workout_id"], name: "index_lti_workouts_on_workout_id" end - create_table "memberships", id: :integer, force: :cascade do |t| - t.integer "user_id", limit: 4 - t.integer "user_group_id", limit: 4 + create_table "memberships", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "user_id" + t.integer "user_group_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "multiple_choice_prompt_answers", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "multiple_choice_prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| end - create_table "multiple_choice_prompts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "multiple_choice_prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.boolean "allow_multiple", default: false, null: false - t.boolean "is_scrambled", default: true, null: false + t.boolean "is_scrambled", default: true, null: false end - create_table "organizations", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name", default: "", null: false + create_table "organizations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" - t.string "abbreviation" - t.string "slug", default: "", null: false - t.boolean "is_hidden", default: false - t.index ["slug"], name: "index_organizations_on_slug", unique: true, using: :btree + t.string "abbreviation" + t.string "slug", default: "", null: false + t.boolean "is_hidden", default: false + t.index ["slug"], name: "index_organizations_on_slug", unique: true end - create_table "prompt_answers", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + create_table "prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.integer "attempt_id" t.integer "prompt_id" t.integer "actable_id" - t.string "actable_type" - t.index ["actable_id"], name: "index_prompt_answers_on_actable_id", using: :btree - t.index ["attempt_id", "prompt_id"], name: "index_prompt_answers_on_attempt_id_and_prompt_id", unique: true, using: :btree - t.index ["attempt_id"], name: "index_prompt_answers_on_attempt_id", using: :btree - t.index ["prompt_id"], name: "index_prompt_answers_on_prompt_id", using: :btree + t.string "actable_type" + t.index ["actable_id"], name: "index_prompt_answers_on_actable_id" + t.index ["attempt_id", "prompt_id"], name: "index_prompt_answers_on_attempt_id_and_prompt_id", unique: true + t.index ["attempt_id"], name: "index_prompt_answers_on_attempt_id" + t.index ["prompt_id"], name: "index_prompt_answers_on_prompt_id" end - create_table "prompts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "exercise_version_id", null: false - t.text "question", limit: 65535, null: false - t.integer "position", null: false - t.text "feedback", limit: 65535 + create_table "prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "exercise_version_id", null: false + t.text "question", null: false + t.integer "position", null: false + t.text "feedback" t.datetime "created_at" t.datetime "updated_at" - t.integer "actable_id" - t.string "actable_type" - t.integer "irt_data_id" - t.index ["actable_id"], name: "index_prompts_on_actable_id", using: :btree - t.index ["exercise_version_id"], name: "index_prompts_on_exercise_version_id", using: :btree - t.index ["irt_data_id"], name: "prompts_irt_data_id_fk", using: :btree + t.integer "actable_id" + t.string "actable_type" + t.integer "irt_data_id" + t.index ["actable_id"], name: "index_prompts_on_actable_id" + t.index ["exercise_version_id"], name: "index_prompts_on_exercise_version_id" + t.index ["irt_data_id"], name: "prompts_irt_data_id_fk" end - create_table "resource_files", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "filename" - t.string "token", default: "", null: false - t.integer "user_id", null: false - t.boolean "public", default: true + create_table "resource_files", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "filename" + t.string "token", default: "", null: false + t.integer "user_id", null: false + t.boolean "public", default: true t.datetime "created_at" t.datetime "updated_at" - t.index ["token"], name: "index_resource_files_on_token", using: :btree - t.index ["user_id"], name: "index_resource_files_on_user_id", using: :btree + t.index ["token"], name: "index_resource_files_on_token" + t.index ["user_id"], name: "index_resource_files_on_user_id" end - create_table "signups", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "first_name" - t.string "last_name_name" - t.string "email" - t.string "institution" - t.text "comments", limit: 65535 + create_table "signups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "first_name" + t.string "last_name_name" + t.string "email" + t.string "institution" + t.text "comments" t.datetime "created_at" t.datetime "updated_at" end - create_table "stems", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.text "preamble", limit: 65535 + create_table "stems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.text "preamble" t.datetime "created_at" t.datetime "updated_at" end - create_table "student_extensions", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "user_id" - t.integer "workout_offering_id" + create_table "student_extensions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "user_id" + t.integer "workout_offering_id" t.datetime "soft_deadline" t.datetime "hard_deadline" t.datetime "created_at" t.datetime "updated_at" - t.integer "time_limit", limit: 4 + t.integer "time_limit" t.datetime "opening_date" - t.index ["user_id"], name: "index_student_extensions_on_user_id", using: :btree - t.index ["workout_offering_id"], name: "index_student_extensions_on_workout_offering_id", using: :btree + t.index ["user_id"], name: "index_student_extensions_on_user_id" + t.index ["workout_offering_id"], name: "index_student_extensions_on_workout_offering_id" end - create_table "tag_user_scores", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "user_id", null: false - t.integer "experience", default: 0 + create_table "tag_user_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "user_id", null: false + t.integer "experience", default: 0 t.datetime "created_at" t.datetime "updated_at" - t.integer "completed_exercises", default: 0 - t.index ["user_id"], name: "index_tag_user_scores_on_user_id", using: :btree + t.integer "completed_exercises", default: 0 + t.index ["user_id"], name: "index_tag_user_scores_on_user_id" end - create_table "taggings", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "tag_id" - t.integer "taggable_id" - t.string "taggable_type" - t.integer "tagger_id" - t.string "tagger_type" - t.string "context", limit: 128 + create_table "taggings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context", limit: 128 t.datetime "created_at" - t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree - t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree + t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true + t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" end - create_table "tags", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name" + create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name" t.integer "taggings_count", default: 0 - t.index ["name"], name: "index_tags_on_name", unique: true, using: :btree + t.index ["name"], name: "index_tags_on_name", unique: true end - create_table "terms", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "season", null: false - t.date "starts_on", null: false - t.date "ends_on", null: false - t.integer "year", null: false + create_table "terms", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "season", null: false + t.date "starts_on", null: false + t.date "ends_on", null: false + t.integer "year", null: false t.datetime "created_at" t.datetime "updated_at" - t.string "slug", default: "", null: false - t.index ["slug"], name: "index_terms_on_slug", unique: true, using: :btree - t.index ["year", "season"], name: "index_terms_on_year_and_season", using: :btree + t.string "slug", default: "", null: false + t.index ["slug"], name: "index_terms_on_slug", unique: true + t.index ["year", "season"], name: "index_terms_on_year_and_season" end - create_table "test_case_results", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "test_case_id", null: false - t.integer "user_id", null: false - t.text "execution_feedback", limit: 65535 + create_table "test_case_results", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "test_case_id", null: false + t.integer "user_id", null: false + t.text "execution_feedback" t.datetime "created_at" t.datetime "updated_at" - t.boolean "pass", null: false - t.integer "coding_prompt_answer_id" - t.index ["coding_prompt_answer_id"], name: "index_test_case_results_on_coding_prompt_answer_id", using: :btree - t.index ["test_case_id"], name: "index_test_case_results_on_test_case_id", using: :btree - t.index ["user_id"], name: "index_test_case_results_on_user_id", using: :btree + t.boolean "pass", null: false + t.integer "coding_prompt_answer_id" + t.index ["coding_prompt_answer_id"], name: "index_test_case_results_on_coding_prompt_answer_id" + t.index ["test_case_id"], name: "index_test_case_results_on_test_case_id" + t.index ["user_id"], name: "index_test_case_results_on_user_id" end - create_table "test_cases", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.text "negative_feedback", limit: 65535 - t.float "weight", limit: 24, null: false - t.text "description", limit: 65535 + create_table "test_cases", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.text "negative_feedback" + t.float "weight", null: false + t.text "description" t.datetime "created_at" t.datetime "updated_at" - t.integer "coding_prompt_id", null: false - t.text "input", limit: 65535, null: false - t.text "expected_output", limit: 65535, null: false - t.boolean "static", default: false, null: false - t.boolean "screening", default: false, null: false - t.boolean "example", default: false, null: false - t.boolean "hidden", default: false, null: false - t.index ["coding_prompt_id"], name: "index_test_cases_on_coding_prompt_id", using: :btree + t.integer "coding_prompt_id", null: false + t.text "input", null: false + t.text "expected_output", null: false + t.boolean "static", default: false, null: false + t.boolean "screening", default: false, null: false + t.boolean "example", default: false, null: false + t.boolean "hidden", default: false, null: false + t.index ["coding_prompt_id"], name: "index_test_cases_on_coding_prompt_id" end - create_table "time_zones", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name" - t.string "zone" - t.string "display_as" + create_table "time_zones", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name" + t.string "zone" + t.string "display_as" t.datetime "created_at" t.datetime "updated_at" end - create_table "user_groups", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name" + create_table "user_groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name" t.datetime "created_at" t.datetime "updated_at" - t.text "description", limit: 65535 + t.text "description" end - create_table "users", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "email", default: "", null: false - t.string "encrypted_password", default: "", null: false - t.string "reset_password_token" + create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", limit: 4, default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip", limit: 255 - t.string "last_sign_in_ip", limit: 255 - t.string "confirmation_token", limit: 255 + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" t.datetime "created_at" t.datetime "updated_at" - t.string "first_name" - t.string "last_name" - t.integer "global_role_id", null: false - t.string "avatar" - t.string "slug", default: "", null: false - t.integer "current_workout_score_id" - t.integer "time_zone_id" - t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree - t.index ["current_workout_score_id"], name: "index_users_on_current_workout_score_id", unique: true, using: :btree - t.index ["email"], name: "index_users_on_email", unique: true, using: :btree - t.index ["global_role_id"], name: "index_users_on_global_role_id", using: :btree - t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree - t.index ["slug"], name: "index_users_on_slug", unique: true, using: :btree - t.index ["time_zone_id"], name: "index_users_on_time_zone_id", using: :btree + t.string "first_name" + t.string "last_name" + t.integer "global_role_id", null: false + t.string "avatar" + t.string "slug", default: "", null: false + t.integer "current_workout_score_id" + t.integer "time_zone_id" + t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true + t.index ["current_workout_score_id"], name: "index_users_on_current_workout_score_id", unique: true + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["global_role_id"], name: "index_users_on_global_role_id" + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + t.index ["slug"], name: "index_users_on_slug", unique: true + t.index ["time_zone_id"], name: "index_users_on_time_zone_id" end - create_table "visualization_loggings", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| - t.integer "user_id" - t.integer "exercise_id" - t.integer "workout_id" - t.integer "workout_offering_id" + create_table "visualization_loggings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + t.integer "user_id" + t.integer "exercise_id" + t.integer "workout_id" + t.integer "workout_offering_id" t.datetime "created_at" t.datetime "updated_at" - t.index ["exercise_id"], name: "index_visualization_loggings_on_exercise_id", using: :btree - t.index ["user_id"], name: "index_visualization_loggings_on_user_id", using: :btree - t.index ["workout_id"], name: "index_visualization_loggings_on_workout_id", using: :btree - t.index ["workout_offering_id"], name: "index_visualization_loggings_on_workout_offering_id", using: :btree + t.index ["exercise_id"], name: "index_visualization_loggings_on_exercise_id" + t.index ["user_id"], name: "index_visualization_loggings_on_user_id" + t.index ["workout_id"], name: "index_visualization_loggings_on_workout_id" + t.index ["workout_offering_id"], name: "index_visualization_loggings_on_workout_offering_id" end - create_table "workout_offerings", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "course_offering_id", null: false - t.integer "workout_id", null: false + create_table "workout_offerings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "course_offering_id", null: false + t.integer "workout_id", null: false t.datetime "created_at" t.datetime "updated_at" t.datetime "opening_date" t.datetime "soft_deadline" t.datetime "hard_deadline" - t.boolean "published", default: true, null: false - t.integer "time_limit" - t.integer "workout_policy_id" - t.integer "continue_from_workout_id" - t.string "lms_assignment_id" - t.boolean "most_recent", default: true - t.string "lms_assignment_url" - t.index ["continue_from_workout_id"], name: "workout_offerings_continue_from_workout_id_fk", using: :btree - t.index ["course_offering_id"], name: "index_workout_offerings_on_course_offering_id", using: :btree - t.index ["lms_assignment_id"], name: "index_workout_offerings_on_lms_assignment_id", using: :btree - t.index ["workout_id"], name: "index_workout_offerings_on_workout_id", using: :btree - t.index ["workout_policy_id"], name: "index_workout_offerings_on_workout_policy_id", using: :btree - end - - create_table "workout_owners", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| + t.boolean "published", default: true, null: false + t.integer "time_limit" + t.integer "workout_policy_id" + t.integer "continue_from_workout_id" + t.string "lms_assignment_id" + t.boolean "most_recent", default: true + t.string "lms_assignment_url" + t.index ["continue_from_workout_id"], name: "workout_offerings_continue_from_workout_id_fk" + t.index ["course_offering_id"], name: "index_workout_offerings_on_course_offering_id" + t.index ["lms_assignment_id"], name: "index_workout_offerings_on_lms_assignment_id" + t.index ["workout_id"], name: "index_workout_offerings_on_workout_id" + t.index ["workout_policy_id"], name: "index_workout_offerings_on_workout_policy_id" + end + + create_table "workout_owners", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.integer "workout_id", null: false - t.integer "owner_id", null: false - t.index ["owner_id"], name: "workout_owners_owner_id_fk", using: :btree - t.index ["workout_id", "owner_id"], name: "index_workout_owners_on_workout_id_and_owner_id", unique: true, using: :btree + t.integer "owner_id", null: false + t.index ["owner_id"], name: "workout_owners_owner_id_fk" + t.index ["workout_id", "owner_id"], name: "index_workout_owners_on_workout_id_and_owner_id", unique: true end - create_table "workout_policies", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.boolean "hide_thumbnails_before_start" - t.boolean "hide_feedback_before_finish" - t.boolean "hide_compilation_feedback_before_finish" - t.boolean "no_review_before_close" - t.boolean "hide_feedback_in_review_before_close" - t.boolean "hide_thumbnails_in_review_before_close" - t.boolean "no_hints" - t.boolean "no_faq" - t.string "name", limit: 255 + create_table "workout_policies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.boolean "hide_thumbnails_before_start" + t.boolean "hide_feedback_before_finish" + t.boolean "hide_compilation_feedback_before_finish" + t.boolean "no_review_before_close" + t.boolean "hide_feedback_in_review_before_close" + t.boolean "hide_thumbnails_in_review_before_close" + t.boolean "no_hints" + t.boolean "no_faq" + t.string "name" t.datetime "created_at" t.datetime "updated_at" - t.boolean "invisible_before_review" - t.string "description", limit: 255 + t.boolean "invisible_before_review" + t.string "description" end - create_table "workout_scores", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.integer "workout_id", null: false - t.integer "user_id", null: false - t.float "score", limit: 24 - t.boolean "completed" + create_table "workout_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.integer "workout_id", null: false + t.integer "user_id", null: false + t.float "score" + t.boolean "completed" t.datetime "completed_at" t.datetime "last_attempted_at" - t.integer "exercises_completed", limit: 4 - t.integer "exercises_remaining", limit: 4 + t.integer "exercises_completed" + t.integer "exercises_remaining" t.datetime "created_at" t.datetime "updated_at" - t.integer "workout_offering_id" - t.string "lis_outcome_service_url" - t.string "lis_result_sourcedid" - t.integer "lti_workout_id", limit: 4 - t.index ["lti_workout_id"], name: "index_workout_scores_on_lti_workout_id", using: :btree - t.index ["user_id"], name: "index_workout_scores_on_user_id", using: :btree - t.index ["workout_id"], name: "index_workout_scores_on_workout_id", using: :btree - t.index ["workout_offering_id"], name: "workout_scores_workout_offering_id_fk", using: :btree + t.integer "workout_offering_id" + t.string "lis_outcome_service_url" + t.string "lis_result_sourcedid" + t.integer "lti_workout_id" + t.index ["lti_workout_id"], name: "index_workout_scores_on_lti_workout_id" + t.index ["user_id"], name: "index_workout_scores_on_user_id" + t.index ["workout_id"], name: "index_workout_scores_on_workout_id" + t.index ["workout_offering_id"], name: "workout_scores_workout_offering_id_fk" end - create_table "workouts", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci" do |t| - t.string "name", default: "", null: false - t.boolean "scrambled", default: false + create_table "workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false + t.boolean "scrambled", default: false t.datetime "created_at" t.datetime "updated_at" - t.text "description", limit: 65535 - t.integer "points_multiplier" - t.integer "creator_id" - t.string "external_id" - t.boolean "is_public" - t.index ["creator_id"], name: "workouts_creator_id_fk", using: :btree - t.index ["external_id"], name: "index_workouts_on_external_id", unique: true, using: :btree - t.index ["is_public"], name: "index_workouts_on_is_public", using: :btree + t.text "description" + t.integer "points_multiplier" + t.integer "creator_id" + t.string "external_id" + t.boolean "is_public" + t.index ["creator_id"], name: "workouts_creator_id_fk" + t.index ["external_id"], name: "index_workouts_on_external_id", unique: true + t.index ["is_public"], name: "index_workouts_on_is_public" end add_foreign_key "attempts", "exercise_versions", name: "attempts_exercise_version_id_fk" From 2c3493130b319fcabd1f24f460846a5164a625ee Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Fri, 3 Jul 2020 10:56:20 -0400 Subject: [PATCH 16/53] Get README from staging --- README.md | 208 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 118 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index 196ae49d..7f461442 100644 --- a/README.md +++ b/README.md @@ -1,121 +1,149 @@ -Setting Up a Vagrant Environment for CodeWorkout -============================================ +# CodeWorkout -## Introduction: +CodeWorkout is an online system for people learning a programming language for the first time. +It is a free, open-source solution for practicing small programming problems. +Students may practice coding exercises or multiple-choice-questions on a variety of programming concepts in a web browser and receive immediate feedback. -Vagrant is designed to run on multiple platforms, including Mac OS X, Microsoft Windows, Debian, Ubuntu, CentOS, RedHat and Fedora. In this document we describe how to configure and run CodeWorkout project virtual development environment through Vagrant. +CodeWorkout was inspired by many great systems built by others, but aims to bring together the best from earlier forerunners while adding important new features. +It provides comprehensive support for teachers who want to use coding exercises in their courses, while also maintaining flexibility for self-paced learners who aren't part of an organized course. -## Installation Steps: +Try it out at [https://code-workout.cs.vt.edu]. +You can play around without signing up if you like. -1. Install [Vagrant](https://www.vagrantup.com/downloads.html) -2. Install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) -3. Clone this repository -4. `$ cd code-workout` -5. `$ vagrant up` -6. `$ vagrant ssh` -7. `$ cd /vagrant` -8. `$ rails server` -9. After the provisioning script is complete you can go to: +## Contents +* [Setting up a Development Environment Using Docker](#setting-up-a-development-environment-using-docker) + - [Clone this repository](#clone-this-repository) + - [Install Docker and build the containers](#install-docker-and-build-the-containers) + - [Set up some development data](#set-up-some-development-data) + - [Run servers](#run-servers) + - [Other notes](#other-notes) +* [Making an exercise](#making-an-exercise) - * https://192.168.33.20:3000 for CodeWorkout server +## Setting up a Development Environment Using Docker -## Shut Down The Virtual Machine: +> Note: If you are comfortable setting up a Rails application, i.e., installing Ruby (2.3.8), Rails (4.2), and MySQL (5.7) on your own machine, you can just do that instead of using Docker. You'll need to change the `host` keys in [config/database.yml](config/database.yml) to `localhost`. -After you finish your work, you need to turn the virtual machine off. +The following steps will help set up a development environment for CodeWorkout using Docker and Docker Compose. +You can do your editing on your own machine using an editor of your choice; changes will be reflected in the Docker container. -1. Exit the virtual machine terminal by typing `exit` -2. `$ cd code-workout` -3. `$ vagrant halt` +### Clone this repository -## Re-run Development Servers: +```bash +$ git clone git@github.com:web-cat/code-workout.git +$ cd code-workout +``` -If you decided to shut down the virtual machine using `vagrant halt`, you have to re-run the servers again after you do `vagrant up`. +Check out the `staging` branch. Most new changes won't be accepted directly into the `master` branch. +```bash +$ git checkout staging +``` -1. `$ cd code-workout` -2. `$ vagrant up` -3. `$ vagrant ssh` -4. `$ cd /vagrant` -5. `$ rails server` +### Install Docker and build the containers -## Reprovision The Virtual Machine: +Instructions to install Docker may be found at the [Docker website](https://docs.docker.com/get-docker/). -If anything went wrong or you want to reprovision your virtual machine for any reason, follow these steps. +These instructions were written with Docker version `19.03.8` in mind. We don't do anything fancy, so things should work as long as you're reasonably up to date. -1. `$ cd code-workout` -2. `$ git pull` -3. `$ vagrant destroy` -4. `$ vagrant up` +We use [Docker Compose](https://docs.docker.com/get-docker/) to tie multiple containers together. One for the web application, and one each for the test and development databases. +Docker Compose comes installed with Docker automatically. -## Virtual Machine sudo password: +Inside the `code-workout` directory, do the following: +```bash +$ docker-compose up # build and start containers for the web application and the databases +``` -sudo password is `vagrant` in case you need to execute any commands that require sudo. +This step builds the `web` container using the provided [Dockerfile](Dockerfile) to install Ruby, Rails, and required dependencies. It also builds the `db_dev` and `db_test` containers, each of which pull a ready-to-use MySQL image from DockerHub. Two databases are set up: +* `codeworkout`, running on port 3306 on the `db_dev` container and port 3307 on the host +* `codeworkout_test`, running on port 3306 on the `db_test` container and port 3308 on the host -## CodeWorkout Database Test Data +Credentials for both databases: +* username: `codeworkout` +* pwd: `codeworkout` -The initial database population is defined by lib/tasks/sample_data.rake. -It uses the factories defined in spec/factories/* to generate entities. -If you add new modael classes and want to generate test data in the -database, please add to the sample_data.rake file so that this population -will happen automatically for everyone. The sample_data.rake contains -only "sample/try out" data for use during development, and it won't -appear on the production server. Initial database contents provided -for all new installs, including the production server, is described -in db/seeds.rb instead. +The first time you do this, it will take a bit of time to build all the containers. Subsequent runs of this command will just start the existing containers. - - The initial database includes the following accounts: - - admin@codeworkout.org (pass: adminadmin), has admin-level access - - example-1@railstutorial.org (pass: hokiehokie), has instructor access - - example-*@railstutorial.org (pass: hokiehokie) 50 students +Output from the containers will appear in your console. Do `Ctrl-C` to exit and stop the containers. - It also includes the following other objects: - - six terms (spring, summer I, summer II, fall, and winter 2016), - - one organization (VT) - - one course (CS 1114) - - two offerings of 1114 (one each semester) - - one course offering is set up with the admin and instructor - as instructors, and all other sample accounts as students +Do the following if you want to run the containers in the background and get your terminal back: +```bash +$ docker-compose up -d +``` - - To reset the database to the initial state do the following: - - `$ cd code-workout` - - `$ vagrant ssh` - - `$ cd /vagrant` - - `$ rake db:populate` - - `$ rails server` +You can `docker-compose down` to stop and remove the containers (or just `docker-compose stop` to stop without removing). -## Keep code-workout repository up to date: +### Set up some development data -During development of code-workout, other developers might add new gems to the project or add new migrations etc. To keep your local version up to date with the latest version do the following: +This next step sets up the database and populates it with fake data for development. +Do the following in the `code-workout` directory on your machine. -- Open a new terminal -- `$ cd code-workout` -- `$ git pull` -- `$ vagrant reload` -- `$ vagrant ssh` -- `$ cd /vagrant` -- `$ sudo bundle install` -- `$ rake db:populate` **Note:** This step will place the database in a simple starter state. -- `$ rails server` +```bash +$ docker-compose run web rake db:populate +``` +The above command is telling Docker to "run the command `rake db:populate` on the `web` container and exit". +This rake task is defined in [lib/tasks/sample_data.rake](lib/tasks/sample_data.rake), and runs the following tasks in order: -## Upload and Test Programming Exercises: +```bash +$ rake db:drop # drop the database +$ rake db:create # create the database +$ rake db:schema:load # load the schema from db/schema.rb +$ rake db:seed # load the seeded data (like timezones, seasons, etc.) +$ rake db:populate # load sample data; this is a custom rake task +``` -- Log in using your admin account admin@codeworkout.org (pass: adminadmin) -- Click "Upload Exercises" in the navigation bar, then click "Choose File". Choose your exercise file and click "Submit File". -- Click "Create Workouts" in the navigation bar to create new workouts. -- Go to the admin area by clicking on the little wrench icon to the left of the admin email address in the top menu bar. Click the "University-oriented" menu and select "Workout offerings". Click on "New Workout Offering". Create your new workout offering by choosing the course offering and the workout (the one you have just created in the previous step). Then select appropriate opening, soft deadline, and hard deadline dates for the workout offering and hit "Create Workout Offering" button to save it. -- Log in using student account example-2@railstutorial.org (pass: hokiehokie). Then navigate to the course offering you have chosen in the previous step, you should see the new workout in the list of workouts for this course offering. +> Run `rake -T` in your project root to see a list of available rake tasks. [What's rake?](https://github.com/ruby/rake) -## Connect to CodeWorkout Database: +The initial database population is defined by [lib/tasks/sample_data.rake](lib/tasks/sample_data.rake). +It uses the factories defined in [spec/factories](spec/factories) to generate entities. +If you add new model classes and want to generate test data in the database, please add to the `sample_data.rake` file so that this population will happen automatically for everyone. +The `sample_data.rake` contains only "sample/try out" data for use during development, and it won't +appear on the production server. +Initial database contents provided for all new installs, including the production server, is described in db/seeds.rb instead. -During development it is convenient to connect to CodeWorkout database from your host machine using [MySQL Workbench](https://www.mysql.com/products/workbench/). Once you installed MySQL Workbench create a new connection to CodeWorkout Database in the Vagrant machine using the following setup: +- The initial database includes the following accounts: + - admin@codeworkout.org (pass: adminadmin), has admin-level access + - example-1@railstutorial.org (pass: hokiehokie), has instructor access + - example-*@railstutorial.org (pass: hokiehokie) 50 students -- Connection Name: CodeWorkout -- Connection Method: Standard TCP/IP over SSH -- SSH Hostname: 192.168.33.20 -- SSH Username: vagrant -- SSH Password: vagrant -- MySQL Hostname: 127.0.0.1 -- MySQL Server Port: 3306 -- Username: codeworkout -- Password: codeworkout + It also includes the following other objects: + - six terms (spring, summer I, summer II, fall, and winter of the current year), + - one organization (VT) + - one course (CS 1114) + - two offerings of 1114 (one each semester) + - one course offering is set up with the admin and instructor + as instructors, and all other sample accounts as students +- To reset the database to the initial state do the following: + - `$ cd code-workout` + - `$ docker-compose run web rake db:populate` + +**A note on setting up a development database.** + +We load the schema directly from [db/schema.rb](db/schema.rb), because database migrations tend to go stale over time—running over 100 migrations, many of which are years old, is likely to run into errors. Migrations are useful for making *new* changes or reversing *recent* changes to the schema. + +### Run servers +To run the development server, do the following in the `code-workout` directory: + +```bash +$ docker-compose up # this may take a minute +``` + +In your browser, navigate to [https://localhost:9292](https://localhost:9292) and you should see the CodeWorkout homepage. (Make sure you have `https` in front of the URL.) + +You can edit files on your own machine; changes will be reflected in container. + +### Other notes + +**NOTE 1**: Since the Rails application is running on the `web` container, your typical `rails` or `rake` commands are run as you see above, i.e., with `docker-compose run web` in front of it. For example, to generate a model you would do `docker-compose run web rails g model MyModel`. + +**NOTE 2**: To end up in a bash shell in the container (i.e., to "SSH" into the server), do the following: +```bash +docker-compose run web bash +``` +Note that this does not set up the port forwarding, so if you do this and manually run the server (`./runservers.sh`), you won't be able to access it from your browser. + +**NOTE 3**: These docs and the Docker setup are recent. Please submit an issue if something is missing, incorrect, or unclear. + +## Making an Exercise + +For instructions on how to make an exercise, see [making_an_exercise.md](making_an_exercise.md). Note that this functionality is not directly available through the web interface for most users. Please get in touch if you want to add exercises to CodeWorkout. From 1f51d4a933c203ae6a0e32b2f9b1b62c2ee0088c Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 7 Jul 2020 21:13:40 -0400 Subject: [PATCH 17/53] Set deploy branch to rails-5-upgrade --- config/deploy/staging.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index 9fdcd097..a094a694 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -1,5 +1,5 @@ set :stage, :staging -set :branch, 'staging' +set :branch, 'rails-5-upgrade' set :rails_env, 'staging' # Simple Role Syntax From 4f8c6f6e8edb98433f49a90e802c56879c3eb47f Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Thu, 22 Oct 2020 03:41:26 -0400 Subject: [PATCH 18/53] update models Signed-off-by: Alex Hicks --- app/models/application_record.rb | 3 +++ app/models/attempt.rb | 2 +- app/models/choice.rb | 2 +- app/models/coding_prompt.rb | 2 +- app/models/coding_prompt_answer.rb | 2 +- app/models/course.rb | 2 +- app/models/course_enrollment.rb | 2 +- app/models/course_exercise.rb | 2 +- app/models/course_offering.rb | 2 +- app/models/course_role.rb | 2 +- app/models/error.rb | 6 +++--- app/models/exercise.rb | 2 +- app/models/exercise_collection.rb | 2 +- app/models/exercise_family.rb | 2 +- app/models/exercise_owner.rb | 2 +- app/models/exercise_version.rb | 2 +- app/models/exercise_workout.rb | 2 +- app/models/global_role.rb | 2 +- app/models/group_access_request.rb | 2 +- app/models/identity.rb | 2 +- app/models/irt_data.rb | 2 +- app/models/license.rb | 2 +- app/models/license_policy.rb | 2 +- app/models/lms_instance.rb | 2 +- app/models/lms_type.rb | 2 +- app/models/lti_identity.rb | 2 +- app/models/lti_workout.rb | 2 +- app/models/membership.rb | 2 +- app/models/multiple_choice_prompt.rb | 2 +- app/models/multiple_choice_prompt_answer.rb | 2 +- app/models/organization.rb | 2 +- app/models/prompt.rb | 2 +- app/models/prompt_answer.rb | 2 +- app/models/resource_file.rb | 2 +- app/models/stem.rb | 2 +- app/models/student_extension.rb | 2 +- app/models/tag_user_score.rb | 2 +- app/models/term.rb | 2 +- app/models/test_case.rb | 2 +- app/models/test_case_result.rb | 2 +- app/models/time_zone.rb | 2 +- app/models/user.rb | 2 +- app/models/user_group.rb | 2 +- app/models/visualization_logging.rb | 2 +- app/models/workout.rb | 2 +- app/models/workout_offering.rb | 2 +- app/models/workout_owner.rb | 2 +- app/models/workout_policy.rb | 2 +- app/models/workout_score.rb | 2 +- 49 files changed, 53 insertions(+), 50 deletions(-) create mode 100644 app/models/application_record.rb diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 00000000..10a4cba8 --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/attempt.rb b/app/models/attempt.rb index f314cb59..d944fb25 100644 --- a/app/models/attempt.rb +++ b/app/models/attempt.rb @@ -58,7 +58,7 @@ # active_score relation ... and that non-nil active_score should be the # same as its workout_score relation. # -class Attempt < ActiveRecord::Base +class Attempt < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/choice.rb b/app/models/choice.rb index d165ba8b..41736dc9 100644 --- a/app/models/choice.rb +++ b/app/models/choice.rb @@ -34,7 +34,7 @@ # have a non-zero value indicating the partial credit awarded for that single # choice. # -class Choice < ActiveRecord::Base +class Choice < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/coding_prompt.rb b/app/models/coding_prompt.rb index cb58423f..9d76e648 100644 --- a/app/models/coding_prompt.rb +++ b/app/models/coding_prompt.rb @@ -22,7 +22,7 @@ # acts_as (see the documentation on-line for the activerecord-acts_as # gem). # -class CodingPrompt < ActiveRecord::Base +class CodingPrompt < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/coding_prompt_answer.rb b/app/models/coding_prompt_answer.rb index 8a03d848..2ed30753 100644 --- a/app/models/coding_prompt_answer.rb +++ b/app/models/coding_prompt_answer.rb @@ -14,7 +14,7 @@ # PromptAnswer via acts_as (see the documentation on-line for the # activerecord-acts_as gem). # -class CodingPromptAnswer < ActiveRecord::Base +class CodingPromptAnswer < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/course.rb b/app/models/course.rb index 21159f91..6d20958e 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -25,7 +25,7 @@ # description. A course may have one or more course offerings in any # specific term. # -class Course < ActiveRecord::Base +class Course < ApplicationRecord extend FriendlyId friendly_id :number_without_spaces, use: [:history, :scoped], scope: :organization diff --git a/app/models/course_enrollment.rb b/app/models/course_enrollment.rb index 87751b1c..3e6efc3c 100644 --- a/app/models/course_enrollment.rb +++ b/app/models/course_enrollment.rb @@ -20,7 +20,7 @@ # indicating each user's role with respect to the course offerings in which # they are enrolled. # -class CourseEnrollment < ActiveRecord::Base +class CourseEnrollment < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/course_exercise.rb b/app/models/course_exercise.rb index 3a80e18d..fc1f0464 100644 --- a/app/models/course_exercise.rb +++ b/app/models/course_exercise.rb @@ -20,7 +20,7 @@ # If we really need many-to-many, though, since right now, exercises can # only belong to one course? # -class CourseExercise < ActiveRecord::Base +class CourseExercise < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/course_offering.rb b/app/models/course_offering.rb index 88fa804a..3bc4fa13 100644 --- a/app/models/course_offering.rb +++ b/app/models/course_offering.rb @@ -23,7 +23,7 @@ # ============================================================================= # Represents a single section (or offering) of a course in a specific term. # -class CourseOffering < ActiveRecord::Base +class CourseOffering < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/course_role.rb b/app/models/course_role.rb index ef9f03c2..36fb5165 100644 --- a/app/models/course_role.rb +++ b/app/models/course_role.rb @@ -15,7 +15,7 @@ # Represents the role a user has with respect to a course offering in which # the user is enrolled. Roles are stored in the CourseEnrollment relationship. # -class CourseRole < ActiveRecord::Base +class CourseRole < ApplicationRecord #~ Validation ............................................................... diff --git a/app/models/error.rb b/app/models/error.rb index 097fa9ea..89d9d96d 100644 --- a/app/models/error.rb +++ b/app/models/error.rb @@ -26,6 +26,6 @@ # This model class is here purely so that run-time errors can be tracked # in the database for development/debugging purposes. # -class Error < ActiveRecord::Base -# belongs_to :usable, polymorphic: true -end +class Error < ApplicationRecord +# belongs_to :usable, polymorphic: true +end diff --git a/app/models/exercise.rb b/app/models/exercise.rb index 6c2781c1..bc918841 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -44,7 +44,7 @@ # in effect when they gave their answer. New users seeing an exercise # for the first time always see the newest version. # -class Exercise < ActiveRecord::Base +class Exercise < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/exercise_collection.rb b/app/models/exercise_collection.rb index e96de586..6d44e211 100644 --- a/app/models/exercise_collection.rb +++ b/app/models/exercise_collection.rb @@ -20,7 +20,7 @@ # index_exercise_collections_on_user_id (user_id) # -class ExerciseCollection < ActiveRecord::Base +class ExerciseCollection < ApplicationRecord belongs_to :user_group, inverse_of: :exercise_collection belongs_to :user belongs_to :license diff --git a/app/models/exercise_family.rb b/app/models/exercise_family.rb index 503e0a77..28467d15 100644 --- a/app/models/exercise_family.rb +++ b/app/models/exercise_family.rb @@ -21,7 +21,7 @@ # reflect the "closely related" nature of these variants of the same # question--they are different Exercises, but in the same family. # -class ExerciseFamily < ActiveRecord::Base +class ExerciseFamily < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/exercise_owner.rb b/app/models/exercise_owner.rb index 4e58284b..f846e6b5 100644 --- a/app/models/exercise_owner.rb +++ b/app/models/exercise_owner.rb @@ -18,7 +18,7 @@ # purpose of managing editing access to exercises, particularly "private" # exercises that are not publicly available in the gym. # -class ExerciseOwner < ActiveRecord::Base +class ExerciseOwner < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/exercise_version.rb b/app/models/exercise_version.rb index 3a09b64c..c439b699 100644 --- a/app/models/exercise_version.rb +++ b/app/models/exercise_version.rb @@ -26,7 +26,7 @@ # Represents one version of an exercise--a single snapshot in the exercise's # entire edit history. # -class ExerciseVersion < ActiveRecord::Base +class ExerciseVersion < ApplicationRecord #~ Accessor attr_accessor :answer_code diff --git a/app/models/exercise_workout.rb b/app/models/exercise_workout.rb index 5fcc5dd1..c65e313d 100644 --- a/app/models/exercise_workout.rb +++ b/app/models/exercise_workout.rb @@ -21,7 +21,7 @@ # indicating which exercises are included in a given workout, and in # what order. The order is determined by "position", which starts at 1. # -class ExerciseWorkout < ActiveRecord::Base +class ExerciseWorkout < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/global_role.rb b/app/models/global_role.rb index 0f62f54b..b459040b 100644 --- a/app/models/global_role.rb +++ b/app/models/global_role.rb @@ -13,7 +13,7 @@ # Represents a user's global permissions on the system. This has now # degenerated into what ammounts to a global "administrator" flag. # -class GlobalRole < ActiveRecord::Base +class GlobalRole < ApplicationRecord #~ Validation ............................................................... diff --git a/app/models/group_access_request.rb b/app/models/group_access_request.rb index f003105d..5c6806dd 100644 --- a/app/models/group_access_request.rb +++ b/app/models/group_access_request.rb @@ -16,7 +16,7 @@ # index_group_access_requests_on_user_id (user_id) # -class GroupAccessRequest < ActiveRecord::Base +class GroupAccessRequest < ApplicationRecord belongs_to :user belongs_to :user_group end diff --git a/app/models/identity.rb b/app/models/identity.rb index c5a7876c..df75d4d8 100644 --- a/app/models/identity.rb +++ b/app/models/identity.rb @@ -20,7 +20,7 @@ # authentication provider. A single user object may be associated with # multiple identities, each from a separate provider. # -class Identity < ActiveRecord::Base +class Identity < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/irt_data.rb b/app/models/irt_data.rb index 02674409..728123be 100644 --- a/app/models/irt_data.rb +++ b/app/models/irt_data.rb @@ -12,7 +12,7 @@ # ============================================================================= # Represents IRT data used for calculating exercise performance. # -class IRTData < ActiveRecord::Base +class IRTData < ApplicationRecord #~ Validation ............................................................... diff --git a/app/models/license.rb b/app/models/license.rb index 0efc6bf9..49cf0138 100644 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -15,7 +15,7 @@ # index_licenses_on_license_policy_id (license_policy_id) # -class License < ActiveRecord::Base +class License < ApplicationRecord belongs_to :license_policy, inverse_of: :licenses has_many :exercise_collections end diff --git a/app/models/license_policy.rb b/app/models/license_policy.rb index af9b4e4d..423e759c 100644 --- a/app/models/license_policy.rb +++ b/app/models/license_policy.rb @@ -11,7 +11,7 @@ # updated_at :datetime # -class LicensePolicy < ActiveRecord::Base +class LicensePolicy < ApplicationRecord has_many :licenses, inverse_of: :license_policy accepts_nested_attributes_for :licenses end diff --git a/app/models/lms_instance.rb b/app/models/lms_instance.rb index 97b37eb2..3bfedae8 100644 --- a/app/models/lms_instance.rb +++ b/app/models/lms_instance.rb @@ -18,7 +18,7 @@ # lms_instances_lms_type_id_fk (lms_type_id) # -class LmsInstance < ActiveRecord::Base +class LmsInstance < ApplicationRecord belongs_to :lms_type, inverse_of: :lms_instances belongs_to :organization has_many :course_offerings, inverse_of: :lms_instance diff --git a/app/models/lms_type.rb b/app/models/lms_type.rb index 37313aaa..a58cab7d 100644 --- a/app/models/lms_type.rb +++ b/app/models/lms_type.rb @@ -12,7 +12,7 @@ # index_lms_types_on_name (name) UNIQUE # -class LmsType < ActiveRecord::Base +class LmsType < ApplicationRecord #~ Relationships ............................................................ has_many :lms_instances, inverse_of: :lms_types diff --git a/app/models/lti_identity.rb b/app/models/lti_identity.rb index b3927764..249d24c6 100644 --- a/app/models/lti_identity.rb +++ b/app/models/lti_identity.rb @@ -15,7 +15,7 @@ # index_lti_identities_on_user_id (user_id) # -class LtiIdentity < ActiveRecord::Base +class LtiIdentity < ApplicationRecord belongs_to :user belongs_to :lms_instance end diff --git a/app/models/lti_workout.rb b/app/models/lti_workout.rb index 925dae9a..e69c652a 100644 --- a/app/models/lti_workout.rb +++ b/app/models/lti_workout.rb @@ -15,7 +15,7 @@ # index_lti_workouts_on_workout_id (workout_id) # -class LtiWorkout < ActiveRecord::Base +class LtiWorkout < ApplicationRecord belongs_to :workout belongs_to :lms_instance has_many :workout_scores diff --git a/app/models/membership.rb b/app/models/membership.rb index 22cf5a10..124d7807 100644 --- a/app/models/membership.rb +++ b/app/models/membership.rb @@ -9,7 +9,7 @@ # updated_at :datetime # -class Membership < ActiveRecord::Base +class Membership < ApplicationRecord belongs_to :user belongs_to :user_group end diff --git a/app/models/multiple_choice_prompt.rb b/app/models/multiple_choice_prompt.rb index b7703e7d..9d7f95e7 100644 --- a/app/models/multiple_choice_prompt.rb +++ b/app/models/multiple_choice_prompt.rb @@ -18,7 +18,7 @@ # One multiple-choice prompt includes one or more choices, which are # represented at different objects. # -class MultipleChoicePrompt < ActiveRecord::Base +class MultipleChoicePrompt < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/multiple_choice_prompt_answer.rb b/app/models/multiple_choice_prompt_answer.rb index 9245cf87..e615f276 100644 --- a/app/models/multiple_choice_prompt_answer.rb +++ b/app/models/multiple_choice_prompt_answer.rb @@ -11,7 +11,7 @@ # PromptAnswer via acts_as (see the documentation on-line for the # activerecord-acts_as gem). # -class MultipleChoicePromptAnswer < ActiveRecord::Base +class MultipleChoicePromptAnswer < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/organization.rb b/app/models/organization.rb index bff8e4c0..ead3ba37 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -19,7 +19,7 @@ # Represents a university, college, school, or other organization that # has courses. # -class Organization < ActiveRecord::Base +class Organization < ApplicationRecord extend FriendlyId friendly_id :abbreviation, use: :history diff --git a/app/models/prompt.rb b/app/models/prompt.rb index 4af65fe8..3c96a380 100644 --- a/app/models/prompt.rb +++ b/app/models/prompt.rb @@ -42,7 +42,7 @@ # # Prompts are ordered by "position", which starts at 1. # -class Prompt < ActiveRecord::Base +class Prompt < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/prompt_answer.rb b/app/models/prompt_answer.rb index dd156d70..84eb9e92 100644 --- a/app/models/prompt_answer.rb +++ b/app/models/prompt_answer.rb @@ -30,7 +30,7 @@ # A prompt answer represents a user's answer for one prompt in one attempt # at an exercise. # -class PromptAnswer < ActiveRecord::Base +class PromptAnswer < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/resource_file.rb b/app/models/resource_file.rb index b4f5240f..70038dd4 100644 --- a/app/models/resource_file.rb +++ b/app/models/resource_file.rb @@ -20,7 +20,7 @@ # Represents a file uploaded by a user for use in exercises, such as an # image or video file. # -class ResourceFile < ActiveRecord::Base +class ResourceFile < ApplicationRecord include Tokenable #for unique non-serial url tokens diff --git a/app/models/stem.rb b/app/models/stem.rb index e2d29e95..9fffc26e 100644 --- a/app/models/stem.rb +++ b/app/models/stem.rb @@ -26,7 +26,7 @@ # ExerciseVersions on the same edit history for one exercise may refer # to the same stem, if the stem was not edited. # -class Stem < ActiveRecord::Base +class Stem < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/student_extension.rb b/app/models/student_extension.rb index e88352f8..72cd1c1d 100644 --- a/app/models/student_extension.rb +++ b/app/models/student_extension.rb @@ -18,7 +18,7 @@ # index_student_extensions_on_workout_offering_id (workout_offering_id) # -class StudentExtension < ActiveRecord::Base +class StudentExtension < ApplicationRecord belongs_to :user belongs_to :workout_offering diff --git a/app/models/tag_user_score.rb b/app/models/tag_user_score.rb index cf9c2f8f..4f401832 100644 --- a/app/models/tag_user_score.rb +++ b/app/models/tag_user_score.rb @@ -17,7 +17,7 @@ # ============================================================================= # Represents a user's xp score for a given tag. # -class TagUserScore < ActiveRecord::Base +class TagUserScore < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/term.rb b/app/models/term.rb index d6bbb5b5..828bb806 100644 --- a/app/models/term.rb +++ b/app/models/term.rb @@ -21,7 +21,7 @@ # Represents an academic term or semester, which indicates the time period # for one or more course offerings. # -class Term < ActiveRecord::Base +class Term < ApplicationRecord extend FriendlyId friendly_id :display_name, use: :history diff --git a/app/models/test_case.rb b/app/models/test_case.rb index a83f8a96..12ce18fa 100644 --- a/app/models/test_case.rb +++ b/app/models/test_case.rb @@ -31,7 +31,7 @@ # Represents a test case used to evaluate a student's answer to a coding # prompt. # -class TestCase < ActiveRecord::Base +class TestCase < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/test_case_result.rb b/app/models/test_case_result.rb index 877a1caf..3669e1b6 100644 --- a/app/models/test_case_result.rb +++ b/app/models/test_case_result.rb @@ -22,7 +22,7 @@ # ============================================================================= # Represents the outcome of a test case on a coding prompt. # -class TestCaseResult < ActiveRecord::Base +class TestCaseResult < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/time_zone.rb b/app/models/time_zone.rb index 34f20067..3fccef29 100644 --- a/app/models/time_zone.rb +++ b/app/models/time_zone.rb @@ -10,7 +10,7 @@ # updated_at :datetime # -class TimeZone < ActiveRecord::Base +class TimeZone < ApplicationRecord has_many :users def to_s return display_as diff --git a/app/models/user.rb b/app/models/user.rb index 4135a9bf..4785fcea 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -40,7 +40,7 @@ # ============================================================================= # Represents a single user account on the system. # -class User < ActiveRecord::Base +class User < ApplicationRecord include Gravtastic gravtastic secure: true, default: 'monsterid' diff --git a/app/models/user_group.rb b/app/models/user_group.rb index 4c10e95a..55e307e2 100644 --- a/app/models/user_group.rb +++ b/app/models/user_group.rb @@ -9,7 +9,7 @@ # description :text(65535) # -class UserGroup < ActiveRecord::Base +class UserGroup < ApplicationRecord has_many :memberships has_many :users, through: :memberships has_many :group_access_requests, inverse_of: :user_group diff --git a/app/models/visualization_logging.rb b/app/models/visualization_logging.rb index 99b34151..ff0fd415 100644 --- a/app/models/visualization_logging.rb +++ b/app/models/visualization_logging.rb @@ -18,7 +18,7 @@ # index_visualization_loggings_on_workout_offering_id (workout_offering_id) # -class VisualizationLogging < ActiveRecord::Base +class VisualizationLogging < ApplicationRecord belongs_to :user belongs_to :exercise belongs_to :workout diff --git a/app/models/workout.rb b/app/models/workout.rb index 973ea794..c3cd173e 100644 --- a/app/models/workout.rb +++ b/app/models/workout.rb @@ -35,7 +35,7 @@ # the "courses" associated with a workout are those for which course # offerings have been given workout offerings. # -class Workout < ActiveRecord::Base +class Workout < ApplicationRecord #~ Relationships ............................................................ acts_as_taggable_on :tags, :languages, :styles diff --git a/app/models/workout_offering.rb b/app/models/workout_offering.rb index 407bbb72..d6492ba5 100644 --- a/app/models/workout_offering.rb +++ b/app/models/workout_offering.rb @@ -35,7 +35,7 @@ # due dates that control when the students in the corresponding course # offering can take the workout (and thus, when they must complete it). # -class WorkoutOffering < ActiveRecord::Base +class WorkoutOffering < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/workout_owner.rb b/app/models/workout_owner.rb index 084c0a41..671b6cbb 100644 --- a/app/models/workout_owner.rb +++ b/app/models/workout_owner.rb @@ -18,7 +18,7 @@ # purpose of managing editing access to workouts, particularly "private" # workouts that are not publicly available in the gym. # -class WorkoutOwner < ActiveRecord::Base +class WorkoutOwner < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/workout_policy.rb b/app/models/workout_policy.rb index d8a45ad4..3555b0a6 100644 --- a/app/models/workout_policy.rb +++ b/app/models/workout_policy.rb @@ -18,6 +18,6 @@ # description :string(255) # -class WorkoutPolicy < ActiveRecord::Base +class WorkoutPolicy < ApplicationRecord has_many :workout_offerings, inverse_of: :workout_policy, dependent: :nullify end diff --git a/app/models/workout_score.rb b/app/models/workout_score.rb index 306cdfbc..c7aefafd 100644 --- a/app/models/workout_score.rb +++ b/app/models/workout_score.rb @@ -69,7 +69,7 @@ # offering, meaning a second workout offering of the same workout). # We want to support all of these situations. # -class WorkoutScore < ActiveRecord::Base +class WorkoutScore < ApplicationRecord #~ Relationships ............................................................ From 705d76eb3a32f007927c09128b478d11df6e36e1 Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Thu, 22 Oct 2020 03:41:43 -0400 Subject: [PATCH 19/53] update jobs Signed-off-by: Alex Hicks --- app/jobs/application_job.rb | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 app/jobs/application_job.rb diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 00000000..a009ace5 --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end From aa1e2920d9a4583f725f946bdfcf782cd48454df Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Thu, 22 Oct 2020 03:42:03 -0400 Subject: [PATCH 20/53] update migrations Signed-off-by: Alex Hicks --- db/migrate/20130912181453_create_organizations.rb | 2 +- db/migrate/20130912182541_create_courses.rb | 2 +- db/migrate/20130912200825_create_terms.rb | 2 +- db/migrate/20130912202622_create_course_offerings.rb | 2 +- db/migrate/20130913163500_devise_create_users.rb | 2 +- db/migrate/20130915012131_create_course_roles.rb | 2 +- db/migrate/20130915030206_create_course_enrollments.rb | 2 +- db/migrate/20130915044012_create_tags.rb | 2 +- db/migrate/20130915050202_create_prompts.rb | 2 +- db/migrate/20130915055146_create_choices.rb | 2 +- db/migrate/20130915203004_create_languages.rb | 2 +- db/migrate/20130916142010_create_global_roles.rb | 2 +- db/migrate/20130916203844_add_initial_columns_to_users.rb | 2 +- db/migrate/20130918174151_create_stems.rb | 2 +- db/migrate/20130918190714_create_exercises.rb | 2 +- .../20130923164556_rename_exercises_type_to_question_type.rb | 2 +- db/migrate/20131001051705_create_experience_column.rb | 2 +- db/migrate/20131003025313_create_attempts.rb | 2 +- db/migrate/20131009161911_add_tagtype_to_tags.rb | 2 +- db/migrate/20131010184442_change_tags_in_exercise.rb | 2 +- ...1170027_create_total_exercise_and_total_experience_in_tag.rb | 2 +- db/migrate/20131015080408_create_tag_user_scores.rb | 2 +- db/migrate/20131015083558_rename_tag_name.rb | 2 +- ...20131015151339_add_completed_exercises_to_tag_user_scores.rb | 2 +- db/migrate/20131016023405_change_language_to_tags.rb | 2 +- db/migrate/20131016154908_create_workouts.rb | 2 +- db/migrate/20131016175805_create_tags_workouts.rb | 2 +- ...131119032619_rename_workouts_exercises_exercises_workouts.rb | 2 +- db/migrate/20131210061217_add_coding_exercise_columns.rb | 2 +- db/migrate/20140422205525_update_exercise.rb | 2 +- db/migrate/20140428202518_create_resource_files.rb | 2 +- db/migrate/20141019133633_add_name_to_users.rb | 2 +- db/migrate/20141019134233_create_identities.rb | 2 +- db/migrate/20141019235246_add_name_to_workouts.rb | 2 +- db/migrate/20141019235449_add_target_group_to_workouts.rb | 2 +- db/migrate/20141019235637_add_points_multiplier_to_workouts.rb | 2 +- db/migrate/20141019235708_add_opening_date_to_workouts.rb | 2 +- db/migrate/20141019235750_add_soft_deadline_to_workouts.rb | 2 +- db/migrate/20141019235803_add_hard_deadline_to_workouts.rb | 2 +- ...0141102232155_create_join_table_course_offerings_workouts.rb | 2 +- db/migrate/20141109193127_create_workout_offerings.rb | 2 +- db/migrate/20141109193909_add_deadlines_to_workout_offering.rb | 2 +- db/migrate/20141109202442_create_exercise_workouts.rb | 2 +- .../20141109204133_fix_order_column_in_exercise_workouts.rb | 2 +- db/migrate/20141110010213_remove_deadlines_from_workouts.rb | 2 +- db/migrate/20141110023518_create_course_exercises.rb | 2 +- db/migrate/20150111180500_create_base_exercises.rb | 2 +- db/migrate/20150111182242_add_base_exercise_id_to_exercise.rb | 2 +- db/migrate/20150111185855_add_version_to_exercise.rb | 2 +- .../20150111200649_remove_question_type_from_exercises.rb | 2 +- db/migrate/20150111204245_add_versions_to_base_exercises.rb | 2 +- db/migrate/20150111222945_remove_user_id_from_exercises.rb | 2 +- db/migrate/20150112141536_create_variation_groups.rb | 2 +- .../20150112143114_add_variation_group_id_to_base_exercise.rb | 2 +- db/migrate/20150117190855_create_workout_scores.rb | 2 +- db/migrate/20150201192746_remove_starter_code_from_exercise.rb | 2 +- db/migrate/20150201224732_create_coding_questions.rb | 2 +- .../20150201230342_remove_columns_from_coding_question.rb | 2 +- .../20150201230748_remove_columns_from_coding_question_2.rb | 2 +- db/migrate/20150201231050_add_columns_to_coding_questions.rb | 2 +- db/migrate/20150201234250_add_feedback_to_coding_question.rb | 2 +- .../20150201234351_remove_feedback_from_coding_question.rb | 2 +- db/migrate/20150201235152_create_test_case_results.rb | 2 +- db/migrate/20150205220518_rectify_test_case_result.rb | 2 +- db/migrate/20150205220837_rectify_test_case_result2.rb | 2 +- db/migrate/20150205221653_change_score_in_attempts.rb | 2 +- ...20150207221009_add_default_to_points_in_exercise_workouts.rb | 2 +- db/migrate/20150210001815_create_test_cases.rb | 2 +- .../20150210012044_add_test_method_to_coding_questions.rb | 2 +- db/migrate/20150218220059_fix_class_name_in_coding_questions.rb | 2 +- .../20150218220317_add_starter_code_to_coding_questions.rb | 2 +- .../20150219054901_fix_method_name_in_coding_questions.rb | 2 +- db/migrate/20150312175933_add_creator_id_to_courses.rb | 2 +- db/migrate/20150312183927_add_creator_id_to_exercises.rb | 2 +- db/migrate/20150312184040_add_creator_id_to_base_exercises.rb | 2 +- db/migrate/20150312184111_add_creator_id_to_workouts.rb | 2 +- .../20150312184659_remove_creator_id_from_base_exercises.rb | 2 +- db/migrate/20150320002742_add_omniauth_columns_to_users.rb | 2 +- db/migrate/20150324135215_remove_omniauth_columns_from_users.rb | 2 +- db/migrate/20150325143018_add_avatar_to_users.rb | 2 +- ...e_current_version_to_current_version_id_in_base_exercises.rb | 2 +- db/migrate/20150326123644_add_null_constraints_and_indices.rb | 2 +- db/migrate/20150326163802_add_foreign_key_constraints.rb | 2 +- .../20150326173027_rename_title_to_name_in_variation_group.rb | 2 +- ...50326193058_rename_ordering_to_order_in_exercise_workouts.rb | 2 +- db/migrate/20150326193301_rename_title_to_name_in_exercises.rb | 2 +- db/migrate/20150327213048_create_active_admin_comments.rb | 2 +- ...150328005919_rename_display_name_to_name_in_organizations.rb | 2 +- db/migrate/20150328011131_remove_name_from_users.rb | 2 +- db/migrate/20150328150855_remove_name_from_course_offering.rb | 2 +- db/migrate/20150330194627_create_friendly_id_slugs.rb | 2 +- db/migrate/20150331032124_add_slug_to_term.rb | 2 +- db/migrate/20150331121739_add_slug_to_organization.rb | 2 +- db/migrate/20150402033335_add_slug_to_course.rb | 2 +- db/migrate/20150402043958_add_slug_to_user.rb | 2 +- .../20150429122658_rename_exercises_to_exercise_versions.rb | 2 +- db/migrate/20150429132614_rename_base_exercises_to_exercises.rb | 2 +- db/migrate/20150429135647_create_exercise_owners.rb | 2 +- .../20150429160335_rename_variation_group_to_exercise_family.rb | 2 +- db/migrate/20150429170252_remove_user_id_from_base_exercises.rb | 2 +- db/migrate/20150430165328_rename_for_acts_as_list.rb | 2 +- db/migrate/20150501192055_rename_prompt_features.rb | 2 +- .../20150502155416_rename_coding_question_in_test_cases.rb | 2 +- ...0502155552_move_choices_from_exercise_versions_to_prompts.rb | 2 +- ...2181403_move_features_from_exercise_versions_to_exercises.rb | 2 +- ...50502203324_move_tags_from_exercise_versions_to_exercises.rb | 2 +- db/migrate/20150502210227_add_stats_to_exercises.rb | 2 +- .../20150502210606_remove_question_from_exercise_versions.rb | 2 +- .../20150503003408_add_workout_offering_to_workout_score.rb | 2 +- db/migrate/20150503004546_add_to_attempt.rb | 2 +- db/migrate/20150503153952_create_workout_owners.rb | 2 +- db/migrate/20150503190401_fix_choice_answer.rb | 2 +- db/migrate/20150503232731_create_prompt_answer.rb | 2 +- db/migrate/20150504000235_create_coding_prompt_answer.rb | 2 +- .../20150504002111_create_multiple_choice_prompt_answer.rb | 2 +- db/migrate/20150504004247_create_irt_data.rb | 2 +- .../20150504051530_add_cutoff_date_to_course_offerings.rb | 2 +- db/migrate/20150506122722_create_attempts_tag_user_scores.rb | 2 +- db/migrate/20150506124650_remove_target_group_from_workouts.rb | 2 +- db/migrate/20150506161404_add.rb | 2 +- db/migrate/20150507004949_remove_is_scrambled_from_prompt.rb | 2 +- ...0447_remove_null_constraint_from_exercise_current_version.rb | 2 +- .../20150507143058_rename_prompt_to_question_in_prompts.rb | 2 +- db/migrate/20150507163037_remove_tags.rb | 2 +- ..._acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb | 2 +- ...240_add_missing_unique_indices.acts_as_taggable_on_engine.rb | 2 +- ...taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb | 2 +- ...242_add_missing_taggable_index.acts_as_taggable_on_engine.rb | 2 +- ...change_collation_for_tag_names.acts_as_taggable_on_engine.rb | 2 +- ...510144703_rename_position_to_version_in_exercise_versions.rb | 2 +- db/migrate/20150511225412_actable_ids_are_not_unique.rb | 2 +- db/migrate/20150515205710_revise_test_case_structure.rb | 2 +- ...150522205618_add_answer_to_multiple_choice_prompt_answers.rb | 2 +- ...5184958_remove_answer_from_multiple_choice_prompt_answers.rb | 2 +- db/migrate/20150528120715_add_error_to_coding_prompt_answer.rb | 2 +- .../20150531004056_change_class_name_to_string_in_errors.rb | 2 +- db/migrate/20150604011650_add_published_to_workout_offerings.rb | 2 +- ...0608001534_change_dates_to_datetimes_in_workout_offerings.rb | 2 +- db/migrate/20150912035415_create_time_zones.rb | 2 +- db/migrate/20150912200222_add_time_zone_id_to_users.rb | 2 +- db/migrate/20150916031620_add_current_workout_score_to_users.rb | 2 +- db/migrate/20150921113747_add_is_public_to_workouts.rb | 2 +- db/migrate/20150923144539_add_feedback_ready_to_attempts.rb | 2 +- db/migrate/20150927020504_create_student_extensions.rb | 2 +- .../20151015033713_add_time_limit_to_workout_offerings.rb | 2 +- db/migrate/20151015035823_create_workout_policy.rb | 2 +- .../20151015044326_add_time_limit_to_student_extensions.rb | 2 +- ...217060925_add_invisible_before_review_to_workout_policies.rb | 2 +- .../20160224064748_add_opening_date_to_student_extensions.rb | 2 +- ...5005739_add_continue_from_workout_id_to_workout_offerings.rb | 2 +- db/migrate/20160512005525_add_keys.rb | 2 +- db/migrate/20160525210736_add_lis_info_to_workout_score.rb | 2 +- db/migrate/20160602163822_create_lms_instances.rb | 2 +- db/migrate/20160602181823_add_url_to_lms_instance.rb | 2 +- db/migrate/20160602182001_create_lms_types.rb | 2 +- db/migrate/20160602182220_add_lms_type_id_to_lms_instance.rb | 2 +- .../20160602185259_add_lms_instance_to_course_offering.rb | 2 +- .../20160614153123_add_organization_ref_to_lms_instances.rb | 2 +- ...20160706143029_add_lms_assignment_id_to_workout_offerings.rb | 2 +- ...0160707200651_make_workout_offerings_published_by_default.rb | 2 +- .../20160829140059_add_description_to_workout_policies.rb | 2 +- .../20161129200944_add_most_recent_to_workout_offerings.rb | 2 +- db/migrate/20170314235543_create_lti_identities.rb | 2 +- ...170411130659_add_example_hidden_static_ao_n_to_test_cases.rb | 2 +- ...0170420144021_add_text_representation_to_exercise_version.rb | 2 +- ...0170427154810_add_lms_assignment_url_to_workout_offerings.rb | 2 +- ...430212102_rename_all_or_nothing_to_screening_in_test_case.rb | 2 +- db/migrate/20170502163350_create_license_policies.rb | 2 +- db/migrate/20170502163602_create_licenses.rb | 2 +- db/migrate/20170502165648_create_user_groups.rb | 2 +- db/migrate/20170502165837_create_exercise_collections.rb | 2 +- .../20170502171412_add_exercise_collection_to_exercises.rb | 2 +- db/migrate/20170502204756_create_memberships.rb | 2 +- db/migrate/20170503154537_add_user_to_exercise_collection.rb | 2 +- db/migrate/20170509003343_add_hide_examples_to_coding_prompt.rb | 2 +- db/migrate/20170518161546_add_user_group_to_course.rb | 2 +- ...20170518161825_add_course_offering_to_exercise_collection.rb | 2 +- db/migrate/20170530210400_add_description_to_user_groups.rb | 2 +- db/migrate/20170531150805_create_group_access_requests.rb | 2 +- .../20170810205035_add_feedback_line_to_test_case_results.rb | 2 +- db/migrate/20170830160216_add_is_hidden_to_course.rb | 2 +- db/migrate/20170830164617_add_is_hidden_to_organization.rb | 2 +- ...837_remove_lms_assignment_id_index_from_workout_offerings.rb | 2 +- db/migrate/20180718193136_create_visualization_loggings.rb | 2 +- .../20190131151757_add_attempt_limit_to_workout_offerings.rb | 2 +- db/migrate/20190416161435_add_feedback_times_to_attempt.rb | 2 +- db/migrate/20190422155326_create_lti_workouts.rb | 2 +- .../20190712171251_tie_workout_scores_with_lms_instance.rb | 2 +- 188 files changed, 188 insertions(+), 188 deletions(-) diff --git a/db/migrate/20130912181453_create_organizations.rb b/db/migrate/20130912181453_create_organizations.rb index 2d996b8f..e3d360e9 100644 --- a/db/migrate/20130912181453_create_organizations.rb +++ b/db/migrate/20130912181453_create_organizations.rb @@ -1,4 +1,4 @@ -class CreateOrganizations < ActiveRecord::Migration +class CreateOrganizations < ActiveRecord::Migration[5.1] def change create_table :organizations do |t| t.string :display_name, null: false diff --git a/db/migrate/20130912182541_create_courses.rb b/db/migrate/20130912182541_create_courses.rb index 1ccdf7de..534d82ba 100644 --- a/db/migrate/20130912182541_create_courses.rb +++ b/db/migrate/20130912182541_create_courses.rb @@ -1,4 +1,4 @@ -class CreateCourses < ActiveRecord::Migration +class CreateCourses < ActiveRecord::Migration[5.1] def change create_table :courses do |t| t.string :name, null: false diff --git a/db/migrate/20130912200825_create_terms.rb b/db/migrate/20130912200825_create_terms.rb index 086e72e9..ab4e6c4b 100644 --- a/db/migrate/20130912200825_create_terms.rb +++ b/db/migrate/20130912200825_create_terms.rb @@ -1,4 +1,4 @@ -class CreateTerms < ActiveRecord::Migration +class CreateTerms < ActiveRecord::Migration[5.1] def change create_table :terms do |t| t.integer :season, null: false diff --git a/db/migrate/20130912202622_create_course_offerings.rb b/db/migrate/20130912202622_create_course_offerings.rb index a9426eb5..1d60bd5b 100644 --- a/db/migrate/20130912202622_create_course_offerings.rb +++ b/db/migrate/20130912202622_create_course_offerings.rb @@ -1,4 +1,4 @@ -class CreateCourseOfferings < ActiveRecord::Migration +class CreateCourseOfferings < ActiveRecord::Migration[5.1] def change create_table :course_offerings do |t| t.references :course, null: false, index: true diff --git a/db/migrate/20130913163500_devise_create_users.rb b/db/migrate/20130913163500_devise_create_users.rb index 79016fd7..bd168ece 100644 --- a/db/migrate/20130913163500_devise_create_users.rb +++ b/db/migrate/20130913163500_devise_create_users.rb @@ -1,4 +1,4 @@ -class DeviseCreateUsers < ActiveRecord::Migration +class DeviseCreateUsers < ActiveRecord::Migration[5.1] def change create_table(:users) do |t| ## Database authenticatable diff --git a/db/migrate/20130915012131_create_course_roles.rb b/db/migrate/20130915012131_create_course_roles.rb index 344e3089..06491e3c 100644 --- a/db/migrate/20130915012131_create_course_roles.rb +++ b/db/migrate/20130915012131_create_course_roles.rb @@ -1,4 +1,4 @@ -class CreateCourseRoles < ActiveRecord::Migration +class CreateCourseRoles < ActiveRecord::Migration[5.1] def change create_table :course_roles do |t| t.string :name, :unique => true, :null => false diff --git a/db/migrate/20130915030206_create_course_enrollments.rb b/db/migrate/20130915030206_create_course_enrollments.rb index 9e3d36e6..66a4ebf7 100644 --- a/db/migrate/20130915030206_create_course_enrollments.rb +++ b/db/migrate/20130915030206_create_course_enrollments.rb @@ -1,4 +1,4 @@ -class CreateCourseEnrollments < ActiveRecord::Migration +class CreateCourseEnrollments < ActiveRecord::Migration[5.1] def change create_table :course_enrollments do |t| t.references :user, index: true diff --git a/db/migrate/20130915044012_create_tags.rb b/db/migrate/20130915044012_create_tags.rb index c78a2612..02b039de 100644 --- a/db/migrate/20130915044012_create_tags.rb +++ b/db/migrate/20130915044012_create_tags.rb @@ -1,4 +1,4 @@ -class CreateTags < ActiveRecord::Migration +class CreateTags < ActiveRecord::Migration[5.1] def change create_table :tags do |t| t.string :name, null: false diff --git a/db/migrate/20130915050202_create_prompts.rb b/db/migrate/20130915050202_create_prompts.rb index e95edb36..dce6569a 100644 --- a/db/migrate/20130915050202_create_prompts.rb +++ b/db/migrate/20130915050202_create_prompts.rb @@ -1,4 +1,4 @@ -class CreatePrompts < ActiveRecord::Migration +class CreatePrompts < ActiveRecord::Migration[5.1] def change create_table :prompts do |t| t.belongs_to :exercise, index: true, null: false diff --git a/db/migrate/20130915055146_create_choices.rb b/db/migrate/20130915055146_create_choices.rb index f9040bac..2a7c879e 100644 --- a/db/migrate/20130915055146_create_choices.rb +++ b/db/migrate/20130915055146_create_choices.rb @@ -1,4 +1,4 @@ -class CreateChoices < ActiveRecord::Migration +class CreateChoices < ActiveRecord::Migration[5.1] def change create_table :choices do |t| t.belongs_to :exercise, index: true, null: false diff --git a/db/migrate/20130915203004_create_languages.rb b/db/migrate/20130915203004_create_languages.rb index a1c86bc3..5932a16e 100644 --- a/db/migrate/20130915203004_create_languages.rb +++ b/db/migrate/20130915203004_create_languages.rb @@ -1,4 +1,4 @@ -class CreateLanguages < ActiveRecord::Migration +class CreateLanguages < ActiveRecord::Migration[5.1] def change create_table :languages do |t| t.string :name diff --git a/db/migrate/20130916142010_create_global_roles.rb b/db/migrate/20130916142010_create_global_roles.rb index 40c1c048..bac93896 100644 --- a/db/migrate/20130916142010_create_global_roles.rb +++ b/db/migrate/20130916142010_create_global_roles.rb @@ -1,4 +1,4 @@ -class CreateGlobalRoles < ActiveRecord::Migration +class CreateGlobalRoles < ActiveRecord::Migration[5.1] def change create_table :global_roles do |t| t.string :name, :unique => true, :null => false diff --git a/db/migrate/20130916203844_add_initial_columns_to_users.rb b/db/migrate/20130916203844_add_initial_columns_to_users.rb index 2451bd65..75fba1e8 100644 --- a/db/migrate/20130916203844_add_initial_columns_to_users.rb +++ b/db/migrate/20130916203844_add_initial_columns_to_users.rb @@ -1,4 +1,4 @@ -class AddInitialColumnsToUsers < ActiveRecord::Migration +class AddInitialColumnsToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :first_name, :string, index: true add_column :users, :last_name, :string, index: true diff --git a/db/migrate/20130918174151_create_stems.rb b/db/migrate/20130918174151_create_stems.rb index 0cf1e531..d9960e27 100644 --- a/db/migrate/20130918174151_create_stems.rb +++ b/db/migrate/20130918174151_create_stems.rb @@ -1,4 +1,4 @@ -class CreateStems < ActiveRecord::Migration +class CreateStems < ActiveRecord::Migration[5.1] def change create_table :stems do |t| t.text :preamble diff --git a/db/migrate/20130918190714_create_exercises.rb b/db/migrate/20130918190714_create_exercises.rb index 61cc00df..eee1528b 100644 --- a/db/migrate/20130918190714_create_exercises.rb +++ b/db/migrate/20130918190714_create_exercises.rb @@ -1,4 +1,4 @@ -class CreateExercises < ActiveRecord::Migration +class CreateExercises < ActiveRecord::Migration[5.1] def change create_table :exercises do |t| t.belongs_to :user, index: true, null: false diff --git a/db/migrate/20130923164556_rename_exercises_type_to_question_type.rb b/db/migrate/20130923164556_rename_exercises_type_to_question_type.rb index 13c464b4..b23220b0 100644 --- a/db/migrate/20130923164556_rename_exercises_type_to_question_type.rb +++ b/db/migrate/20130923164556_rename_exercises_type_to_question_type.rb @@ -1,4 +1,4 @@ -class RenameExercisesTypeToQuestionType < ActiveRecord::Migration +class RenameExercisesTypeToQuestionType < ActiveRecord::Migration[5.1] def change #create_table :exercises do |t| # t.belongs_to :user, index: true, null: false diff --git a/db/migrate/20131001051705_create_experience_column.rb b/db/migrate/20131001051705_create_experience_column.rb index d9df1e22..499f1ee3 100644 --- a/db/migrate/20131001051705_create_experience_column.rb +++ b/db/migrate/20131001051705_create_experience_column.rb @@ -1,4 +1,4 @@ -class CreateExperienceColumn < ActiveRecord::Migration +class CreateExperienceColumn < ActiveRecord::Migration[5.1] def change add_column :exercises, :experience, :integer end diff --git a/db/migrate/20131003025313_create_attempts.rb b/db/migrate/20131003025313_create_attempts.rb index dd909f85..f8e17b47 100644 --- a/db/migrate/20131003025313_create_attempts.rb +++ b/db/migrate/20131003025313_create_attempts.rb @@ -1,4 +1,4 @@ -class CreateAttempts < ActiveRecord::Migration +class CreateAttempts < ActiveRecord::Migration[5.1] def change create_table :attempts do |t| t.belongs_to :user, index: true, null: false diff --git a/db/migrate/20131009161911_add_tagtype_to_tags.rb b/db/migrate/20131009161911_add_tagtype_to_tags.rb index f16e3195..a6989f4b 100644 --- a/db/migrate/20131009161911_add_tagtype_to_tags.rb +++ b/db/migrate/20131009161911_add_tagtype_to_tags.rb @@ -1,4 +1,4 @@ -class AddTagtypeToTags < ActiveRecord::Migration +class AddTagtypeToTags < ActiveRecord::Migration[5.1] def change add_column :tags, :tagtype, :integer, :default => 0 end diff --git a/db/migrate/20131010184442_change_tags_in_exercise.rb b/db/migrate/20131010184442_change_tags_in_exercise.rb index 9d18d55f..72d95623 100644 --- a/db/migrate/20131010184442_change_tags_in_exercise.rb +++ b/db/migrate/20131010184442_change_tags_in_exercise.rb @@ -1,4 +1,4 @@ -class ChangeTagsInExercise < ActiveRecord::Migration +class ChangeTagsInExercise < ActiveRecord::Migration[5.1] def change remove_column :exercises, :language, :belongs_to #language now represented as a tag with tagtype=2 end diff --git a/db/migrate/20131011170027_create_total_exercise_and_total_experience_in_tag.rb b/db/migrate/20131011170027_create_total_exercise_and_total_experience_in_tag.rb index 88b8677c..19be0288 100644 --- a/db/migrate/20131011170027_create_total_exercise_and_total_experience_in_tag.rb +++ b/db/migrate/20131011170027_create_total_exercise_and_total_experience_in_tag.rb @@ -1,4 +1,4 @@ -class CreateTotalExerciseAndTotalExperienceInTag < ActiveRecord::Migration +class CreateTotalExerciseAndTotalExperienceInTag < ActiveRecord::Migration[5.1] def change add_column :tags, :total_exercises, :integer, :default => 0 add_column :tags, :total_experience, :integer, :default => 0 diff --git a/db/migrate/20131015080408_create_tag_user_scores.rb b/db/migrate/20131015080408_create_tag_user_scores.rb index b4350a29..81a3fd87 100644 --- a/db/migrate/20131015080408_create_tag_user_scores.rb +++ b/db/migrate/20131015080408_create_tag_user_scores.rb @@ -1,4 +1,4 @@ -class CreateTagUserScores < ActiveRecord::Migration +class CreateTagUserScores < ActiveRecord::Migration[5.1] def change create_table :tag_user_scores do |t| t.belongs_to :user, index: true, null: false diff --git a/db/migrate/20131015083558_rename_tag_name.rb b/db/migrate/20131015083558_rename_tag_name.rb index 8d5ecd8a..86560ef7 100644 --- a/db/migrate/20131015083558_rename_tag_name.rb +++ b/db/migrate/20131015083558_rename_tag_name.rb @@ -1,4 +1,4 @@ -class RenameTagName < ActiveRecord::Migration +class RenameTagName < ActiveRecord::Migration[5.1] def change rename_column :tags, :name, :tag_name end diff --git a/db/migrate/20131015151339_add_completed_exercises_to_tag_user_scores.rb b/db/migrate/20131015151339_add_completed_exercises_to_tag_user_scores.rb index 394fa313..88713100 100644 --- a/db/migrate/20131015151339_add_completed_exercises_to_tag_user_scores.rb +++ b/db/migrate/20131015151339_add_completed_exercises_to_tag_user_scores.rb @@ -1,4 +1,4 @@ -class AddCompletedExercisesToTagUserScores < ActiveRecord::Migration +class AddCompletedExercisesToTagUserScores < ActiveRecord::Migration[5.1] def change add_column :tag_user_scores, :completed_exercises, :integer, :default => 0 end diff --git a/db/migrate/20131016023405_change_language_to_tags.rb b/db/migrate/20131016023405_change_language_to_tags.rb index 1ec72520..407fbeb8 100644 --- a/db/migrate/20131016023405_change_language_to_tags.rb +++ b/db/migrate/20131016023405_change_language_to_tags.rb @@ -1,4 +1,4 @@ -class ChangeLanguageToTags < ActiveRecord::Migration +class ChangeLanguageToTags < ActiveRecord::Migration[5.1] def change drop_table :languages remove_column :exercises, :language_id diff --git a/db/migrate/20131016154908_create_workouts.rb b/db/migrate/20131016154908_create_workouts.rb index 43477884..ab9af3c6 100644 --- a/db/migrate/20131016154908_create_workouts.rb +++ b/db/migrate/20131016154908_create_workouts.rb @@ -1,4 +1,4 @@ -class CreateWorkouts < ActiveRecord::Migration +class CreateWorkouts < ActiveRecord::Migration[5.1] def change create_table :workouts do |t| t.string :name, null: false diff --git a/db/migrate/20131016175805_create_tags_workouts.rb b/db/migrate/20131016175805_create_tags_workouts.rb index bce10d4d..ce7b5601 100644 --- a/db/migrate/20131016175805_create_tags_workouts.rb +++ b/db/migrate/20131016175805_create_tags_workouts.rb @@ -1,4 +1,4 @@ -class CreateTagsWorkouts < ActiveRecord::Migration +class CreateTagsWorkouts < ActiveRecord::Migration[5.1] def change create_table :tags_workouts do |t| t.belongs_to :tag, index: true diff --git a/db/migrate/20131119032619_rename_workouts_exercises_exercises_workouts.rb b/db/migrate/20131119032619_rename_workouts_exercises_exercises_workouts.rb index f4de4434..98709ae0 100644 --- a/db/migrate/20131119032619_rename_workouts_exercises_exercises_workouts.rb +++ b/db/migrate/20131119032619_rename_workouts_exercises_exercises_workouts.rb @@ -1,4 +1,4 @@ -class RenameWorkoutsExercisesExercisesWorkouts < ActiveRecord::Migration +class RenameWorkoutsExercisesExercisesWorkouts < ActiveRecord::Migration[5.1] def change rename_table :workouts_exercises, :exercises_workouts #add_index "exercises_workouts", ["exercise_id"], name: "index_exercises_workouts_on_exercise_id" diff --git a/db/migrate/20131210061217_add_coding_exercise_columns.rb b/db/migrate/20131210061217_add_coding_exercise_columns.rb index 6da782fc..2cc33558 100644 --- a/db/migrate/20131210061217_add_coding_exercise_columns.rb +++ b/db/migrate/20131210061217_add_coding_exercise_columns.rb @@ -1,4 +1,4 @@ -class AddCodingExerciseColumns < ActiveRecord::Migration +class AddCodingExerciseColumns < ActiveRecord::Migration[5.1] def change add_column :exercises, :starter_code, :text diff --git a/db/migrate/20140422205525_update_exercise.rb b/db/migrate/20140422205525_update_exercise.rb index 70dc740c..e96c0841 100644 --- a/db/migrate/20140422205525_update_exercise.rb +++ b/db/migrate/20140422205525_update_exercise.rb @@ -1,4 +1,4 @@ -class UpdateExercise < ActiveRecord::Migration +class UpdateExercise < ActiveRecord::Migration[5.1] def change #allow empty titles in database change_column_null(:exercises, :title, true) diff --git a/db/migrate/20140428202518_create_resource_files.rb b/db/migrate/20140428202518_create_resource_files.rb index 40294876..2c9c8ceb 100644 --- a/db/migrate/20140428202518_create_resource_files.rb +++ b/db/migrate/20140428202518_create_resource_files.rb @@ -1,4 +1,4 @@ -class CreateResourceFiles < ActiveRecord::Migration +class CreateResourceFiles < ActiveRecord::Migration[5.1] def change create_table :resource_files do |t| t.column :filename, :string diff --git a/db/migrate/20141019133633_add_name_to_users.rb b/db/migrate/20141019133633_add_name_to_users.rb index bac750eb..3c0d3cb0 100644 --- a/db/migrate/20141019133633_add_name_to_users.rb +++ b/db/migrate/20141019133633_add_name_to_users.rb @@ -1,4 +1,4 @@ -class AddNameToUsers < ActiveRecord::Migration +class AddNameToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :name, :string end diff --git a/db/migrate/20141019134233_create_identities.rb b/db/migrate/20141019134233_create_identities.rb index ea0b8ba8..8155c6d6 100644 --- a/db/migrate/20141019134233_create_identities.rb +++ b/db/migrate/20141019134233_create_identities.rb @@ -1,4 +1,4 @@ -class CreateIdentities < ActiveRecord::Migration +class CreateIdentities < ActiveRecord::Migration[5.1] def change create_table :identities do |t| t.references :user, index: true diff --git a/db/migrate/20141019235246_add_name_to_workouts.rb b/db/migrate/20141019235246_add_name_to_workouts.rb index b2a4c368..cc22e0ed 100644 --- a/db/migrate/20141019235246_add_name_to_workouts.rb +++ b/db/migrate/20141019235246_add_name_to_workouts.rb @@ -1,4 +1,4 @@ -class AddNameToWorkouts < ActiveRecord::Migration +class AddNameToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :description, :text end diff --git a/db/migrate/20141019235449_add_target_group_to_workouts.rb b/db/migrate/20141019235449_add_target_group_to_workouts.rb index ecf3d9f1..4b3d4dc7 100644 --- a/db/migrate/20141019235449_add_target_group_to_workouts.rb +++ b/db/migrate/20141019235449_add_target_group_to_workouts.rb @@ -1,4 +1,4 @@ -class AddTargetGroupToWorkouts < ActiveRecord::Migration +class AddTargetGroupToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :target_group, :string end diff --git a/db/migrate/20141019235637_add_points_multiplier_to_workouts.rb b/db/migrate/20141019235637_add_points_multiplier_to_workouts.rb index 82f44d13..83153800 100644 --- a/db/migrate/20141019235637_add_points_multiplier_to_workouts.rb +++ b/db/migrate/20141019235637_add_points_multiplier_to_workouts.rb @@ -1,4 +1,4 @@ -class AddPointsMultiplierToWorkouts < ActiveRecord::Migration +class AddPointsMultiplierToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :points_multiplier, :integer end diff --git a/db/migrate/20141019235708_add_opening_date_to_workouts.rb b/db/migrate/20141019235708_add_opening_date_to_workouts.rb index 05a14f7e..9b5e4615 100644 --- a/db/migrate/20141019235708_add_opening_date_to_workouts.rb +++ b/db/migrate/20141019235708_add_opening_date_to_workouts.rb @@ -1,4 +1,4 @@ -class AddOpeningDateToWorkouts < ActiveRecord::Migration +class AddOpeningDateToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :opening_date, :date end diff --git a/db/migrate/20141019235750_add_soft_deadline_to_workouts.rb b/db/migrate/20141019235750_add_soft_deadline_to_workouts.rb index a28484fd..73d0ac64 100644 --- a/db/migrate/20141019235750_add_soft_deadline_to_workouts.rb +++ b/db/migrate/20141019235750_add_soft_deadline_to_workouts.rb @@ -1,4 +1,4 @@ -class AddSoftDeadlineToWorkouts < ActiveRecord::Migration +class AddSoftDeadlineToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :soft_deadline, :date end diff --git a/db/migrate/20141019235803_add_hard_deadline_to_workouts.rb b/db/migrate/20141019235803_add_hard_deadline_to_workouts.rb index 64009884..c2841eb6 100644 --- a/db/migrate/20141019235803_add_hard_deadline_to_workouts.rb +++ b/db/migrate/20141019235803_add_hard_deadline_to_workouts.rb @@ -1,4 +1,4 @@ -class AddHardDeadlineToWorkouts < ActiveRecord::Migration +class AddHardDeadlineToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :hard_deadline, :date end diff --git a/db/migrate/20141102232155_create_join_table_course_offerings_workouts.rb b/db/migrate/20141102232155_create_join_table_course_offerings_workouts.rb index d8c6c79e..4d287941 100644 --- a/db/migrate/20141102232155_create_join_table_course_offerings_workouts.rb +++ b/db/migrate/20141102232155_create_join_table_course_offerings_workouts.rb @@ -1,4 +1,4 @@ -class CreateJoinTableCourseOfferingsWorkouts < ActiveRecord::Migration +class CreateJoinTableCourseOfferingsWorkouts < ActiveRecord::Migration[5.1] def change create_join_table :course_offerings, :workouts do |t| # t.index [:course_offering_id, :workout_id] diff --git a/db/migrate/20141109193127_create_workout_offerings.rb b/db/migrate/20141109193127_create_workout_offerings.rb index 005ea829..d7ca7ea1 100644 --- a/db/migrate/20141109193127_create_workout_offerings.rb +++ b/db/migrate/20141109193127_create_workout_offerings.rb @@ -1,4 +1,4 @@ -class CreateWorkoutOfferings < ActiveRecord::Migration +class CreateWorkoutOfferings < ActiveRecord::Migration[5.1] def change create_table :workout_offerings do |t| t.integer :course_offering_id diff --git a/db/migrate/20141109193909_add_deadlines_to_workout_offering.rb b/db/migrate/20141109193909_add_deadlines_to_workout_offering.rb index 2991b112..12bd1ad3 100644 --- a/db/migrate/20141109193909_add_deadlines_to_workout_offering.rb +++ b/db/migrate/20141109193909_add_deadlines_to_workout_offering.rb @@ -1,4 +1,4 @@ -class AddDeadlinesToWorkoutOffering < ActiveRecord::Migration +class AddDeadlinesToWorkoutOffering < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :opening_date, :date add_column :workout_offerings, :soft_deadline, :date diff --git a/db/migrate/20141109202442_create_exercise_workouts.rb b/db/migrate/20141109202442_create_exercise_workouts.rb index c735439b..a3fbc36c 100644 --- a/db/migrate/20141109202442_create_exercise_workouts.rb +++ b/db/migrate/20141109202442_create_exercise_workouts.rb @@ -1,4 +1,4 @@ -class CreateExerciseWorkouts < ActiveRecord::Migration +class CreateExerciseWorkouts < ActiveRecord::Migration[5.1] def change create_table :exercise_workouts do |t| t.integer :exercise_id diff --git a/db/migrate/20141109204133_fix_order_column_in_exercise_workouts.rb b/db/migrate/20141109204133_fix_order_column_in_exercise_workouts.rb index 8eb75d03..4fb5dea2 100644 --- a/db/migrate/20141109204133_fix_order_column_in_exercise_workouts.rb +++ b/db/migrate/20141109204133_fix_order_column_in_exercise_workouts.rb @@ -1,4 +1,4 @@ -class FixOrderColumnInExerciseWorkouts < ActiveRecord::Migration +class FixOrderColumnInExerciseWorkouts < ActiveRecord::Migration[5.1] def change rename_column :exercise_workouts, :order, :ordering end diff --git a/db/migrate/20141110010213_remove_deadlines_from_workouts.rb b/db/migrate/20141110010213_remove_deadlines_from_workouts.rb index e2651250..ee437307 100644 --- a/db/migrate/20141110010213_remove_deadlines_from_workouts.rb +++ b/db/migrate/20141110010213_remove_deadlines_from_workouts.rb @@ -1,4 +1,4 @@ -class RemoveDeadlinesFromWorkouts < ActiveRecord::Migration +class RemoveDeadlinesFromWorkouts < ActiveRecord::Migration[5.1] def change remove_column :workouts, :opening_date, :date remove_column :workouts, :soft_deadline, :date diff --git a/db/migrate/20141110023518_create_course_exercises.rb b/db/migrate/20141110023518_create_course_exercises.rb index 01be995f..796af32d 100644 --- a/db/migrate/20141110023518_create_course_exercises.rb +++ b/db/migrate/20141110023518_create_course_exercises.rb @@ -1,4 +1,4 @@ -class CreateCourseExercises < ActiveRecord::Migration +class CreateCourseExercises < ActiveRecord::Migration[5.1] def change create_table :course_exercises do |t| t.integer :course_id diff --git a/db/migrate/20150111180500_create_base_exercises.rb b/db/migrate/20150111180500_create_base_exercises.rb index 36129d4c..21c59d17 100644 --- a/db/migrate/20150111180500_create_base_exercises.rb +++ b/db/migrate/20150111180500_create_base_exercises.rb @@ -1,4 +1,4 @@ -class CreateBaseExercises < ActiveRecord::Migration +class CreateBaseExercises < ActiveRecord::Migration[5.1] def change create_table :base_exercises do |t| t.integer :user_id diff --git a/db/migrate/20150111182242_add_base_exercise_id_to_exercise.rb b/db/migrate/20150111182242_add_base_exercise_id_to_exercise.rb index b7457629..f6595795 100644 --- a/db/migrate/20150111182242_add_base_exercise_id_to_exercise.rb +++ b/db/migrate/20150111182242_add_base_exercise_id_to_exercise.rb @@ -1,4 +1,4 @@ -class AddBaseExerciseIdToExercise < ActiveRecord::Migration +class AddBaseExerciseIdToExercise < ActiveRecord::Migration[5.1] def change add_column :exercises, :base_exercise_id, :integer add_index :exercises, :base_exercise_id diff --git a/db/migrate/20150111185855_add_version_to_exercise.rb b/db/migrate/20150111185855_add_version_to_exercise.rb index 5b70a209..1653ac7a 100644 --- a/db/migrate/20150111185855_add_version_to_exercise.rb +++ b/db/migrate/20150111185855_add_version_to_exercise.rb @@ -1,4 +1,4 @@ -class AddVersionToExercise < ActiveRecord::Migration +class AddVersionToExercise < ActiveRecord::Migration[5.1] def change add_column :exercises, :version, :integer end diff --git a/db/migrate/20150111200649_remove_question_type_from_exercises.rb b/db/migrate/20150111200649_remove_question_type_from_exercises.rb index 8dda4ea4..1dbfe17b 100644 --- a/db/migrate/20150111200649_remove_question_type_from_exercises.rb +++ b/db/migrate/20150111200649_remove_question_type_from_exercises.rb @@ -1,4 +1,4 @@ -class RemoveQuestionTypeFromExercises < ActiveRecord::Migration +class RemoveQuestionTypeFromExercises < ActiveRecord::Migration[5.1] def change remove_column :exercises, :question_type, :integer end diff --git a/db/migrate/20150111204245_add_versions_to_base_exercises.rb b/db/migrate/20150111204245_add_versions_to_base_exercises.rb index 05cd9bdc..d45652ef 100644 --- a/db/migrate/20150111204245_add_versions_to_base_exercises.rb +++ b/db/migrate/20150111204245_add_versions_to_base_exercises.rb @@ -1,4 +1,4 @@ -class AddVersionsToBaseExercises < ActiveRecord::Migration +class AddVersionsToBaseExercises < ActiveRecord::Migration[5.1] def change add_column :base_exercises, :versions, :integer end diff --git a/db/migrate/20150111222945_remove_user_id_from_exercises.rb b/db/migrate/20150111222945_remove_user_id_from_exercises.rb index 02b2c811..6183d73c 100644 --- a/db/migrate/20150111222945_remove_user_id_from_exercises.rb +++ b/db/migrate/20150111222945_remove_user_id_from_exercises.rb @@ -1,4 +1,4 @@ -class RemoveUserIdFromExercises < ActiveRecord::Migration +class RemoveUserIdFromExercises < ActiveRecord::Migration[5.1] def change remove_column :exercises, :user_id, :integer end diff --git a/db/migrate/20150112141536_create_variation_groups.rb b/db/migrate/20150112141536_create_variation_groups.rb index b778c679..f8d8f0ed 100644 --- a/db/migrate/20150112141536_create_variation_groups.rb +++ b/db/migrate/20150112141536_create_variation_groups.rb @@ -1,4 +1,4 @@ -class CreateVariationGroups < ActiveRecord::Migration +class CreateVariationGroups < ActiveRecord::Migration[5.1] def change create_table :variation_groups do |t| t.string :title diff --git a/db/migrate/20150112143114_add_variation_group_id_to_base_exercise.rb b/db/migrate/20150112143114_add_variation_group_id_to_base_exercise.rb index e6587e36..d6518d2c 100644 --- a/db/migrate/20150112143114_add_variation_group_id_to_base_exercise.rb +++ b/db/migrate/20150112143114_add_variation_group_id_to_base_exercise.rb @@ -1,4 +1,4 @@ -class AddVariationGroupIdToBaseExercise < ActiveRecord::Migration +class AddVariationGroupIdToBaseExercise < ActiveRecord::Migration[5.1] def change add_column :base_exercises, :variation_group_id, :integer end diff --git a/db/migrate/20150117190855_create_workout_scores.rb b/db/migrate/20150117190855_create_workout_scores.rb index 849320a8..4e365f83 100644 --- a/db/migrate/20150117190855_create_workout_scores.rb +++ b/db/migrate/20150117190855_create_workout_scores.rb @@ -1,4 +1,4 @@ -class CreateWorkoutScores < ActiveRecord::Migration +class CreateWorkoutScores < ActiveRecord::Migration[5.1] def change create_table :workout_scores do |t| t.belongs_to :workout, index: true diff --git a/db/migrate/20150201192746_remove_starter_code_from_exercise.rb b/db/migrate/20150201192746_remove_starter_code_from_exercise.rb index a597797e..9dcf3bb6 100644 --- a/db/migrate/20150201192746_remove_starter_code_from_exercise.rb +++ b/db/migrate/20150201192746_remove_starter_code_from_exercise.rb @@ -1,4 +1,4 @@ -class RemoveStarterCodeFromExercise < ActiveRecord::Migration +class RemoveStarterCodeFromExercise < ActiveRecord::Migration[5.1] def change remove_column :exercises, :starter_code, :text end diff --git a/db/migrate/20150201224732_create_coding_questions.rb b/db/migrate/20150201224732_create_coding_questions.rb index c687a736..2684e9b5 100644 --- a/db/migrate/20150201224732_create_coding_questions.rb +++ b/db/migrate/20150201224732_create_coding_questions.rb @@ -1,4 +1,4 @@ -class CreateCodingQuestions < ActiveRecord::Migration +class CreateCodingQuestions < ActiveRecord::Migration[5.1] def change create_table :coding_questions do |t| t.string :base_class diff --git a/db/migrate/20150201230342_remove_columns_from_coding_question.rb b/db/migrate/20150201230342_remove_columns_from_coding_question.rb index ebba4028..731d197c 100644 --- a/db/migrate/20150201230342_remove_columns_from_coding_question.rb +++ b/db/migrate/20150201230342_remove_columns_from_coding_question.rb @@ -1,4 +1,4 @@ -class RemoveColumnsFromCodingQuestion < ActiveRecord::Migration +class RemoveColumnsFromCodingQuestion < ActiveRecord::Migration[5.1] def change remove_column :coding_questions, :base_class, :wrapper_code, :test_script end diff --git a/db/migrate/20150201230748_remove_columns_from_coding_question_2.rb b/db/migrate/20150201230748_remove_columns_from_coding_question_2.rb index 133fd10a..a62603c3 100644 --- a/db/migrate/20150201230748_remove_columns_from_coding_question_2.rb +++ b/db/migrate/20150201230748_remove_columns_from_coding_question_2.rb @@ -1,4 +1,4 @@ -class RemoveColumnsFromCodingQuestion2 < ActiveRecord::Migration +class RemoveColumnsFromCodingQuestion2 < ActiveRecord::Migration[5.1] def change remove_column :coding_questions, :wrapper_code remove_column :coding_questions, :test_script diff --git a/db/migrate/20150201231050_add_columns_to_coding_questions.rb b/db/migrate/20150201231050_add_columns_to_coding_questions.rb index 60fd28d2..a5a9caa9 100644 --- a/db/migrate/20150201231050_add_columns_to_coding_questions.rb +++ b/db/migrate/20150201231050_add_columns_to_coding_questions.rb @@ -1,4 +1,4 @@ -class AddColumnsToCodingQuestions < ActiveRecord::Migration +class AddColumnsToCodingQuestions < ActiveRecord::Migration[5.1] def change add_column :coding_questions, :base_class, :string add_column :coding_questions, :wrapper_code, :text diff --git a/db/migrate/20150201234250_add_feedback_to_coding_question.rb b/db/migrate/20150201234250_add_feedback_to_coding_question.rb index 80d11619..df7f491b 100644 --- a/db/migrate/20150201234250_add_feedback_to_coding_question.rb +++ b/db/migrate/20150201234250_add_feedback_to_coding_question.rb @@ -1,4 +1,4 @@ -class AddFeedbackToCodingQuestion < ActiveRecord::Migration +class AddFeedbackToCodingQuestion < ActiveRecord::Migration[5.1] def change add_column :coding_questions, :feedback, :text end diff --git a/db/migrate/20150201234351_remove_feedback_from_coding_question.rb b/db/migrate/20150201234351_remove_feedback_from_coding_question.rb index 7e38c183..51690638 100644 --- a/db/migrate/20150201234351_remove_feedback_from_coding_question.rb +++ b/db/migrate/20150201234351_remove_feedback_from_coding_question.rb @@ -1,4 +1,4 @@ -class RemoveFeedbackFromCodingQuestion < ActiveRecord::Migration +class RemoveFeedbackFromCodingQuestion < ActiveRecord::Migration[5.1] def change remove_column :coding_questions, :feedback, :text end diff --git a/db/migrate/20150201235152_create_test_case_results.rb b/db/migrate/20150201235152_create_test_case_results.rb index 9d38b2ca..ec2876a0 100644 --- a/db/migrate/20150201235152_create_test_case_results.rb +++ b/db/migrate/20150201235152_create_test_case_results.rb @@ -1,4 +1,4 @@ -class CreateTestCaseResults < ActiveRecord::Migration +class CreateTestCaseResults < ActiveRecord::Migration[5.1] def change create_table :test_case_results do |t| t.integer :test_case_id, index: true diff --git a/db/migrate/20150205220518_rectify_test_case_result.rb b/db/migrate/20150205220518_rectify_test_case_result.rb index 68a5af10..976d2f2c 100644 --- a/db/migrate/20150205220518_rectify_test_case_result.rb +++ b/db/migrate/20150205220518_rectify_test_case_result.rb @@ -1,4 +1,4 @@ -class RectifyTestCaseResult < ActiveRecord::Migration +class RectifyTestCaseResult < ActiveRecord::Migration[5.1] def change remove_column :test_case_results, :score, :float add_column :test_case_results, :pass, :boolean diff --git a/db/migrate/20150205220837_rectify_test_case_result2.rb b/db/migrate/20150205220837_rectify_test_case_result2.rb index 4fb8f8fd..5ab7c23c 100644 --- a/db/migrate/20150205220837_rectify_test_case_result2.rb +++ b/db/migrate/20150205220837_rectify_test_case_result2.rb @@ -1,4 +1,4 @@ -class RectifyTestCaseResult2 < ActiveRecord::Migration +class RectifyTestCaseResult2 < ActiveRecord::Migration[5.1] def change remove_column :test_case_results, :max, :boolean end diff --git a/db/migrate/20150205221653_change_score_in_attempts.rb b/db/migrate/20150205221653_change_score_in_attempts.rb index 64d4662d..f3281a22 100644 --- a/db/migrate/20150205221653_change_score_in_attempts.rb +++ b/db/migrate/20150205221653_change_score_in_attempts.rb @@ -1,4 +1,4 @@ -class ChangeScoreInAttempts < ActiveRecord::Migration +class ChangeScoreInAttempts < ActiveRecord::Migration[5.1] def change change_column :attempts, :score, :number, default: 0.0 end diff --git a/db/migrate/20150207221009_add_default_to_points_in_exercise_workouts.rb b/db/migrate/20150207221009_add_default_to_points_in_exercise_workouts.rb index d361a7a7..39fc84c8 100644 --- a/db/migrate/20150207221009_add_default_to_points_in_exercise_workouts.rb +++ b/db/migrate/20150207221009_add_default_to_points_in_exercise_workouts.rb @@ -1,4 +1,4 @@ -class AddDefaultToPointsInExerciseWorkouts < ActiveRecord::Migration +class AddDefaultToPointsInExerciseWorkouts < ActiveRecord::Migration[5.1] def change change_column :exercise_workouts, :points, :float, default: 1.0 end diff --git a/db/migrate/20150210001815_create_test_cases.rb b/db/migrate/20150210001815_create_test_cases.rb index 66e1fedf..740d8067 100644 --- a/db/migrate/20150210001815_create_test_cases.rb +++ b/db/migrate/20150210001815_create_test_cases.rb @@ -1,4 +1,4 @@ -class CreateTestCases < ActiveRecord::Migration +class CreateTestCases < ActiveRecord::Migration[5.1] def change # created in 2131210061217_add_coding_exercise_columns, # but here we blast it and recreate a new structure. diff --git a/db/migrate/20150210012044_add_test_method_to_coding_questions.rb b/db/migrate/20150210012044_add_test_method_to_coding_questions.rb index 3ee0f9c8..4d98807e 100644 --- a/db/migrate/20150210012044_add_test_method_to_coding_questions.rb +++ b/db/migrate/20150210012044_add_test_method_to_coding_questions.rb @@ -1,4 +1,4 @@ -class AddTestMethodToCodingQuestions < ActiveRecord::Migration +class AddTestMethodToCodingQuestions < ActiveRecord::Migration[5.1] def change add_column :coding_questions, :test_method, :string end diff --git a/db/migrate/20150218220059_fix_class_name_in_coding_questions.rb b/db/migrate/20150218220059_fix_class_name_in_coding_questions.rb index af9790d9..4aa8bcff 100644 --- a/db/migrate/20150218220059_fix_class_name_in_coding_questions.rb +++ b/db/migrate/20150218220059_fix_class_name_in_coding_questions.rb @@ -1,4 +1,4 @@ -class FixClassNameInCodingQuestions < ActiveRecord::Migration +class FixClassNameInCodingQuestions < ActiveRecord::Migration[5.1] def change rename_column :coding_questions, :base_class, :class_name end diff --git a/db/migrate/20150218220317_add_starter_code_to_coding_questions.rb b/db/migrate/20150218220317_add_starter_code_to_coding_questions.rb index fbb8a99c..244c99a1 100644 --- a/db/migrate/20150218220317_add_starter_code_to_coding_questions.rb +++ b/db/migrate/20150218220317_add_starter_code_to_coding_questions.rb @@ -1,4 +1,4 @@ -class AddStarterCodeToCodingQuestions < ActiveRecord::Migration +class AddStarterCodeToCodingQuestions < ActiveRecord::Migration[5.1] def change add_column :coding_questions, :starter_code, :text end diff --git a/db/migrate/20150219054901_fix_method_name_in_coding_questions.rb b/db/migrate/20150219054901_fix_method_name_in_coding_questions.rb index df69ccec..7d6f420d 100644 --- a/db/migrate/20150219054901_fix_method_name_in_coding_questions.rb +++ b/db/migrate/20150219054901_fix_method_name_in_coding_questions.rb @@ -1,4 +1,4 @@ -class FixMethodNameInCodingQuestions < ActiveRecord::Migration +class FixMethodNameInCodingQuestions < ActiveRecord::Migration[5.1] def change rename_column :coding_questions, :test_method, :method_name end diff --git a/db/migrate/20150312175933_add_creator_id_to_courses.rb b/db/migrate/20150312175933_add_creator_id_to_courses.rb index 29099c9e..fcaf04a9 100644 --- a/db/migrate/20150312175933_add_creator_id_to_courses.rb +++ b/db/migrate/20150312175933_add_creator_id_to_courses.rb @@ -1,4 +1,4 @@ -class AddCreatorIdToCourses < ActiveRecord::Migration +class AddCreatorIdToCourses < ActiveRecord::Migration[5.1] def change add_column :courses, :creator_id, :integer end diff --git a/db/migrate/20150312183927_add_creator_id_to_exercises.rb b/db/migrate/20150312183927_add_creator_id_to_exercises.rb index 0b57dcd4..99371dcb 100644 --- a/db/migrate/20150312183927_add_creator_id_to_exercises.rb +++ b/db/migrate/20150312183927_add_creator_id_to_exercises.rb @@ -1,4 +1,4 @@ -class AddCreatorIdToExercises < ActiveRecord::Migration +class AddCreatorIdToExercises < ActiveRecord::Migration[5.1] def change add_column :exercises, :creator_id, :integer end diff --git a/db/migrate/20150312184040_add_creator_id_to_base_exercises.rb b/db/migrate/20150312184040_add_creator_id_to_base_exercises.rb index dcb30a9c..833bd0a1 100644 --- a/db/migrate/20150312184040_add_creator_id_to_base_exercises.rb +++ b/db/migrate/20150312184040_add_creator_id_to_base_exercises.rb @@ -1,4 +1,4 @@ -class AddCreatorIdToBaseExercises < ActiveRecord::Migration +class AddCreatorIdToBaseExercises < ActiveRecord::Migration[5.1] def change add_column :base_exercises, :creator_id, :integer end diff --git a/db/migrate/20150312184111_add_creator_id_to_workouts.rb b/db/migrate/20150312184111_add_creator_id_to_workouts.rb index ff50203f..1245fd3f 100644 --- a/db/migrate/20150312184111_add_creator_id_to_workouts.rb +++ b/db/migrate/20150312184111_add_creator_id_to_workouts.rb @@ -1,4 +1,4 @@ -class AddCreatorIdToWorkouts < ActiveRecord::Migration +class AddCreatorIdToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :creator_id, :integer end diff --git a/db/migrate/20150312184659_remove_creator_id_from_base_exercises.rb b/db/migrate/20150312184659_remove_creator_id_from_base_exercises.rb index 4b4762a1..708134ff 100644 --- a/db/migrate/20150312184659_remove_creator_id_from_base_exercises.rb +++ b/db/migrate/20150312184659_remove_creator_id_from_base_exercises.rb @@ -1,4 +1,4 @@ -class RemoveCreatorIdFromBaseExercises < ActiveRecord::Migration +class RemoveCreatorIdFromBaseExercises < ActiveRecord::Migration[5.1] def change remove_column :base_exercises, :creator_id, :integer end diff --git a/db/migrate/20150320002742_add_omniauth_columns_to_users.rb b/db/migrate/20150320002742_add_omniauth_columns_to_users.rb index 6814f682..3686ca46 100644 --- a/db/migrate/20150320002742_add_omniauth_columns_to_users.rb +++ b/db/migrate/20150320002742_add_omniauth_columns_to_users.rb @@ -1,4 +1,4 @@ -class AddOmniauthColumnsToUsers < ActiveRecord::Migration +class AddOmniauthColumnsToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :provider, :string add_column :users, :uid, :string diff --git a/db/migrate/20150324135215_remove_omniauth_columns_from_users.rb b/db/migrate/20150324135215_remove_omniauth_columns_from_users.rb index 5aba20c0..64ace5a5 100644 --- a/db/migrate/20150324135215_remove_omniauth_columns_from_users.rb +++ b/db/migrate/20150324135215_remove_omniauth_columns_from_users.rb @@ -1,4 +1,4 @@ -class RemoveOmniauthColumnsFromUsers < ActiveRecord::Migration +class RemoveOmniauthColumnsFromUsers < ActiveRecord::Migration[5.1] def change remove_column :users, :provider, :string remove_column :users, :uid, :string diff --git a/db/migrate/20150325143018_add_avatar_to_users.rb b/db/migrate/20150325143018_add_avatar_to_users.rb index 7b4de37a..efc120b1 100644 --- a/db/migrate/20150325143018_add_avatar_to_users.rb +++ b/db/migrate/20150325143018_add_avatar_to_users.rb @@ -1,4 +1,4 @@ -class AddAvatarToUsers < ActiveRecord::Migration +class AddAvatarToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :avatar, :string end diff --git a/db/migrate/20150325235931_rename_current_version_to_current_version_id_in_base_exercises.rb b/db/migrate/20150325235931_rename_current_version_to_current_version_id_in_base_exercises.rb index 2ef0a374..06ab6fe6 100644 --- a/db/migrate/20150325235931_rename_current_version_to_current_version_id_in_base_exercises.rb +++ b/db/migrate/20150325235931_rename_current_version_to_current_version_id_in_base_exercises.rb @@ -1,4 +1,4 @@ -class RenameCurrentVersionToCurrentVersionIdInBaseExercises < ActiveRecord::Migration +class RenameCurrentVersionToCurrentVersionIdInBaseExercises < ActiveRecord::Migration[5.1] def change rename_column :base_exercises, :current_version, :current_version_id end diff --git a/db/migrate/20150326123644_add_null_constraints_and_indices.rb b/db/migrate/20150326123644_add_null_constraints_and_indices.rb index 2d5002d7..e5ab06cf 100644 --- a/db/migrate/20150326123644_add_null_constraints_and_indices.rb +++ b/db/migrate/20150326123644_add_null_constraints_and_indices.rb @@ -1,4 +1,4 @@ -class AddNullConstraintsAndIndices < ActiveRecord::Migration +class AddNullConstraintsAndIndices < ActiveRecord::Migration[5.1] def change # identities change_column_null :identities, :user_id, false diff --git a/db/migrate/20150326163802_add_foreign_key_constraints.rb b/db/migrate/20150326163802_add_foreign_key_constraints.rb index c038c9d7..0e57ca08 100644 --- a/db/migrate/20150326163802_add_foreign_key_constraints.rb +++ b/db/migrate/20150326163802_add_foreign_key_constraints.rb @@ -1,4 +1,4 @@ -class AddForeignKeyConstraints < ActiveRecord::Migration +class AddForeignKeyConstraints < ActiveRecord::Migration[5.1] def change add_foreign_key :attempts, :exercises, dependent: :delete add_foreign_key :attempts, :users, dependent: :delete diff --git a/db/migrate/20150326173027_rename_title_to_name_in_variation_group.rb b/db/migrate/20150326173027_rename_title_to_name_in_variation_group.rb index 5d06e319..8a28f552 100644 --- a/db/migrate/20150326173027_rename_title_to_name_in_variation_group.rb +++ b/db/migrate/20150326173027_rename_title_to_name_in_variation_group.rb @@ -1,4 +1,4 @@ -class RenameTitleToNameInVariationGroup < ActiveRecord::Migration +class RenameTitleToNameInVariationGroup < ActiveRecord::Migration[5.1] def change rename_column :variation_groups, :title, :name end diff --git a/db/migrate/20150326193058_rename_ordering_to_order_in_exercise_workouts.rb b/db/migrate/20150326193058_rename_ordering_to_order_in_exercise_workouts.rb index 287b5152..c8771bc8 100644 --- a/db/migrate/20150326193058_rename_ordering_to_order_in_exercise_workouts.rb +++ b/db/migrate/20150326193058_rename_ordering_to_order_in_exercise_workouts.rb @@ -1,4 +1,4 @@ -class RenameOrderingToOrderInExerciseWorkouts < ActiveRecord::Migration +class RenameOrderingToOrderInExerciseWorkouts < ActiveRecord::Migration[5.1] def change rename_column :exercise_workouts, :ordering, :order end diff --git a/db/migrate/20150326193301_rename_title_to_name_in_exercises.rb b/db/migrate/20150326193301_rename_title_to_name_in_exercises.rb index bf76d18f..616e2e07 100644 --- a/db/migrate/20150326193301_rename_title_to_name_in_exercises.rb +++ b/db/migrate/20150326193301_rename_title_to_name_in_exercises.rb @@ -1,4 +1,4 @@ -class RenameTitleToNameInExercises < ActiveRecord::Migration +class RenameTitleToNameInExercises < ActiveRecord::Migration[5.1] def change rename_column :exercises, :title, :name end diff --git a/db/migrate/20150327213048_create_active_admin_comments.rb b/db/migrate/20150327213048_create_active_admin_comments.rb index 9efd1478..fd0c5aee 100644 --- a/db/migrate/20150327213048_create_active_admin_comments.rb +++ b/db/migrate/20150327213048_create_active_admin_comments.rb @@ -1,4 +1,4 @@ -class CreateActiveAdminComments < ActiveRecord::Migration +class CreateActiveAdminComments < ActiveRecord::Migration[5.1] def self.up create_table :active_admin_comments do |t| t.string :namespace diff --git a/db/migrate/20150328005919_rename_display_name_to_name_in_organizations.rb b/db/migrate/20150328005919_rename_display_name_to_name_in_organizations.rb index a7978380..2cefce0c 100644 --- a/db/migrate/20150328005919_rename_display_name_to_name_in_organizations.rb +++ b/db/migrate/20150328005919_rename_display_name_to_name_in_organizations.rb @@ -1,4 +1,4 @@ -class RenameDisplayNameToNameInOrganizations < ActiveRecord::Migration +class RenameDisplayNameToNameInOrganizations < ActiveRecord::Migration[5.1] def change rename_column :organizations, :display_name, :name end diff --git a/db/migrate/20150328011131_remove_name_from_users.rb b/db/migrate/20150328011131_remove_name_from_users.rb index 623cc753..b6082677 100644 --- a/db/migrate/20150328011131_remove_name_from_users.rb +++ b/db/migrate/20150328011131_remove_name_from_users.rb @@ -1,4 +1,4 @@ -class RemoveNameFromUsers < ActiveRecord::Migration +class RemoveNameFromUsers < ActiveRecord::Migration[5.1] def change remove_column :users, :name, :string end diff --git a/db/migrate/20150328150855_remove_name_from_course_offering.rb b/db/migrate/20150328150855_remove_name_from_course_offering.rb index 58dffa86..083834c6 100644 --- a/db/migrate/20150328150855_remove_name_from_course_offering.rb +++ b/db/migrate/20150328150855_remove_name_from_course_offering.rb @@ -1,4 +1,4 @@ -class RemoveNameFromCourseOffering < ActiveRecord::Migration +class RemoveNameFromCourseOffering < ActiveRecord::Migration[5.1] def change remove_column :course_offerings, :name, :string change_column_null :course_offerings, :label, false diff --git a/db/migrate/20150330194627_create_friendly_id_slugs.rb b/db/migrate/20150330194627_create_friendly_id_slugs.rb index 770f6264..6e7389c0 100644 --- a/db/migrate/20150330194627_create_friendly_id_slugs.rb +++ b/db/migrate/20150330194627_create_friendly_id_slugs.rb @@ -1,4 +1,4 @@ -class CreateFriendlyIdSlugs < ActiveRecord::Migration +class CreateFriendlyIdSlugs < ActiveRecord::Migration[5.1] def change create_table :friendly_id_slugs do |t| t.string :slug, :null => false diff --git a/db/migrate/20150331032124_add_slug_to_term.rb b/db/migrate/20150331032124_add_slug_to_term.rb index 5260747e..25ec49b8 100644 --- a/db/migrate/20150331032124_add_slug_to_term.rb +++ b/db/migrate/20150331032124_add_slug_to_term.rb @@ -1,4 +1,4 @@ -class AddSlugToTerm < ActiveRecord::Migration +class AddSlugToTerm < ActiveRecord::Migration[5.1] def up add_column :terms, :slug, :string # Force generation of slug values for all entries diff --git a/db/migrate/20150331121739_add_slug_to_organization.rb b/db/migrate/20150331121739_add_slug_to_organization.rb index a095a1ad..49abb980 100644 --- a/db/migrate/20150331121739_add_slug_to_organization.rb +++ b/db/migrate/20150331121739_add_slug_to_organization.rb @@ -1,4 +1,4 @@ -class AddSlugToOrganization < ActiveRecord::Migration +class AddSlugToOrganization < ActiveRecord::Migration[5.1] def up remove_column :organizations, :url_part, :string diff --git a/db/migrate/20150402033335_add_slug_to_course.rb b/db/migrate/20150402033335_add_slug_to_course.rb index 42219394..1bb771e1 100644 --- a/db/migrate/20150402033335_add_slug_to_course.rb +++ b/db/migrate/20150402033335_add_slug_to_course.rb @@ -1,4 +1,4 @@ -class AddSlugToCourse < ActiveRecord::Migration +class AddSlugToCourse < ActiveRecord::Migration[5.1] def up remove_index :courses, :url_part diff --git a/db/migrate/20150402043958_add_slug_to_user.rb b/db/migrate/20150402043958_add_slug_to_user.rb index 83353b7a..cdeb142d 100644 --- a/db/migrate/20150402043958_add_slug_to_user.rb +++ b/db/migrate/20150402043958_add_slug_to_user.rb @@ -1,4 +1,4 @@ -class AddSlugToUser < ActiveRecord::Migration +class AddSlugToUser < ActiveRecord::Migration[5.1] def up add_column :users, :slug, :string diff --git a/db/migrate/20150429122658_rename_exercises_to_exercise_versions.rb b/db/migrate/20150429122658_rename_exercises_to_exercise_versions.rb index 7b0563b6..46c2873e 100644 --- a/db/migrate/20150429122658_rename_exercises_to_exercise_versions.rb +++ b/db/migrate/20150429122658_rename_exercises_to_exercise_versions.rb @@ -1,4 +1,4 @@ -class RenameExercisesToExerciseVersions < ActiveRecord::Migration +class RenameExercisesToExerciseVersions < ActiveRecord::Migration[5.1] def change rename_table :exercises, :exercise_versions rename_column :attempts, :exercise_id, :exercise_version_id diff --git a/db/migrate/20150429132614_rename_base_exercises_to_exercises.rb b/db/migrate/20150429132614_rename_base_exercises_to_exercises.rb index 12046180..9bd0794d 100644 --- a/db/migrate/20150429132614_rename_base_exercises_to_exercises.rb +++ b/db/migrate/20150429132614_rename_base_exercises_to_exercises.rb @@ -1,4 +1,4 @@ -class RenameBaseExercisesToExercises < ActiveRecord::Migration +class RenameBaseExercisesToExercises < ActiveRecord::Migration[5.1] def change rename_table :base_exercises, :exercises rename_column :exercise_versions, :base_exercise_id, :exercise_id diff --git a/db/migrate/20150429135647_create_exercise_owners.rb b/db/migrate/20150429135647_create_exercise_owners.rb index fc352688..14dcd8a2 100644 --- a/db/migrate/20150429135647_create_exercise_owners.rb +++ b/db/migrate/20150429135647_create_exercise_owners.rb @@ -1,4 +1,4 @@ -class CreateExerciseOwners < ActiveRecord::Migration +class CreateExerciseOwners < ActiveRecord::Migration[5.1] def change create_table :exercise_owners do |t| t.belongs_to :exercise, null: false diff --git a/db/migrate/20150429160335_rename_variation_group_to_exercise_family.rb b/db/migrate/20150429160335_rename_variation_group_to_exercise_family.rb index 88650c87..073533ab 100644 --- a/db/migrate/20150429160335_rename_variation_group_to_exercise_family.rb +++ b/db/migrate/20150429160335_rename_variation_group_to_exercise_family.rb @@ -1,4 +1,4 @@ -class RenameVariationGroupToExerciseFamily < ActiveRecord::Migration +class RenameVariationGroupToExerciseFamily < ActiveRecord::Migration[5.1] def change rename_table :variation_groups, :exercise_families rename_column :exercises, :variation_group_id, :exercise_family_id diff --git a/db/migrate/20150429170252_remove_user_id_from_base_exercises.rb b/db/migrate/20150429170252_remove_user_id_from_base_exercises.rb index 246b9d64..0aa1b106 100644 --- a/db/migrate/20150429170252_remove_user_id_from_base_exercises.rb +++ b/db/migrate/20150429170252_remove_user_id_from_base_exercises.rb @@ -1,4 +1,4 @@ -class RemoveUserIdFromBaseExercises < ActiveRecord::Migration +class RemoveUserIdFromBaseExercises < ActiveRecord::Migration[5.1] def change remove_column :exercises, :user_id, :integer end diff --git a/db/migrate/20150430165328_rename_for_acts_as_list.rb b/db/migrate/20150430165328_rename_for_acts_as_list.rb index d1fee669..12ce39b3 100644 --- a/db/migrate/20150430165328_rename_for_acts_as_list.rb +++ b/db/migrate/20150430165328_rename_for_acts_as_list.rb @@ -1,4 +1,4 @@ -class RenameForActsAsList < ActiveRecord::Migration +class RenameForActsAsList < ActiveRecord::Migration[5.1] def change rename_column :choices, :order, :position rename_column :exercise_versions, :version, :position diff --git a/db/migrate/20150501192055_rename_prompt_features.rb b/db/migrate/20150501192055_rename_prompt_features.rb index 430a5d46..3030de55 100644 --- a/db/migrate/20150501192055_rename_prompt_features.rb +++ b/db/migrate/20150501192055_rename_prompt_features.rb @@ -1,4 +1,4 @@ -class RenamePromptFeatures < ActiveRecord::Migration +class RenamePromptFeatures < ActiveRecord::Migration[5.1] def change change_table :prompts do |t| t.remove :language_id, :integer diff --git a/db/migrate/20150502155416_rename_coding_question_in_test_cases.rb b/db/migrate/20150502155416_rename_coding_question_in_test_cases.rb index e0353351..5626cd95 100644 --- a/db/migrate/20150502155416_rename_coding_question_in_test_cases.rb +++ b/db/migrate/20150502155416_rename_coding_question_in_test_cases.rb @@ -1,4 +1,4 @@ -class RenameCodingQuestionInTestCases < ActiveRecord::Migration +class RenameCodingQuestionInTestCases < ActiveRecord::Migration[5.1] def change rename_column :test_cases, :coding_question_id, :coding_prompt_id end diff --git a/db/migrate/20150502155552_move_choices_from_exercise_versions_to_prompts.rb b/db/migrate/20150502155552_move_choices_from_exercise_versions_to_prompts.rb index f2fd6d8d..ebfe9add 100644 --- a/db/migrate/20150502155552_move_choices_from_exercise_versions_to_prompts.rb +++ b/db/migrate/20150502155552_move_choices_from_exercise_versions_to_prompts.rb @@ -1,4 +1,4 @@ -class MoveChoicesFromExerciseVersionsToPrompts < ActiveRecord::Migration +class MoveChoicesFromExerciseVersionsToPrompts < ActiveRecord::Migration[5.1] def up remove_foreign_key :choices, :exercise_versions Choice.delete_all diff --git a/db/migrate/20150502181403_move_features_from_exercise_versions_to_exercises.rb b/db/migrate/20150502181403_move_features_from_exercise_versions_to_exercises.rb index 1cce96ce..40d0cda8 100644 --- a/db/migrate/20150502181403_move_features_from_exercise_versions_to_exercises.rb +++ b/db/migrate/20150502181403_move_features_from_exercise_versions_to_exercises.rb @@ -1,4 +1,4 @@ -class MoveFeaturesFromExerciseVersionsToExercises < ActiveRecord::Migration +class MoveFeaturesFromExerciseVersionsToExercises < ActiveRecord::Migration[5.1] def up add_column :exercises, :name, :string add_column :exercises, :is_public, :boolean, null: false, default: false diff --git a/db/migrate/20150502203324_move_tags_from_exercise_versions_to_exercises.rb b/db/migrate/20150502203324_move_tags_from_exercise_versions_to_exercises.rb index 62a0cadb..5b6d7eb9 100644 --- a/db/migrate/20150502203324_move_tags_from_exercise_versions_to_exercises.rb +++ b/db/migrate/20150502203324_move_tags_from_exercise_versions_to_exercises.rb @@ -1,4 +1,4 @@ -class MoveTagsFromExerciseVersionsToExercises < ActiveRecord::Migration +class MoveTagsFromExerciseVersionsToExercises < ActiveRecord::Migration[5.1] def up drop_table :exercise_versions_tags create_table :exercises_tags, id: false do |t| diff --git a/db/migrate/20150502210227_add_stats_to_exercises.rb b/db/migrate/20150502210227_add_stats_to_exercises.rb index 9d01f770..f56379de 100644 --- a/db/migrate/20150502210227_add_stats_to_exercises.rb +++ b/db/migrate/20150502210227_add_stats_to_exercises.rb @@ -1,4 +1,4 @@ -class AddStatsToExercises < ActiveRecord::Migration +class AddStatsToExercises < ActiveRecord::Migration[5.1] def change change_table :exercises do |t| t.integer :attempt_count, null: false, default: 0 diff --git a/db/migrate/20150502210606_remove_question_from_exercise_versions.rb b/db/migrate/20150502210606_remove_question_from_exercise_versions.rb index 92249f97..53ddacab 100644 --- a/db/migrate/20150502210606_remove_question_from_exercise_versions.rb +++ b/db/migrate/20150502210606_remove_question_from_exercise_versions.rb @@ -1,4 +1,4 @@ -class RemoveQuestionFromExerciseVersions < ActiveRecord::Migration +class RemoveQuestionFromExerciseVersions < ActiveRecord::Migration[5.1] def up remove_column :exercise_versions, :question, :text change_column :choices, :answer, :text diff --git a/db/migrate/20150503003408_add_workout_offering_to_workout_score.rb b/db/migrate/20150503003408_add_workout_offering_to_workout_score.rb index 81871628..3c267068 100644 --- a/db/migrate/20150503003408_add_workout_offering_to_workout_score.rb +++ b/db/migrate/20150503003408_add_workout_offering_to_workout_score.rb @@ -1,4 +1,4 @@ -class AddWorkoutOfferingToWorkoutScore < ActiveRecord::Migration +class AddWorkoutOfferingToWorkoutScore < ActiveRecord::Migration[5.1] def change change_table :workout_scores do |t| t.belongs_to :workout_offering diff --git a/db/migrate/20150503004546_add_to_attempt.rb b/db/migrate/20150503004546_add_to_attempt.rb index 8f11a753..7a03e20c 100644 --- a/db/migrate/20150503004546_add_to_attempt.rb +++ b/db/migrate/20150503004546_add_to_attempt.rb @@ -1,4 +1,4 @@ -class AddToAttempt < ActiveRecord::Migration +class AddToAttempt < ActiveRecord::Migration[5.1] def change change_table :attempts do |t| t.belongs_to :workout_score diff --git a/db/migrate/20150503153952_create_workout_owners.rb b/db/migrate/20150503153952_create_workout_owners.rb index 72f1a64f..dccd31c9 100644 --- a/db/migrate/20150503153952_create_workout_owners.rb +++ b/db/migrate/20150503153952_create_workout_owners.rb @@ -1,4 +1,4 @@ -class CreateWorkoutOwners < ActiveRecord::Migration +class CreateWorkoutOwners < ActiveRecord::Migration[5.1] def change create_table :workout_owners do |t| t.belongs_to :workout, null: false diff --git a/db/migrate/20150503190401_fix_choice_answer.rb b/db/migrate/20150503190401_fix_choice_answer.rb index ab3dd506..ca9bddc8 100644 --- a/db/migrate/20150503190401_fix_choice_answer.rb +++ b/db/migrate/20150503190401_fix_choice_answer.rb @@ -1,4 +1,4 @@ -class FixChoiceAnswer < ActiveRecord::Migration +class FixChoiceAnswer < ActiveRecord::Migration[5.1] def up remove_column :choices, :answer add_column :choices, :answer, :text diff --git a/db/migrate/20150503232731_create_prompt_answer.rb b/db/migrate/20150503232731_create_prompt_answer.rb index 21102ca0..df3c70f1 100644 --- a/db/migrate/20150503232731_create_prompt_answer.rb +++ b/db/migrate/20150503232731_create_prompt_answer.rb @@ -1,4 +1,4 @@ -class CreatePromptAnswer < ActiveRecord::Migration +class CreatePromptAnswer < ActiveRecord::Migration[5.1] def change create_table :prompt_answers do |t| t.belongs_to :attempt, required: true diff --git a/db/migrate/20150504000235_create_coding_prompt_answer.rb b/db/migrate/20150504000235_create_coding_prompt_answer.rb index 700a2618..1b9668ed 100644 --- a/db/migrate/20150504000235_create_coding_prompt_answer.rb +++ b/db/migrate/20150504000235_create_coding_prompt_answer.rb @@ -1,4 +1,4 @@ -class CreateCodingPromptAnswer < ActiveRecord::Migration +class CreateCodingPromptAnswer < ActiveRecord::Migration[5.1] def change remove_column :attempts, :answer, :text remove_column :attempts, :workout_offering_id, :integer diff --git a/db/migrate/20150504002111_create_multiple_choice_prompt_answer.rb b/db/migrate/20150504002111_create_multiple_choice_prompt_answer.rb index b45e3ec4..5b39cfa8 100644 --- a/db/migrate/20150504002111_create_multiple_choice_prompt_answer.rb +++ b/db/migrate/20150504002111_create_multiple_choice_prompt_answer.rb @@ -1,4 +1,4 @@ -class CreateMultipleChoicePromptAnswer < ActiveRecord::Migration +class CreateMultipleChoicePromptAnswer < ActiveRecord::Migration[5.1] def change create_table :multiple_choice_prompt_answers do |t| end diff --git a/db/migrate/20150504004247_create_irt_data.rb b/db/migrate/20150504004247_create_irt_data.rb index e3f45c68..42d5c4eb 100644 --- a/db/migrate/20150504004247_create_irt_data.rb +++ b/db/migrate/20150504004247_create_irt_data.rb @@ -1,4 +1,4 @@ -class CreateIRTData < ActiveRecord::Migration +class CreateIRTData < ActiveRecord::Migration[5.1] def change create_table :irt_data do |t| t.integer :attempt_count, null: false diff --git a/db/migrate/20150504051530_add_cutoff_date_to_course_offerings.rb b/db/migrate/20150504051530_add_cutoff_date_to_course_offerings.rb index 13d879e0..baf141e6 100644 --- a/db/migrate/20150504051530_add_cutoff_date_to_course_offerings.rb +++ b/db/migrate/20150504051530_add_cutoff_date_to_course_offerings.rb @@ -1,4 +1,4 @@ -class AddCutoffDateToCourseOfferings < ActiveRecord::Migration +class AddCutoffDateToCourseOfferings < ActiveRecord::Migration[5.1] def change add_column :course_offerings, :cutoff_date, :date end diff --git a/db/migrate/20150506122722_create_attempts_tag_user_scores.rb b/db/migrate/20150506122722_create_attempts_tag_user_scores.rb index ef696c64..dbcde3dc 100644 --- a/db/migrate/20150506122722_create_attempts_tag_user_scores.rb +++ b/db/migrate/20150506122722_create_attempts_tag_user_scores.rb @@ -1,4 +1,4 @@ -class CreateAttemptsTagUserScores < ActiveRecord::Migration +class CreateAttemptsTagUserScores < ActiveRecord::Migration[5.1] def change # HABTM table attempts <-> tag_user_scores (many to many) create_table :attempts_tag_user_scores, id: false do |t| diff --git a/db/migrate/20150506124650_remove_target_group_from_workouts.rb b/db/migrate/20150506124650_remove_target_group_from_workouts.rb index fe5e2bfb..f4b56107 100644 --- a/db/migrate/20150506124650_remove_target_group_from_workouts.rb +++ b/db/migrate/20150506124650_remove_target_group_from_workouts.rb @@ -1,4 +1,4 @@ -class RemoveTargetGroupFromWorkouts < ActiveRecord::Migration +class RemoveTargetGroupFromWorkouts < ActiveRecord::Migration[5.1] def change remove_column :workouts, :target_group, :string end diff --git a/db/migrate/20150506161404_add.rb b/db/migrate/20150506161404_add.rb index 828aaf95..3d383b6d 100644 --- a/db/migrate/20150506161404_add.rb +++ b/db/migrate/20150506161404_add.rb @@ -1,4 +1,4 @@ -class Add < ActiveRecord::Migration +class Add < ActiveRecord::Migration[5.1] def change add_column :exercises, :external_id, :string add_index :exercises, :external_id, unique: true diff --git a/db/migrate/20150507004949_remove_is_scrambled_from_prompt.rb b/db/migrate/20150507004949_remove_is_scrambled_from_prompt.rb index b475f286..8a1b0059 100644 --- a/db/migrate/20150507004949_remove_is_scrambled_from_prompt.rb +++ b/db/migrate/20150507004949_remove_is_scrambled_from_prompt.rb @@ -1,4 +1,4 @@ -class RemoveIsScrambledFromPrompt < ActiveRecord::Migration +class RemoveIsScrambledFromPrompt < ActiveRecord::Migration[5.1] def change remove_column :prompts, :is_scrambled, :boolean end diff --git a/db/migrate/20150507140447_remove_null_constraint_from_exercise_current_version.rb b/db/migrate/20150507140447_remove_null_constraint_from_exercise_current_version.rb index 618b5c92..4e013488 100644 --- a/db/migrate/20150507140447_remove_null_constraint_from_exercise_current_version.rb +++ b/db/migrate/20150507140447_remove_null_constraint_from_exercise_current_version.rb @@ -1,4 +1,4 @@ -class RemoveNullConstraintFromExerciseCurrentVersion < ActiveRecord::Migration +class RemoveNullConstraintFromExerciseCurrentVersion < ActiveRecord::Migration[5.1] def change change_column_null :exercises, :current_version_id, true end diff --git a/db/migrate/20150507143058_rename_prompt_to_question_in_prompts.rb b/db/migrate/20150507143058_rename_prompt_to_question_in_prompts.rb index 6d41330b..2088243d 100644 --- a/db/migrate/20150507143058_rename_prompt_to_question_in_prompts.rb +++ b/db/migrate/20150507143058_rename_prompt_to_question_in_prompts.rb @@ -1,4 +1,4 @@ -class RenamePromptToQuestionInPrompts < ActiveRecord::Migration +class RenamePromptToQuestionInPrompts < ActiveRecord::Migration[5.1] def change rename_column :prompts, :prompt, :question end diff --git a/db/migrate/20150507163037_remove_tags.rb b/db/migrate/20150507163037_remove_tags.rb index 66a199cc..ae34cd61 100644 --- a/db/migrate/20150507163037_remove_tags.rb +++ b/db/migrate/20150507163037_remove_tags.rb @@ -1,4 +1,4 @@ -class RemoveTags < ActiveRecord::Migration +class RemoveTags < ActiveRecord::Migration[5.1] def up drop_table :exercises_tags remove_column :tag_user_scores, :tag_id, :integer diff --git a/db/migrate/20150507164239_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20150507164239_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb index 6bbd5594..27b770f7 100644 --- a/db/migrate/20150507164239_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150507164239_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 1) -class ActsAsTaggableOnMigration < ActiveRecord::Migration +class ActsAsTaggableOnMigration < ActiveRecord::Migration[5.1] def self.up create_table :tags do |t| t.string :name diff --git a/db/migrate/20150507164240_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20150507164240_add_missing_unique_indices.acts_as_taggable_on_engine.rb index 4ca676f6..404230a5 100644 --- a/db/migrate/20150507164240_add_missing_unique_indices.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150507164240_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 2) -class AddMissingUniqueIndices < ActiveRecord::Migration +class AddMissingUniqueIndices < ActiveRecord::Migration[5.1] def self.up add_index :tags, :name, unique: true diff --git a/db/migrate/20150507164241_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20150507164241_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb index 8edb5080..c54fffea 100644 --- a/db/migrate/20150507164241_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150507164241_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 3) -class AddTaggingsCounterCacheToTags < ActiveRecord::Migration +class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[5.1] def self.up add_column :tags, :taggings_count, :integer, default: 0 diff --git a/db/migrate/20150507164242_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20150507164242_add_missing_taggable_index.acts_as_taggable_on_engine.rb index 71f2d7f4..a298379c 100644 --- a/db/migrate/20150507164242_add_missing_taggable_index.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150507164242_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 4) -class AddMissingTaggableIndex < ActiveRecord::Migration +class AddMissingTaggableIndex < ActiveRecord::Migration[5.1] def self.up add_index :taggings, [:taggable_id, :taggable_type, :context] end diff --git a/db/migrate/20150507164243_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20150507164243_change_collation_for_tag_names.acts_as_taggable_on_engine.rb index bfb06bc7..980f110a 100644 --- a/db/migrate/20150507164243_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150507164243_change_collation_for_tag_names.acts_as_taggable_on_engine.rb @@ -1,7 +1,7 @@ # This migration comes from acts_as_taggable_on_engine (originally 5) # This migration is added to circumvent issue #623 and have special characters # work properly -class ChangeCollationForTagNames < ActiveRecord::Migration +class ChangeCollationForTagNames < ActiveRecord::Migration[5.1] def up if ActsAsTaggableOn::Utils.using_mysql? execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") diff --git a/db/migrate/20150510144703_rename_position_to_version_in_exercise_versions.rb b/db/migrate/20150510144703_rename_position_to_version_in_exercise_versions.rb index ffa9f6a5..cd4c668c 100644 --- a/db/migrate/20150510144703_rename_position_to_version_in_exercise_versions.rb +++ b/db/migrate/20150510144703_rename_position_to_version_in_exercise_versions.rb @@ -1,4 +1,4 @@ -class RenamePositionToVersionInExerciseVersions < ActiveRecord::Migration +class RenamePositionToVersionInExerciseVersions < ActiveRecord::Migration[5.1] def change rename_column :exercise_versions, :position, :version change_column_null :exercises, :versions, true diff --git a/db/migrate/20150511225412_actable_ids_are_not_unique.rb b/db/migrate/20150511225412_actable_ids_are_not_unique.rb index bd380e5a..339e0617 100644 --- a/db/migrate/20150511225412_actable_ids_are_not_unique.rb +++ b/db/migrate/20150511225412_actable_ids_are_not_unique.rb @@ -1,4 +1,4 @@ -class ActableIdsAreNotUnique < ActiveRecord::Migration +class ActableIdsAreNotUnique < ActiveRecord::Migration[5.1] def up # Remove unique: true from these two indices remove_index :prompts, :actable_id diff --git a/db/migrate/20150515205710_revise_test_case_structure.rb b/db/migrate/20150515205710_revise_test_case_structure.rb index a09085bb..b1ff1a11 100644 --- a/db/migrate/20150515205710_revise_test_case_structure.rb +++ b/db/migrate/20150515205710_revise_test_case_structure.rb @@ -1,4 +1,4 @@ -class ReviseTestCaseStructure < ActiveRecord::Migration +class ReviseTestCaseStructure < ActiveRecord::Migration[5.1] def up change_table :test_cases do |t| t.remove :test_script, :string diff --git a/db/migrate/20150522205618_add_answer_to_multiple_choice_prompt_answers.rb b/db/migrate/20150522205618_add_answer_to_multiple_choice_prompt_answers.rb index 460c7167..4e5c148e 100644 --- a/db/migrate/20150522205618_add_answer_to_multiple_choice_prompt_answers.rb +++ b/db/migrate/20150522205618_add_answer_to_multiple_choice_prompt_answers.rb @@ -1,4 +1,4 @@ -class AddAnswerToMultipleChoicePromptAnswers < ActiveRecord::Migration +class AddAnswerToMultipleChoicePromptAnswers < ActiveRecord::Migration[5.1] def change add_column :multiple_choice_prompt_answers, :answer, :string end diff --git a/db/migrate/20150525184958_remove_answer_from_multiple_choice_prompt_answers.rb b/db/migrate/20150525184958_remove_answer_from_multiple_choice_prompt_answers.rb index 67fc633d..7a99de60 100644 --- a/db/migrate/20150525184958_remove_answer_from_multiple_choice_prompt_answers.rb +++ b/db/migrate/20150525184958_remove_answer_from_multiple_choice_prompt_answers.rb @@ -1,4 +1,4 @@ -class RemoveAnswerFromMultipleChoicePromptAnswers < ActiveRecord::Migration +class RemoveAnswerFromMultipleChoicePromptAnswers < ActiveRecord::Migration[5.1] def change remove_column :multiple_choice_prompt_answers, :answer, :string end diff --git a/db/migrate/20150528120715_add_error_to_coding_prompt_answer.rb b/db/migrate/20150528120715_add_error_to_coding_prompt_answer.rb index adba7c7a..b5f117e0 100644 --- a/db/migrate/20150528120715_add_error_to_coding_prompt_answer.rb +++ b/db/migrate/20150528120715_add_error_to_coding_prompt_answer.rb @@ -1,4 +1,4 @@ -class AddErrorToCodingPromptAnswer < ActiveRecord::Migration +class AddErrorToCodingPromptAnswer < ActiveRecord::Migration[5.1] def change add_column :coding_prompt_answers, :error, :text end diff --git a/db/migrate/20150531004056_change_class_name_to_string_in_errors.rb b/db/migrate/20150531004056_change_class_name_to_string_in_errors.rb index 872a9d3c..71d3691c 100644 --- a/db/migrate/20150531004056_change_class_name_to_string_in_errors.rb +++ b/db/migrate/20150531004056_change_class_name_to_string_in_errors.rb @@ -1,4 +1,4 @@ -class ChangeClassNameToStringInErrors < ActiveRecord::Migration +class ChangeClassNameToStringInErrors < ActiveRecord::Migration[5.1] def change change_column :errors, :class_name, :string end diff --git a/db/migrate/20150604011650_add_published_to_workout_offerings.rb b/db/migrate/20150604011650_add_published_to_workout_offerings.rb index 59e4a5ca..cf56c5ef 100644 --- a/db/migrate/20150604011650_add_published_to_workout_offerings.rb +++ b/db/migrate/20150604011650_add_published_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddPublishedToWorkoutOfferings < ActiveRecord::Migration +class AddPublishedToWorkoutOfferings < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :published, :boolean, null: false, default: true diff --git a/db/migrate/20150608001534_change_dates_to_datetimes_in_workout_offerings.rb b/db/migrate/20150608001534_change_dates_to_datetimes_in_workout_offerings.rb index 6c00878d..79d7acb0 100644 --- a/db/migrate/20150608001534_change_dates_to_datetimes_in_workout_offerings.rb +++ b/db/migrate/20150608001534_change_dates_to_datetimes_in_workout_offerings.rb @@ -1,4 +1,4 @@ -class ChangeDatesToDatetimesInWorkoutOfferings < ActiveRecord::Migration +class ChangeDatesToDatetimesInWorkoutOfferings < ActiveRecord::Migration[5.1] def change change_column :workout_offerings, :opening_date, :datetime change_column :workout_offerings, :soft_deadline, :datetime diff --git a/db/migrate/20150912035415_create_time_zones.rb b/db/migrate/20150912035415_create_time_zones.rb index 7c0241a4..f5ecb2c2 100644 --- a/db/migrate/20150912035415_create_time_zones.rb +++ b/db/migrate/20150912035415_create_time_zones.rb @@ -1,4 +1,4 @@ -class CreateTimeZones < ActiveRecord::Migration +class CreateTimeZones < ActiveRecord::Migration[5.1] def change create_table :time_zones do |t| t.string :name diff --git a/db/migrate/20150912200222_add_time_zone_id_to_users.rb b/db/migrate/20150912200222_add_time_zone_id_to_users.rb index 5a3f6ae0..86553f82 100644 --- a/db/migrate/20150912200222_add_time_zone_id_to_users.rb +++ b/db/migrate/20150912200222_add_time_zone_id_to_users.rb @@ -1,4 +1,4 @@ -class AddTimeZoneIdToUsers < ActiveRecord::Migration +class AddTimeZoneIdToUsers < ActiveRecord::Migration[5.1] def change add_reference :users, :time_zone, index: true end diff --git a/db/migrate/20150916031620_add_current_workout_score_to_users.rb b/db/migrate/20150916031620_add_current_workout_score_to_users.rb index 858b7a41..4271cf23 100644 --- a/db/migrate/20150916031620_add_current_workout_score_to_users.rb +++ b/db/migrate/20150916031620_add_current_workout_score_to_users.rb @@ -1,4 +1,4 @@ -class AddCurrentWorkoutScoreToUsers < ActiveRecord::Migration +class AddCurrentWorkoutScoreToUsers < ActiveRecord::Migration[5.1] def change change_table :users do |t| t.integer :current_workout_score_id diff --git a/db/migrate/20150921113747_add_is_public_to_workouts.rb b/db/migrate/20150921113747_add_is_public_to_workouts.rb index 132650ad..3d71d5f8 100644 --- a/db/migrate/20150921113747_add_is_public_to_workouts.rb +++ b/db/migrate/20150921113747_add_is_public_to_workouts.rb @@ -1,4 +1,4 @@ -class AddIsPublicToWorkouts < ActiveRecord::Migration +class AddIsPublicToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :is_public, :boolean add_index :workouts, :is_public diff --git a/db/migrate/20150923144539_add_feedback_ready_to_attempts.rb b/db/migrate/20150923144539_add_feedback_ready_to_attempts.rb index 32e3f89a..ff66bdb8 100644 --- a/db/migrate/20150923144539_add_feedback_ready_to_attempts.rb +++ b/db/migrate/20150923144539_add_feedback_ready_to_attempts.rb @@ -1,4 +1,4 @@ -class AddFeedbackReadyToAttempts < ActiveRecord::Migration +class AddFeedbackReadyToAttempts < ActiveRecord::Migration[5.1] def change add_column :attempts, :feedback_ready, :boolean end diff --git a/db/migrate/20150927020504_create_student_extensions.rb b/db/migrate/20150927020504_create_student_extensions.rb index f489f3cb..e63ffd64 100644 --- a/db/migrate/20150927020504_create_student_extensions.rb +++ b/db/migrate/20150927020504_create_student_extensions.rb @@ -1,4 +1,4 @@ -class CreateStudentExtensions < ActiveRecord::Migration +class CreateStudentExtensions < ActiveRecord::Migration[5.1] def change create_table :student_extensions do |t| t.belongs_to :user, index: true diff --git a/db/migrate/20151015033713_add_time_limit_to_workout_offerings.rb b/db/migrate/20151015033713_add_time_limit_to_workout_offerings.rb index b6ae97ed..fe778300 100644 --- a/db/migrate/20151015033713_add_time_limit_to_workout_offerings.rb +++ b/db/migrate/20151015033713_add_time_limit_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddTimeLimitToWorkoutOfferings < ActiveRecord::Migration +class AddTimeLimitToWorkoutOfferings < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :time_limit, :int end diff --git a/db/migrate/20151015035823_create_workout_policy.rb b/db/migrate/20151015035823_create_workout_policy.rb index 9a1e1279..ba2956a1 100644 --- a/db/migrate/20151015035823_create_workout_policy.rb +++ b/db/migrate/20151015035823_create_workout_policy.rb @@ -1,4 +1,4 @@ -class CreateWorkoutPolicy < ActiveRecord::Migration +class CreateWorkoutPolicy < ActiveRecord::Migration[5.1] def change create_table :workout_policies do |t| t.boolean :hide_thumbnails_before_start diff --git a/db/migrate/20151015044326_add_time_limit_to_student_extensions.rb b/db/migrate/20151015044326_add_time_limit_to_student_extensions.rb index e5ac608a..c45420a8 100644 --- a/db/migrate/20151015044326_add_time_limit_to_student_extensions.rb +++ b/db/migrate/20151015044326_add_time_limit_to_student_extensions.rb @@ -1,4 +1,4 @@ -class AddTimeLimitToStudentExtensions < ActiveRecord::Migration +class AddTimeLimitToStudentExtensions < ActiveRecord::Migration[5.1] def change add_column :student_extensions, :time_limit, :int end diff --git a/db/migrate/20160217060925_add_invisible_before_review_to_workout_policies.rb b/db/migrate/20160217060925_add_invisible_before_review_to_workout_policies.rb index e8e4b810..3af4327e 100644 --- a/db/migrate/20160217060925_add_invisible_before_review_to_workout_policies.rb +++ b/db/migrate/20160217060925_add_invisible_before_review_to_workout_policies.rb @@ -1,4 +1,4 @@ -class AddInvisibleBeforeReviewToWorkoutPolicies < ActiveRecord::Migration +class AddInvisibleBeforeReviewToWorkoutPolicies < ActiveRecord::Migration[5.1] def change add_column :workout_policies, :invisible_before_review, :boolean end diff --git a/db/migrate/20160224064748_add_opening_date_to_student_extensions.rb b/db/migrate/20160224064748_add_opening_date_to_student_extensions.rb index 8439845f..27f2bb02 100644 --- a/db/migrate/20160224064748_add_opening_date_to_student_extensions.rb +++ b/db/migrate/20160224064748_add_opening_date_to_student_extensions.rb @@ -1,4 +1,4 @@ -class AddOpeningDateToStudentExtensions < ActiveRecord::Migration +class AddOpeningDateToStudentExtensions < ActiveRecord::Migration[5.1] def change add_column :student_extensions, :opening_date, :datetime end diff --git a/db/migrate/20160225005739_add_continue_from_workout_id_to_workout_offerings.rb b/db/migrate/20160225005739_add_continue_from_workout_id_to_workout_offerings.rb index 9679d91a..08e26ea7 100644 --- a/db/migrate/20160225005739_add_continue_from_workout_id_to_workout_offerings.rb +++ b/db/migrate/20160225005739_add_continue_from_workout_id_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddContinueFromWorkoutIdToWorkoutOfferings < ActiveRecord::Migration +class AddContinueFromWorkoutIdToWorkoutOfferings < ActiveRecord::Migration[5.1] def change change_table :workout_offerings do |t| t.integer :continue_from_workout_id diff --git a/db/migrate/20160512005525_add_keys.rb b/db/migrate/20160512005525_add_keys.rb index 9fba7eab..2cb120ee 100644 --- a/db/migrate/20160512005525_add_keys.rb +++ b/db/migrate/20160512005525_add_keys.rb @@ -1,4 +1,4 @@ -class AddKeys < ActiveRecord::Migration +class AddKeys < ActiveRecord::Migration[5.1] def change add_foreign_key "attempts", "workout_scores", name: "attempts_active_score_id_fk", column: "active_score_id" add_foreign_key "attempts", "exercise_versions", name: "attempts_exercise_version_id_fk" diff --git a/db/migrate/20160525210736_add_lis_info_to_workout_score.rb b/db/migrate/20160525210736_add_lis_info_to_workout_score.rb index a03d3cc0..2bc7ecfc 100644 --- a/db/migrate/20160525210736_add_lis_info_to_workout_score.rb +++ b/db/migrate/20160525210736_add_lis_info_to_workout_score.rb @@ -1,4 +1,4 @@ -class AddLisInfoToWorkoutScore < ActiveRecord::Migration +class AddLisInfoToWorkoutScore < ActiveRecord::Migration[5.1] def change add_column :workout_scores, :lis_outcome_service_url, :string add_column :workout_scores, :lis_result_sourcedid, :string diff --git a/db/migrate/20160602163822_create_lms_instances.rb b/db/migrate/20160602163822_create_lms_instances.rb index e2f70f00..bfe2366c 100644 --- a/db/migrate/20160602163822_create_lms_instances.rb +++ b/db/migrate/20160602163822_create_lms_instances.rb @@ -1,4 +1,4 @@ -class CreateLmsInstances < ActiveRecord::Migration +class CreateLmsInstances < ActiveRecord::Migration[5.1] def change create_table :lms_instances do |t| t.string :consumer_key diff --git a/db/migrate/20160602181823_add_url_to_lms_instance.rb b/db/migrate/20160602181823_add_url_to_lms_instance.rb index 9b3eefaf..808e20a3 100644 --- a/db/migrate/20160602181823_add_url_to_lms_instance.rb +++ b/db/migrate/20160602181823_add_url_to_lms_instance.rb @@ -1,4 +1,4 @@ -class AddUrlToLmsInstance < ActiveRecord::Migration +class AddUrlToLmsInstance < ActiveRecord::Migration[5.1] def change add_column :lms_instances, :url, :string diff --git a/db/migrate/20160602182001_create_lms_types.rb b/db/migrate/20160602182001_create_lms_types.rb index 76466e60..6c89d67c 100644 --- a/db/migrate/20160602182001_create_lms_types.rb +++ b/db/migrate/20160602182001_create_lms_types.rb @@ -1,4 +1,4 @@ -class CreateLmsTypes < ActiveRecord::Migration +class CreateLmsTypes < ActiveRecord::Migration[5.1] def change create_table :lms_types do |t| t.string :name, null: false diff --git a/db/migrate/20160602182220_add_lms_type_id_to_lms_instance.rb b/db/migrate/20160602182220_add_lms_type_id_to_lms_instance.rb index d707e7d7..33cecc60 100644 --- a/db/migrate/20160602182220_add_lms_type_id_to_lms_instance.rb +++ b/db/migrate/20160602182220_add_lms_type_id_to_lms_instance.rb @@ -1,4 +1,4 @@ -class AddLmsTypeIdToLmsInstance < ActiveRecord::Migration +class AddLmsTypeIdToLmsInstance < ActiveRecord::Migration[5.1] def change add_column :lms_instances, :lms_type_id, :integer add_foreign_key :lms_instances, :lms_types diff --git a/db/migrate/20160602185259_add_lms_instance_to_course_offering.rb b/db/migrate/20160602185259_add_lms_instance_to_course_offering.rb index a545eb18..3c286e74 100644 --- a/db/migrate/20160602185259_add_lms_instance_to_course_offering.rb +++ b/db/migrate/20160602185259_add_lms_instance_to_course_offering.rb @@ -1,4 +1,4 @@ -class AddLmsInstanceToCourseOffering < ActiveRecord::Migration +class AddLmsInstanceToCourseOffering < ActiveRecord::Migration[5.1] def change add_reference :course_offerings, :lms_instance, index: true end diff --git a/db/migrate/20160614153123_add_organization_ref_to_lms_instances.rb b/db/migrate/20160614153123_add_organization_ref_to_lms_instances.rb index 26dccce5..974df39a 100644 --- a/db/migrate/20160614153123_add_organization_ref_to_lms_instances.rb +++ b/db/migrate/20160614153123_add_organization_ref_to_lms_instances.rb @@ -1,4 +1,4 @@ -class AddOrganizationRefToLmsInstances < ActiveRecord::Migration +class AddOrganizationRefToLmsInstances < ActiveRecord::Migration[5.1] def change add_reference :lms_instances, :organization, index: true end diff --git a/db/migrate/20160706143029_add_lms_assignment_id_to_workout_offerings.rb b/db/migrate/20160706143029_add_lms_assignment_id_to_workout_offerings.rb index da283a71..32dc4c69 100644 --- a/db/migrate/20160706143029_add_lms_assignment_id_to_workout_offerings.rb +++ b/db/migrate/20160706143029_add_lms_assignment_id_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddLmsAssignmentIdToWorkoutOfferings < ActiveRecord::Migration +class AddLmsAssignmentIdToWorkoutOfferings < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :lms_assignment_id, :string diff --git a/db/migrate/20160707200651_make_workout_offerings_published_by_default.rb b/db/migrate/20160707200651_make_workout_offerings_published_by_default.rb index d7f72f31..2d41c75a 100644 --- a/db/migrate/20160707200651_make_workout_offerings_published_by_default.rb +++ b/db/migrate/20160707200651_make_workout_offerings_published_by_default.rb @@ -1,4 +1,4 @@ -class MakeWorkoutOfferingsPublishedByDefault < ActiveRecord::Migration +class MakeWorkoutOfferingsPublishedByDefault < ActiveRecord::Migration[5.1] def change change_column :workout_offerings, :published, :boolean, default: true end diff --git a/db/migrate/20160829140059_add_description_to_workout_policies.rb b/db/migrate/20160829140059_add_description_to_workout_policies.rb index 3d5bf37a..fa5defa1 100644 --- a/db/migrate/20160829140059_add_description_to_workout_policies.rb +++ b/db/migrate/20160829140059_add_description_to_workout_policies.rb @@ -1,4 +1,4 @@ -class AddDescriptionToWorkoutPolicies < ActiveRecord::Migration +class AddDescriptionToWorkoutPolicies < ActiveRecord::Migration[5.1] def change add_column :workout_policies, :description, :string end diff --git a/db/migrate/20161129200944_add_most_recent_to_workout_offerings.rb b/db/migrate/20161129200944_add_most_recent_to_workout_offerings.rb index 424efadd..d4787bdf 100644 --- a/db/migrate/20161129200944_add_most_recent_to_workout_offerings.rb +++ b/db/migrate/20161129200944_add_most_recent_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddMostRecentToWorkoutOfferings < ActiveRecord::Migration +class AddMostRecentToWorkoutOfferings < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :most_recent, :boolean, default: true end diff --git a/db/migrate/20170314235543_create_lti_identities.rb b/db/migrate/20170314235543_create_lti_identities.rb index 7e5ee5d3..e45ac145 100644 --- a/db/migrate/20170314235543_create_lti_identities.rb +++ b/db/migrate/20170314235543_create_lti_identities.rb @@ -1,4 +1,4 @@ -class CreateLtiIdentities < ActiveRecord::Migration +class CreateLtiIdentities < ActiveRecord::Migration[5.1] def change create_table :lti_identities do |t| t.string :lti_user_id diff --git a/db/migrate/20170411130659_add_example_hidden_static_ao_n_to_test_cases.rb b/db/migrate/20170411130659_add_example_hidden_static_ao_n_to_test_cases.rb index 08f54a8a..2e74d93c 100644 --- a/db/migrate/20170411130659_add_example_hidden_static_ao_n_to_test_cases.rb +++ b/db/migrate/20170411130659_add_example_hidden_static_ao_n_to_test_cases.rb @@ -1,4 +1,4 @@ -class AddExampleHiddenStaticAoNToTestCases < ActiveRecord::Migration +class AddExampleHiddenStaticAoNToTestCases < ActiveRecord::Migration[5.1] def change add_column :test_cases, :static, :boolean, null: false, default: false add_column :test_cases, :all_or_nothing, :boolean, null: false, default: false diff --git a/db/migrate/20170420144021_add_text_representation_to_exercise_version.rb b/db/migrate/20170420144021_add_text_representation_to_exercise_version.rb index 8dac6301..7cc5e81e 100644 --- a/db/migrate/20170420144021_add_text_representation_to_exercise_version.rb +++ b/db/migrate/20170420144021_add_text_representation_to_exercise_version.rb @@ -1,4 +1,4 @@ -class AddTextRepresentationToExerciseVersion < ActiveRecord::Migration +class AddTextRepresentationToExerciseVersion < ActiveRecord::Migration[5.1] def change add_column :exercise_versions, :text_representation, :text, limit: 16.megabytes - 1 end diff --git a/db/migrate/20170427154810_add_lms_assignment_url_to_workout_offerings.rb b/db/migrate/20170427154810_add_lms_assignment_url_to_workout_offerings.rb index e2c3baf7..cd6b7a8c 100644 --- a/db/migrate/20170427154810_add_lms_assignment_url_to_workout_offerings.rb +++ b/db/migrate/20170427154810_add_lms_assignment_url_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddLmsAssignmentUrlToWorkoutOfferings < ActiveRecord::Migration +class AddLmsAssignmentUrlToWorkoutOfferings < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :lms_assignment_url, :string end diff --git a/db/migrate/20170430212102_rename_all_or_nothing_to_screening_in_test_case.rb b/db/migrate/20170430212102_rename_all_or_nothing_to_screening_in_test_case.rb index 27c04873..5b337d99 100644 --- a/db/migrate/20170430212102_rename_all_or_nothing_to_screening_in_test_case.rb +++ b/db/migrate/20170430212102_rename_all_or_nothing_to_screening_in_test_case.rb @@ -1,4 +1,4 @@ -class RenameAllOrNothingToScreeningInTestCase < ActiveRecord::Migration +class RenameAllOrNothingToScreeningInTestCase < ActiveRecord::Migration[5.1] def change rename_column :test_cases, :all_or_nothing, :screening end diff --git a/db/migrate/20170502163350_create_license_policies.rb b/db/migrate/20170502163350_create_license_policies.rb index 75542c2d..1db45262 100644 --- a/db/migrate/20170502163350_create_license_policies.rb +++ b/db/migrate/20170502163350_create_license_policies.rb @@ -1,4 +1,4 @@ -class CreateLicensePolicies < ActiveRecord::Migration +class CreateLicensePolicies < ActiveRecord::Migration[5.1] def change create_table :license_policies do |t| t.string :name diff --git a/db/migrate/20170502163602_create_licenses.rb b/db/migrate/20170502163602_create_licenses.rb index 49ba84be..9670123c 100644 --- a/db/migrate/20170502163602_create_licenses.rb +++ b/db/migrate/20170502163602_create_licenses.rb @@ -1,4 +1,4 @@ -class CreateLicenses < ActiveRecord::Migration +class CreateLicenses < ActiveRecord::Migration[5.1] def change create_table :licenses do |t| t.string :name diff --git a/db/migrate/20170502165648_create_user_groups.rb b/db/migrate/20170502165648_create_user_groups.rb index b3d61cfd..809f28ce 100644 --- a/db/migrate/20170502165648_create_user_groups.rb +++ b/db/migrate/20170502165648_create_user_groups.rb @@ -1,4 +1,4 @@ -class CreateUserGroups < ActiveRecord::Migration +class CreateUserGroups < ActiveRecord::Migration[5.1] def change create_table :user_groups do |t| t.string :name diff --git a/db/migrate/20170502165837_create_exercise_collections.rb b/db/migrate/20170502165837_create_exercise_collections.rb index b7452439..e8d7c6aa 100644 --- a/db/migrate/20170502165837_create_exercise_collections.rb +++ b/db/migrate/20170502165837_create_exercise_collections.rb @@ -1,4 +1,4 @@ -class CreateExerciseCollections < ActiveRecord::Migration +class CreateExerciseCollections < ActiveRecord::Migration[5.1] def change create_table :exercise_collections do |t| t.string :name diff --git a/db/migrate/20170502171412_add_exercise_collection_to_exercises.rb b/db/migrate/20170502171412_add_exercise_collection_to_exercises.rb index cf30076f..289dc9d8 100644 --- a/db/migrate/20170502171412_add_exercise_collection_to_exercises.rb +++ b/db/migrate/20170502171412_add_exercise_collection_to_exercises.rb @@ -1,4 +1,4 @@ -class AddExerciseCollectionToExercises < ActiveRecord::Migration +class AddExerciseCollectionToExercises < ActiveRecord::Migration[5.1] def change add_reference :exercises, :exercise_collection, index: true, foreign_key: true end diff --git a/db/migrate/20170502204756_create_memberships.rb b/db/migrate/20170502204756_create_memberships.rb index 9e9d9814..56a067e5 100644 --- a/db/migrate/20170502204756_create_memberships.rb +++ b/db/migrate/20170502204756_create_memberships.rb @@ -1,4 +1,4 @@ -class CreateMemberships < ActiveRecord::Migration +class CreateMemberships < ActiveRecord::Migration[5.1] def change create_table :memberships do |t| t.integer :user_id diff --git a/db/migrate/20170503154537_add_user_to_exercise_collection.rb b/db/migrate/20170503154537_add_user_to_exercise_collection.rb index a3568bd9..0df94577 100644 --- a/db/migrate/20170503154537_add_user_to_exercise_collection.rb +++ b/db/migrate/20170503154537_add_user_to_exercise_collection.rb @@ -1,4 +1,4 @@ -class AddUserToExerciseCollection < ActiveRecord::Migration +class AddUserToExerciseCollection < ActiveRecord::Migration[5.1] def change add_reference :exercise_collections, :user, index: true, foreign_key: true end diff --git a/db/migrate/20170509003343_add_hide_examples_to_coding_prompt.rb b/db/migrate/20170509003343_add_hide_examples_to_coding_prompt.rb index 459e3034..d36eee5c 100644 --- a/db/migrate/20170509003343_add_hide_examples_to_coding_prompt.rb +++ b/db/migrate/20170509003343_add_hide_examples_to_coding_prompt.rb @@ -1,4 +1,4 @@ -class AddHideExamplesToCodingPrompt < ActiveRecord::Migration +class AddHideExamplesToCodingPrompt < ActiveRecord::Migration[5.1] def change add_column :coding_prompts, :hide_examples, :boolean, null: false, default: false end diff --git a/db/migrate/20170518161546_add_user_group_to_course.rb b/db/migrate/20170518161546_add_user_group_to_course.rb index 3d202fb5..42e67b33 100644 --- a/db/migrate/20170518161546_add_user_group_to_course.rb +++ b/db/migrate/20170518161546_add_user_group_to_course.rb @@ -1,4 +1,4 @@ -class AddUserGroupToCourse < ActiveRecord::Migration +class AddUserGroupToCourse < ActiveRecord::Migration[5.1] def change add_reference :courses, :user_group, index: true, foreign_key: true end diff --git a/db/migrate/20170518161825_add_course_offering_to_exercise_collection.rb b/db/migrate/20170518161825_add_course_offering_to_exercise_collection.rb index 5d6e3006..e2f92292 100644 --- a/db/migrate/20170518161825_add_course_offering_to_exercise_collection.rb +++ b/db/migrate/20170518161825_add_course_offering_to_exercise_collection.rb @@ -1,4 +1,4 @@ -class AddCourseOfferingToExerciseCollection < ActiveRecord::Migration +class AddCourseOfferingToExerciseCollection < ActiveRecord::Migration[5.1] def change add_reference :exercise_collections, :course_offering, index: true, foreign_key: true end diff --git a/db/migrate/20170530210400_add_description_to_user_groups.rb b/db/migrate/20170530210400_add_description_to_user_groups.rb index fcc69e43..1a71678e 100644 --- a/db/migrate/20170530210400_add_description_to_user_groups.rb +++ b/db/migrate/20170530210400_add_description_to_user_groups.rb @@ -1,4 +1,4 @@ -class AddDescriptionToUserGroups < ActiveRecord::Migration +class AddDescriptionToUserGroups < ActiveRecord::Migration[5.1] def change add_column :user_groups, :description, :text end diff --git a/db/migrate/20170531150805_create_group_access_requests.rb b/db/migrate/20170531150805_create_group_access_requests.rb index d9118bfa..b32e9ff8 100644 --- a/db/migrate/20170531150805_create_group_access_requests.rb +++ b/db/migrate/20170531150805_create_group_access_requests.rb @@ -1,4 +1,4 @@ -class CreateGroupAccessRequests < ActiveRecord::Migration +class CreateGroupAccessRequests < ActiveRecord::Migration[5.1] def change create_table :group_access_requests do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20170810205035_add_feedback_line_to_test_case_results.rb b/db/migrate/20170810205035_add_feedback_line_to_test_case_results.rb index 187fb1bd..6088d47b 100644 --- a/db/migrate/20170810205035_add_feedback_line_to_test_case_results.rb +++ b/db/migrate/20170810205035_add_feedback_line_to_test_case_results.rb @@ -1,4 +1,4 @@ -class AddFeedbackLineToTestCaseResults < ActiveRecord::Migration +class AddFeedbackLineToTestCaseResults < ActiveRecord::Migration[5.1] def change add_column :test_case_results, :feedback_line_no, :integer, :after => :execution_feedback diff --git a/db/migrate/20170830160216_add_is_hidden_to_course.rb b/db/migrate/20170830160216_add_is_hidden_to_course.rb index 6fcec9ed..8c921836 100644 --- a/db/migrate/20170830160216_add_is_hidden_to_course.rb +++ b/db/migrate/20170830160216_add_is_hidden_to_course.rb @@ -1,4 +1,4 @@ -class AddIsHiddenToCourse < ActiveRecord::Migration +class AddIsHiddenToCourse < ActiveRecord::Migration[5.1] def change add_column :courses, :is_hidden, :boolean, default: false end diff --git a/db/migrate/20170830164617_add_is_hidden_to_organization.rb b/db/migrate/20170830164617_add_is_hidden_to_organization.rb index 48bdf035..1b39f9e7 100644 --- a/db/migrate/20170830164617_add_is_hidden_to_organization.rb +++ b/db/migrate/20170830164617_add_is_hidden_to_organization.rb @@ -1,4 +1,4 @@ -class AddIsHiddenToOrganization < ActiveRecord::Migration +class AddIsHiddenToOrganization < ActiveRecord::Migration[5.1] def change add_column :organizations, :is_hidden, :boolean, default: false end diff --git a/db/migrate/20170920191837_remove_lms_assignment_id_index_from_workout_offerings.rb b/db/migrate/20170920191837_remove_lms_assignment_id_index_from_workout_offerings.rb index 0d9f13ac..2e5e899e 100644 --- a/db/migrate/20170920191837_remove_lms_assignment_id_index_from_workout_offerings.rb +++ b/db/migrate/20170920191837_remove_lms_assignment_id_index_from_workout_offerings.rb @@ -1,4 +1,4 @@ -class RemoveLmsAssignmentIdIndexFromWorkoutOfferings < ActiveRecord::Migration +class RemoveLmsAssignmentIdIndexFromWorkoutOfferings < ActiveRecord::Migration[5.1] def change remove_index :workout_offerings, :lms_assignment_id # remove it to get rid of unique requirement diff --git a/db/migrate/20180718193136_create_visualization_loggings.rb b/db/migrate/20180718193136_create_visualization_loggings.rb index 58a5061c..4824e465 100644 --- a/db/migrate/20180718193136_create_visualization_loggings.rb +++ b/db/migrate/20180718193136_create_visualization_loggings.rb @@ -1,4 +1,4 @@ -class CreateVisualizationLoggings < ActiveRecord::Migration +class CreateVisualizationLoggings < ActiveRecord::Migration[5.1] def change create_table :visualization_loggings do |t| t.references :user, index: true diff --git a/db/migrate/20190131151757_add_attempt_limit_to_workout_offerings.rb b/db/migrate/20190131151757_add_attempt_limit_to_workout_offerings.rb index 4c2339b5..f3a1363a 100644 --- a/db/migrate/20190131151757_add_attempt_limit_to_workout_offerings.rb +++ b/db/migrate/20190131151757_add_attempt_limit_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddAttemptLimitToWorkoutOfferings < ActiveRecord::Migration +class AddAttemptLimitToWorkoutOfferings < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :attempt_limit, :integer, default: nil end diff --git a/db/migrate/20190416161435_add_feedback_times_to_attempt.rb b/db/migrate/20190416161435_add_feedback_times_to_attempt.rb index dbfbc825..2133e42d 100644 --- a/db/migrate/20190416161435_add_feedback_times_to_attempt.rb +++ b/db/migrate/20190416161435_add_feedback_times_to_attempt.rb @@ -1,4 +1,4 @@ -class AddFeedbackTimesToAttempt < ActiveRecord::Migration +class AddFeedbackTimesToAttempt < ActiveRecord::Migration[5.1] def change add_column :attempts, :time_taken, :decimal add_column :attempts, :feedback_timeout, :decimal diff --git a/db/migrate/20190422155326_create_lti_workouts.rb b/db/migrate/20190422155326_create_lti_workouts.rb index 1aaaf6be..a81fd1c6 100644 --- a/db/migrate/20190422155326_create_lti_workouts.rb +++ b/db/migrate/20190422155326_create_lti_workouts.rb @@ -1,4 +1,4 @@ -class CreateLtiWorkouts < ActiveRecord::Migration +class CreateLtiWorkouts < ActiveRecord::Migration[5.1] def change create_table :lti_workouts do |t| t.references :workout, index: true diff --git a/db/migrate/20190712171251_tie_workout_scores_with_lms_instance.rb b/db/migrate/20190712171251_tie_workout_scores_with_lms_instance.rb index 5d964815..f926e721 100644 --- a/db/migrate/20190712171251_tie_workout_scores_with_lms_instance.rb +++ b/db/migrate/20190712171251_tie_workout_scores_with_lms_instance.rb @@ -1,4 +1,4 @@ -class TieWorkoutScoresWithLmsInstance < ActiveRecord::Migration +class TieWorkoutScoresWithLmsInstance < ActiveRecord::Migration[5.1] def change add_reference :lti_workouts, :lms_instance, index: true, foreign_key: true add_reference :workout_scores, :lti_workout, index: true, foreign_key: true From b35161cf38e59f9a346070ee97fefaee00244051 Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Thu, 22 Oct 2020 03:42:30 -0400 Subject: [PATCH 21/53] update Gemfile.lock Signed-off-by: Alex Hicks --- Gemfile.lock | 183 ++++++++++++++++++++++++++------------------------- 1 file changed, 93 insertions(+), 90 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7225552c..fb81cae4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GIT GIT remote: https://github.com/seuros/capistrano-puma.git - revision: 87bfd747bd43a19b5d214e0272b76fb723cf1f5f + revision: b148515f78476b68ab8e09bcc494e82ceb53eba0 specs: capistrano3-puma (4.0.0) capistrano (~> 3.7) @@ -26,66 +26,66 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.2.4.3) - actionpack (= 5.2.4.3) + actioncable (5.2.4.4) + actionpack (= 5.2.4.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.4.3) - actionpack (= 5.2.4.3) - actionview (= 5.2.4.3) - activejob (= 5.2.4.3) + actionmailer (5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.4.3) - actionview (= 5.2.4.3) - activesupport (= 5.2.4.3) + actionpack (5.2.4.4) + actionview (= 5.2.4.4) + activesupport (= 5.2.4.4) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.4.3) - activesupport (= 5.2.4.3) + actionview (5.2.4.4) + activesupport (= 5.2.4.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_record-acts_as (4.0.1) + active_record-acts_as (4.0.3) activerecord (>= 4.2) activesupport (>= 4.2) active_record_union (1.3.0) activerecord (>= 4.0) - activeadmin (2.7.0) + activeadmin (2.8.1) arbre (~> 1.2, >= 1.2.1) - formtastic (~> 3.1) + formtastic (>= 3.1, < 5.0) formtastic_i18n (~> 0.4) inherited_resources (~> 1.7) jquery-rails (~> 4.2) - kaminari (~> 1.0, >= 1.0.1) + kaminari (~> 1.0, >= 1.2.1) railties (>= 5.2, < 6.1) ransack (~> 2.1, >= 2.1.1) sassc-rails (~> 2.1) sprockets (>= 3.0, < 4.1) - activejob (5.2.4.3) - activesupport (= 5.2.4.3) + activejob (5.2.4.4) + activesupport (= 5.2.4.4) globalid (>= 0.3.6) - activemodel (5.2.4.3) - activesupport (= 5.2.4.3) - activerecord (5.2.4.3) - activemodel (= 5.2.4.3) - activesupport (= 5.2.4.3) + activemodel (5.2.4.4) + activesupport (= 5.2.4.4) + activerecord (5.2.4.4) + activemodel (= 5.2.4.4) + activesupport (= 5.2.4.4) arel (>= 9.0) - activestorage (5.2.4.3) - actionpack (= 5.2.4.3) - activerecord (= 5.2.4.3) + activestorage (5.2.4.4) + actionpack (= 5.2.4.4) + activerecord (= 5.2.4.4) marcel (~> 0.3.1) - activesupport (5.2.4.3) + activesupport (5.2.4.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) acts-as-taggable-on (6.5.0) activerecord (>= 5.0, < 6.1) - acts_as_list (1.0.1) + acts_as_list (1.0.2) activerecord (>= 4.2) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) @@ -94,14 +94,15 @@ GEM annotate (3.1.1) activerecord (>= 3.2, < 7.0) rake (>= 10.4, < 14.0) - arbre (1.2.1) - activesupport (>= 3.0.0) + arbre (1.3.0) + activesupport (>= 3.0.0, < 6.1) + ruby2_keywords (>= 0.0.2, < 1.0) arel (9.0.0) - autoprefixer-rails (9.7.6) + autoprefixer-rails (10.0.1.0) execjs awesome_print (1.8.0) - bcrypt (3.1.13) - bootsnap (1.4.6) + bcrypt (3.1.16) + bootsnap (1.4.8) msgpack (~> 1.0) bootstrap-editable-rails (0.0.9) railties (>= 3.1) @@ -115,16 +116,16 @@ GEM builder (3.2.4) byebug (11.1.3) cancancan (3.1.0) - capistrano (3.14.0) + capistrano (3.14.1) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (1.6.0) + capistrano-bundler (2.0.1) capistrano (~> 3.1) - capistrano-rails (1.5.0) + capistrano-rails (1.6.1) capistrano (~> 3.1) - capistrano-bundler (~> 1.1) + capistrano-bundler (>= 1.1, < 3) capistrano-rvm (0.1.2) capistrano (~> 3.0) sshkit (~> 1.2) @@ -154,7 +155,7 @@ GEM celluloid-supervision (0.20.6) timers (>= 4.1.1) choice (0.2.0) - cocoon (1.2.14) + cocoon (1.2.15) codemirror-rails (5.16.0) railties (>= 3.0, < 6.0) coderay (1.1.3) @@ -165,21 +166,21 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.6) + concurrent-ruby (1.1.7) crass (1.0.6) css3-progress-bar-rails (0.5.1) rails (>= 3.1) - csv_shaper (1.3.1) + csv_shaper (1.3.2) activesupport (>= 3.0.0) daemons (1.3.1) - declarative (0.0.10) - devise (4.7.1) + declarative (0.0.20) + devise (4.7.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - diff-lcs (1.3) + diff-lcs (1.4.4) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) erubi (1.9.0) @@ -187,16 +188,17 @@ GEM eventmachine (1.2.7) exception_handler (0.3.45) execjs (2.7.0) - factory_bot (5.2.0) - activesupport (>= 4.2.0) - factory_bot_rails (5.2.0) - factory_bot (~> 5.2.0) - railties (>= 4.2.0) - faker (2.12.0) + factory_bot (6.1.0) + activesupport (>= 5.0.0) + factory_bot_rails (6.1.0) + factory_bot (~> 6.1.0) + railties (>= 5.0.0) + faker (2.14.0) i18n (>= 1.6, < 2) - faraday (1.0.1) + faraday (1.1.0) multipart-post (>= 1.2, < 3) - ffi (1.13.0) + ruby2_keywords + ffi (1.13.1) font-awesome-rails (4.7.0.5) railties (>= 3.2, < 6.1) formtastic (3.1.5) @@ -204,12 +206,12 @@ GEM formtastic-bootstrap (3.1.1) formtastic (>= 3.0) formtastic_i18n (0.6.0) - friendly_id (5.3.0) + friendly_id (5.4.0) activerecord (>= 4.0.0) globalid (0.4.2) activesupport (>= 4.2.0) gravtastic (3.2.6) - haml (5.1.2) + haml (5.2.0) temple (>= 0.8.0) tilt haml-rails (2.0.1) @@ -230,7 +232,7 @@ GEM http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) - i18n (1.8.3) + i18n (1.8.5) concurrent-ruby (~> 1.0) immigrant (0.3.6) activerecord (>= 3.0) @@ -251,7 +253,7 @@ GEM js-routes (1.4.9) railties (>= 4) sprockets-rails - jwt (2.2.1) + jwt (2.2.2) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -268,7 +270,7 @@ GEM rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) log_file (0.0.3) - loofah (2.6.0) + loofah (2.7.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -282,21 +284,21 @@ GEM mimemagic (0.3.5) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.14.1) + minitest (5.14.2) modernizr-rails (2.7.1) momentjs-rails (2.20.1) railties (>= 3.1) msgpack (1.3.3) - multi_json (1.14.1) + multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) mysql2 (0.5.3) net-scp (3.0.0) net-ssh (>= 2.6.5, < 7.0.0) - net-ssh (6.0.2) + net-ssh (6.1.0) netrc (0.11.0) - nio4r (2.5.2) - nokogiri (1.10.9) + nio4r (2.5.4) + nokogiri (1.10.10) mini_portile2 (~> 2.4.0) oauth (0.5.4) oauth2 (1.4.4) @@ -314,14 +316,14 @@ GEM addressable (~> 2.3) nokogiri (~> 1.5) omniauth (~> 1.2) - omniauth-facebook (6.0.0) + omniauth-facebook (8.0.0) omniauth-oauth2 (~> 1.2) omniauth-google-oauth2 (0.8.0) jwt (>= 2.0) omniauth (>= 1.1.1) omniauth-oauth2 (>= 1.6) - omniauth-oauth2 (1.6.0) - oauth2 (~> 1.1) + omniauth-oauth2 (1.7.0) + oauth2 (~> 1.4) omniauth (~> 1.9) orm_adapter (0.5.0) polyamorous (2.3.2) @@ -330,35 +332,35 @@ GEM pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) - public_suffix (4.0.5) - puma (4.3.5) + public_suffix (4.0.6) + puma (4.3.6) nio4r (~> 2.0) rabl (0.14.3) activesupport (>= 2.3.14) - rack (2.2.2) + rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.4.3) - actioncable (= 5.2.4.3) - actionmailer (= 5.2.4.3) - actionpack (= 5.2.4.3) - actionview (= 5.2.4.3) - activejob (= 5.2.4.3) - activemodel (= 5.2.4.3) - activerecord (= 5.2.4.3) - activestorage (= 5.2.4.3) - activesupport (= 5.2.4.3) + rails (5.2.4.4) + actioncable (= 5.2.4.4) + actionmailer (= 5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) + activemodel (= 5.2.4.4) + activerecord (= 5.2.4.4) + activestorage (= 5.2.4.4) + activesupport (= 5.2.4.4) bundler (>= 1.3.0) - railties (= 5.2.4.3) + railties (= 5.2.4.4) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - railties (5.2.4.3) - actionpack (= 5.2.4.3) - activesupport (= 5.2.4.3) + railties (5.2.4.4) + actionpack (= 5.2.4.4) + activesupport (= 5.2.4.4) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) @@ -373,7 +375,7 @@ GEM ffi (~> 1.0) rdoc (6.2.1) redcarpet (3.5.0) - regexp_parser (1.7.1) + regexp_parser (1.8.2) remotipart (1.4.4) representable (2.4.1) declarative (~> 0.0.5) @@ -388,7 +390,7 @@ GEM mime-types (>= 1.16, < 4.0) netrc (~> 0.8) rexml (3.2.4) - rspec-core (3.9.2) + rspec-core (3.9.3) rspec-support (~> 3.9.3) rspec-expectations (3.9.2) diff-lcs (>= 1.2.0, < 2.0) @@ -407,7 +409,8 @@ GEM rspec-support (3.9.3) ruby-graphviz (1.2.5) rexml - ruby_parser (3.14.2) + ruby2_keywords (0.0.2) + ruby_parser (3.15.0) sexp_processor (~> 4.9) rubyzip (2.3.0) sass (3.7.4) @@ -427,11 +430,11 @@ GEM tilt sdoc (1.1.0) rdoc (>= 5.0) - sexp_processor (4.14.1) + sexp_processor (4.15.1) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.1) + sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) @@ -451,7 +454,7 @@ GEM thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) - timers (4.3.0) + timers (4.3.2) truncate_html (0.9.3) tzinfo (1.2.7) thread_safe (~> 0.1) @@ -462,9 +465,9 @@ GEM unf_ext unf_ext (0.0.7.7) wannabe_bool (0.7.1) - warden (1.2.8) - rack (>= 2.0.6) - websocket-driver (0.7.2) + warden (1.2.9) + rack (>= 2.0.9) + websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) From c2ac77107d6ccf818b242367cee1a886ab1543ee Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Thu, 22 Oct 2020 03:42:56 -0400 Subject: [PATCH 22/53] update Dockerfile Signed-off-by: Alex Hicks --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3785f28f..2edd4673 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,6 +42,8 @@ RUN apt-get update -qq \ python-feedvalidator \ python-sphinx \ ant \ + default-jre \ + default-jdk \ && pip install --upgrade pip # install rubygems @@ -72,7 +74,4 @@ RUN find ./runservers.sh -type f -exec chmod +x {} \; EXPOSE 80 -## JAVA INSTALLATION -RUN apt-get install -y default-jre default-jdk - CMD ["bash", "./runservers.sh"] From 9afd3d33c61e7819c214e7c849a02e3f81d4d8e1 Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Thu, 22 Oct 2020 03:43:17 -0400 Subject: [PATCH 23/53] change runservers for dev Signed-off-by: Alex Hicks --- runservers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runservers.sh b/runservers.sh index ad5ebf1b..0b584218 100755 --- a/runservers.sh +++ b/runservers.sh @@ -1 +1 @@ -RUBYOPT='-W:no-deprecated' RAILS_ENV=development bundle exec thin start --ssl --ssl-key-file server.key --ssl-cert-file server.crt -p 9292 --debug +RUBYOPT='-W:no-deprecated' RAILS_ENV=development bundle exec thin start -p 9292 --debug \ No newline at end of file From 01ed81a7a68eea75a8deb43d81dfbabfea8294f4 Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Thu, 12 Nov 2020 02:29:12 -0500 Subject: [PATCH 24/53] updated exception_handler and rails 5.1 Signed-off-by: Alex Hicks --- Gemfile | 2 +- Gemfile.lock | 7 +++++-- config/application.rb | 3 ++- config/initializers/exception_handler.rb | 8 -------- 4 files changed, 8 insertions(+), 12 deletions(-) delete mode 100644 config/initializers/exception_handler.rb diff --git a/Gemfile b/Gemfile index 95768648..ea753c6e 100644 --- a/Gemfile +++ b/Gemfile @@ -82,7 +82,7 @@ gem 'omniauth-google-oauth2' gem 'omniauth-cas' gem 'cancancan' gem 'activeadmin' -gem 'exception_handler', '= 0.3.45' +gem 'exception_handler', '~> 0.8.0.0' gem 'kaminari', '~> 1.2.1' # Auto-paginated views gem 'remotipart' # Adds support for remote mulitpart forms (file uploads) diff --git a/Gemfile.lock b/Gemfile.lock index fb81cae4..c5dd81d0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -186,7 +186,10 @@ GEM erubi (1.9.0) erubis (2.7.0) eventmachine (1.2.7) - exception_handler (0.3.45) + exception_handler (0.8.0.0) + bundler + rails (>= 4.2.0) + responders execjs (2.7.0) factory_bot (6.1.0) activesupport (>= 5.0.0) @@ -506,7 +509,7 @@ DEPENDENCIES css3-progress-bar-rails csv_shaper devise - exception_handler (= 0.3.45) + exception_handler (~> 0.8.0.0) factory_bot_rails faker font-awesome-rails diff --git a/config/application.rb b/config/application.rb index 2ff74cf1..9dad7b3a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -17,7 +17,8 @@ class Application < Rails::Application # exception_handler configuration (no longer relies on an initializer) config.exception_handler = { - db: true + db: true, + dev: true } # Timeout for feedback polls (milliseconds) diff --git a/config/initializers/exception_handler.rb b/config/initializers/exception_handler.rb deleted file mode 100644 index a3b7c540..00000000 --- a/config/initializers/exception_handler.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Exception Handler -### -# You can add different settings using this block -# Use the docs at http://github.com/richpeck/exception_handler for info -### -ExceptionHandler.setup do |config| - config.db = true -end From 2e0f4899ec425ff6d187c984e848c31f8f143117 Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Thu, 12 Nov 2020 05:59:49 -0500 Subject: [PATCH 25/53] added ssl for testing Signed-off-by: Alex Hicks --- runservers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runservers.sh b/runservers.sh index 0b584218..2a736353 100755 --- a/runservers.sh +++ b/runservers.sh @@ -1 +1 @@ -RUBYOPT='-W:no-deprecated' RAILS_ENV=development bundle exec thin start -p 9292 --debug \ No newline at end of file +RUBYOPT='-W:no-deprecated' RAILS_ENV=development bundle exec thin start --ssl --ssl-key-file server.key --ssl-cert-file server.crt -p 9292 --debug \ No newline at end of file From 9b71517089eb6dacca751bbbe097fde69f09a7bd Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Thu, 12 Nov 2020 11:22:26 -0500 Subject: [PATCH 26/53] removed ssl Signed-off-by: Alex Hicks --- runservers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runservers.sh b/runservers.sh index 2a736353..0b584218 100755 --- a/runservers.sh +++ b/runservers.sh @@ -1 +1 @@ -RUBYOPT='-W:no-deprecated' RAILS_ENV=development bundle exec thin start --ssl --ssl-key-file server.key --ssl-cert-file server.crt -p 9292 --debug \ No newline at end of file +RUBYOPT='-W:no-deprecated' RAILS_ENV=development bundle exec thin start -p 9292 --debug \ No newline at end of file From aeb7de45c3971dbf1185e31939dcaa1df99f4033 Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Tue, 17 Nov 2020 02:24:29 -0500 Subject: [PATCH 27/53] update gemfile Signed-off-by: Alex Hicks --- Gemfile | 3 +-- Gemfile.lock | 46 ++++++++++++++++++++++------------------------ db/schema.rb | 37 ++++++++++++++++++++++--------------- 3 files changed, 45 insertions(+), 41 deletions(-) diff --git a/Gemfile b/Gemfile index 94c1db03..d94ad4c8 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' gem 'rails', '~> 5.1' -gem 'sprockets', '~> 3.7.2' # 4.0 requires ruby 2.5 +gem 'sprockets', '< 4.0.0' gem 'bootstrap-sass', '~> 3.2.0' gem 'jquery-rails' gem 'jquery-ui-rails' @@ -123,4 +123,3 @@ gem 'rest-client' # Gems for cookie updates gem 'user_agent_parser' # 2.6 requires ruby 2.4 gem 'rails_same_site_cookie' -gem 'sprockets', '< 4.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index 46654a4e..434c7c3c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,12 +6,12 @@ GIT GIT remote: https://github.com/seuros/capistrano-puma.git - revision: b148515f78476b68ab8e09bcc494e82ceb53eba0 + revision: f8093ad3e68e67390d0ffeb5f50830b1587973f9 specs: - capistrano3-puma (4.0.0) + capistrano3-puma (5.0.0.beta1) capistrano (~> 3.7) capistrano-bundler - puma (~> 4.0) + puma (>= 4.0, < 6.0) GIT remote: https://github.com/voormedia/rails-erd.git @@ -98,11 +98,11 @@ GEM activesupport (>= 3.0.0, < 6.1) ruby2_keywords (>= 0.0.2, < 1.0) arel (9.0.0) - autoprefixer-rails (10.0.1.0) + autoprefixer-rails (10.0.2.0) execjs awesome_print (1.8.0) bcrypt (3.1.16) - bootsnap (1.4.8) + bootsnap (1.5.1) msgpack (~> 1.0) bootstrap-editable-rails (0.0.9) railties (>= 3.1) @@ -209,7 +209,7 @@ GEM formtastic-bootstrap (3.1.1) formtastic (>= 3.0) formtastic_i18n (0.6.0) - friendly_id (5.4.0) + friendly_id (5.4.1) activerecord (>= 4.0.0) globalid (0.4.2) activesupport (>= 4.2.0) @@ -269,7 +269,7 @@ GEM activerecord kaminari-core (= 1.2.1) kaminari-core (1.2.1) - listen (3.2.1) + listen (3.3.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) log_file (0.0.3) @@ -283,7 +283,7 @@ GEM method_source (1.0.0) mime-types (3.3.1) mime-types-data (~> 3.2015) - mime-types-data (3.2020.0512) + mime-types-data (3.2020.1104) mimemagic (0.3.5) mini_mime (1.0.2) mini_portile2 (2.4.0) @@ -295,7 +295,7 @@ GEM multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) - mysql2 (0.5.3) + mysql2 (0.4.10) net-scp (3.0.0) net-ssh (>= 2.6.5, < 7.0.0) net-ssh (6.1.0) @@ -361,15 +361,15 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) + rails_same_site_cookie (0.1.8) + rack (>= 1.5) + user_agent_parser (~> 2.5) railties (5.2.4.4) actionpack (= 5.2.4.4) activesupport (= 5.2.4.4) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) - rails_same_site_cookie (0.1.8) - rack (>= 1.5) - user_agent_parser (~> 2.5) rake (13.0.1) ransack (2.3.2) activerecord (>= 5.2.1) @@ -396,14 +396,14 @@ GEM mime-types (>= 1.16, < 4.0) netrc (~> 0.8) rexml (3.2.4) - rspec-core (3.9.3) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.2) + rspec-core (3.10.0) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.1) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) + rspec-support (~> 3.10.0) rspec-rails (4.0.1) actionpack (>= 4.2) activesupport (>= 4.2) @@ -412,7 +412,7 @@ GEM rspec-expectations (~> 3.9) rspec-mocks (~> 3.9) rspec-support (~> 3.9) - rspec-support (3.9.3) + rspec-support (3.10.0) ruby-graphviz (1.2.5) rexml ruby2_keywords (0.0.2) @@ -434,7 +434,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - sdoc (1.1.0) + sdoc (2.0.2) rdoc (>= 5.0) sexp_processor (4.15.1) sprockets (3.7.2) @@ -462,7 +462,7 @@ GEM tilt (2.0.10) timers (4.3.2) truncate_html (0.9.3) - tzinfo (1.2.7) + tzinfo (1.2.8) thread_safe (~> 0.1) uber (0.0.15) uglifier (4.2.0) @@ -470,9 +470,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.7) - unicode-display_width (1.6.0) - unicode_utils (1.4.0) - user_agent_parser (2.5.1) + user_agent_parser (2.7.0) wannabe_bool (0.7.1) warden (1.2.9) rack (>= 2.0.9) diff --git a/db/schema.rb b/db/schema.rb index 1519d7f0..766f469b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2019_07_12_171251) do +ActiveRecord::Schema.define(version: 2020_09_29_144816) do create_table "active_admin_comments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.string "namespace" @@ -241,6 +241,14 @@ t.index ["is_public"], name: "index_exercises_on_is_public" end + create_table "exercises_tags", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + t.bigint "exercise_id" + t.bigint "tag_id" + t.index ["exercise_id", "tag_id"], name: "index_exercises_tags_on_exercise_id_and_tag_id", unique: true + t.index ["exercise_id"], name: "index_exercises_tags_on_exercise_id" + t.index ["tag_id"], name: "index_exercises_tags_on_tag_id" + end + create_table "friendly_id_slugs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.string "slug", default: "", null: false t.integer "sluggable_id", null: false @@ -288,6 +296,12 @@ t.float "discrimination", null: false end + create_table "languages", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "license_policies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.string "name" t.text "description" @@ -320,10 +334,6 @@ t.index ["url"], name: "index_lms_instances_on_url", unique: true end - add_index "lms_instances", ["lms_type_id"], name: "lms_instances_lms_type_id_fk", using: :btree - add_index "lms_instances", ["organization_id"], name: "index_lms_instances_on_organization_id", using: :btree - add_index "lms_instances", ["url"], name: "index_lms_instances_on_url", unique: true, using: :btree - create_table "lms_types", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.string "name", default: "", null: false t.datetime "created_at" @@ -459,20 +469,17 @@ t.string "tagger_type" t.string "context", limit: 128 t.datetime "created_at" + t.index ["context"], name: "index_taggings_on_context" t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true + t.index ["tag_id"], name: "index_taggings_on_tag_id" t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" + t.index ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy" + t.index ["taggable_id"], name: "index_taggings_on_taggable_id" + t.index ["taggable_type"], name: "index_taggings_on_taggable_type" + t.index ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type" + t.index ["tagger_id"], name: "index_taggings_on_tagger_id" end - add_index "taggings", ["context"], name: "index_taggings_on_context", using: :btree - add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree - add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree - add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree - add_index "taggings", ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy", using: :btree - add_index "taggings", ["taggable_id"], name: "index_taggings_on_taggable_id", using: :btree - add_index "taggings", ["taggable_type"], name: "index_taggings_on_taggable_type", using: :btree - add_index "taggings", ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type", using: :btree - add_index "taggings", ["tagger_id"], name: "index_taggings_on_tagger_id", using: :btree - create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.string "name" t.integer "taggings_count", default: 0 From 256ac4bc81852787644aaa1a24d63752140cc9ce Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Tue, 17 Nov 2020 02:39:27 -0500 Subject: [PATCH 28/53] update schema.rb --- db/schema.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 1cf86be3..766f469b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -336,7 +336,6 @@ create_table "lms_types", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.string "name", default: "", null: false - t.datetime "created_at" t.datetime "updated_at" t.index ["name"], name: "index_lms_types_on_name", unique: true @@ -355,7 +354,6 @@ create_table "lti_workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.integer "workout_id" t.string "lms_assignment_id", null: false - t.datetime "created_at" t.datetime "updated_at" t.integer "lms_instance_id" From 6143893d9113dc245133a5b7082355e66f8044f9 Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Thu, 29 Jul 2021 10:27:54 -0400 Subject: [PATCH 29/53] bundle updates for yanked gem Signed-off-by: Alex Hicks --- Gemfile.lock | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 434c7c3c..4fc688e1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -284,7 +284,9 @@ GEM mime-types (3.3.1) mime-types-data (~> 3.2015) mime-types-data (3.2020.1104) - mimemagic (0.3.5) + mimemagic (0.3.10) + nokogiri (~> 1) + rake mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.2) From bbb909f06380bd86591bfeceba8e93da27b92d9d Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Thu, 29 Jul 2021 15:09:47 -0400 Subject: [PATCH 30/53] dockerfile updates Signed-off-by: Alex Hicks --- Dockerfile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2edd4673..9d655d27 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ MAINTAINER Jihane Najdi # Default environment ARG RAILS_ENV='development' -# Ruby changed the way optional params are done, but Rails hasn't caught up +# Ruby changed the way optional params are done, but Rails hasn't caught up ARG RUBYOPT='-W:no-deprecated' ARG BASEDIR='/code-workout/' @@ -47,15 +47,13 @@ RUN apt-get update -qq \ && pip install --upgrade pip # install rubygems -ENV GEM_HOME /usr/local/bundle -ENV PATH $GEM_HOME/bin:$PATH ENV BUNDLER_VERSION 2.1.4 ENV RAILS_ENV=$RAILS_ENV -RUN gem install bundler -v $BUNDLER_VERSION \ - && bundle config --global path "$GEM_HOME" \ - && bundle config --global bin "$GEM_HOME/bin" \ - && bundle config git.allow_insecure true +RUN gem install bundler -v $BUNDLER_VERSION #\ +# && bundle config --global path "$GEM_HOME" \ +# && bundle config --global bin "$GEM_HOME/bin" \ +# && bundle config git.allow_insecure true VOLUME ${BASEDIR} WORKDIR ${BASEDIR} @@ -63,8 +61,9 @@ WORKDIR ${BASEDIR} COPY Gemfile Gemfile COPY Gemfile.lock Gemfile.lock -RUN bundle update -RUN bundle check || bundle install +#RUN bundle update +#RUN bundle check || bundle install +RUN bundle install COPY runservers.sh runservers.sh From 36fda2eac26225aee5d5beeb0860d0c7d4bedd94 Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Fri, 30 Jul 2021 09:38:43 -0400 Subject: [PATCH 31/53] fix merge issues Signed-off-by: Alex Hicks --- Dockerfile | 9 +++------ Gemfile.lock | 11 ++--------- config/application.rb | 2 -- db/schema.rb | 14 +------------- 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/Dockerfile b/Dockerfile index ad7fccd3..29bcd94e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ MAINTAINER Jihane Najdi ARG RAILS_ENV='development' # Ruby changed the way optional params are done, but Rails hasn't caught up ARG RUBYOPT='-W:no-deprecated' -ARG BASEDIR='/code-workout/' +ARG BASEDIR='/code-workout' ENV TZ=America/New_York RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone @@ -53,10 +53,7 @@ RUN apt-get install -y default-jre default-jdk ENV BUNDLER_VERSION 2.1.4 ENV RAILS_ENV=$RAILS_ENV -RUN gem install bundler -v $BUNDLER_VERSION #\ -# && bundle config --global path "$GEM_HOME" \ -# && bundle config --global bin "$GEM_HOME/bin" \ -# && bundle config git.allow_insecure true +RUN gem install bundler -v $BUNDLER_VERSION COPY Gemfile Gemfile COPY Gemfile.lock Gemfile.lock @@ -65,7 +62,7 @@ COPY Gemfile.lock Gemfile.lock #RUN bundle check || bundle install RUN bundle install -VOLUME ${BASEDIR} +#VOLUME ${BASEDIR} WORKDIR ${BASEDIR} COPY runservers.sh runservers.sh diff --git a/Gemfile.lock b/Gemfile.lock index 66072746..12c5ccc6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -190,7 +190,6 @@ GEM domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) ed25519 (1.2.4) - equatable (0.6.1) erubi (1.9.0) erubis (2.7.0) eventmachine (1.2.7) @@ -297,6 +296,7 @@ GEM mimemagic (0.3.10) nokogiri (~> 1) rake + mini_magick (4.11.0) mini_mime (1.0.2) mini_portile2 (2.4.0) minitest (5.14.2) @@ -461,11 +461,6 @@ GEM net-scp (>= 1.1.2) net-ssh (>= 2.8.0) ssrf_filter (1.0.7) - strings (0.1.5) - strings-ansi (~> 0.1) - unicode-display_width (~> 1.5) - unicode_utils (~> 1.4) - strings-ansi (0.1.0) sucker_punch (1.6.0) celluloid (~> 0.17.2) temple (0.8.2) @@ -489,8 +484,6 @@ GEM unf_ext unf_ext (0.0.7.7) user_agent_parser (2.7.0) - unicode-display_width (1.6.0) - unicode_utils (1.4.0) wannabe_bool (0.7.1) warden (1.2.9) rack (>= 2.0.9) @@ -535,8 +528,8 @@ DEPENDENCIES css3-progress-bar-rails csv_shaper devise - exception_handler (~> 0.8.0.0) ed25519 + exception_handler (~> 0.8.0.0) factory_bot_rails faker font-awesome-rails diff --git a/config/application.rb b/config/application.rb index ce5a41fb..4d058501 100644 --- a/config/application.rb +++ b/config/application.rb @@ -26,8 +26,6 @@ class Application < Rails::Application config.feedback_timeout = 1700 config.feedback_timeout_padding = 300 - config.active_record.raise_in_transactional_callbacks = true - # Allow iframe embedding? config.action_dispatch.default_headers.merge!( {'X-Frame-Options' => 'ALLOWALL'}) diff --git a/db/schema.rb b/db/schema.rb index e945124e..7e4b9404 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -334,10 +334,6 @@ t.index ["url"], name: "index_lms_instances_on_url", unique: true end - add_index "lms_instances", ["lms_type_id"], name: "lms_instances_lms_type_id_fk", using: :btree - add_index "lms_instances", ["organization_id"], name: "index_lms_instances_on_organization_id", using: :btree - add_index "lms_instances", ["url"], name: "index_lms_instances_on_url", unique: true, using: :btree - create_table "lms_types", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.string "name", default: "", null: false t.datetime "created_at" @@ -355,9 +351,6 @@ t.index ["user_id"], name: "index_lti_identities_on_user_id" end - add_index "lti_identities", ["lms_instance_id"], name: "index_lti_identities_on_lms_instance_id", using: :btree - add_index "lti_identities", ["user_id"], name: "index_lti_identities_on_user_id", using: :btree - create_table "lti_workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.integer "workout_id" t.string "lms_assignment_id", null: false @@ -393,8 +386,6 @@ t.index ["slug"], name: "index_organizations_on_slug", unique: true end - add_index "organizations", ["slug"], name: "index_organizations_on_slug", unique: true, using: :btree - create_table "ownerships", force: :cascade do |t| t.string "filename", limit: 255 t.integer "resource_file_id", limit: 4 @@ -443,12 +434,9 @@ t.string "hashval", limit: 255 t.index ["token"], name: "index_resource_files_on_token" t.index ["user_id"], name: "index_resource_files_on_user_id" + t.index ["hashval"], name: "index_resource_files_on_hashval" end - add_index "resource_files", ["hashval"], name: "index_resource_files_on_hashval", using: :btree - add_index "resource_files", ["token"], name: "index_resource_files_on_token", using: :btree - add_index "resource_files", ["user_id"], name: "index_resource_files_on_user_id", using: :btree - create_table "signups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.string "first_name" t.string "last_name_name" From d8ce07af36fab7b8cb97629cb9b79886e1320a95 Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Fri, 30 Jul 2021 15:35:15 -0400 Subject: [PATCH 32/53] update schema and remove broken parameter Signed-off-by: Alex Hicks --- app/views/sse/_ajax_feedback.html.haml | 4 ++-- app/views/sse/feedback_update.js.coffee | 2 +- db/schema.rb | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/sse/_ajax_feedback.html.haml b/app/views/sse/_ajax_feedback.html.haml index 44ca3973..54a15721 100644 --- a/app/views/sse/_ajax_feedback.html.haml +++ b/app/views/sse/_ajax_feedback.html.haml @@ -50,7 +50,7 @@ %tbody - has_hidden = false - hidden_pass = true - - answer.test_case_results(true).each do |tcr| + - answer.test_case_results().each do |tcr| - if tcr.test_case.hidden? - has_hidden = true - hidden_pass = hidden_pass && tcr.pass @@ -85,7 +85,7 @@ %th.text-center Result %tbody - if examples.any? - - answer.test_case_results(true).each do |tcr| + - answer.test_case_results().each do |tcr| - if tcr.test_case.is_example? %tr %td diff --git a/app/views/sse/feedback_update.js.coffee b/app/views/sse/feedback_update.js.coffee index 481933cf..d327cc77 100644 --- a/app/views/sse/feedback_update.js.coffee +++ b/app/views/sse/feedback_update.js.coffee @@ -27,7 +27,7 @@ if attempt_error_line_no addLineWidget(editor, '<%= @attempt.prompt_answers.first.specific.error %>', attempt_error_line_no, 'error') -tcrs = <%= raw @attempt.prompt_answers.first.specific.test_case_results(true). +tcrs = <%= raw @attempt.prompt_answers.first.specific.test_case_results(). where.not(execution_feedback: :null). select("test_case_id, execution_feedback, feedback_line_no").to_json %>; for tcr in tcrs diff --git a/db/schema.rb b/db/schema.rb index 7e4b9404..60e1b473 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -75,6 +75,7 @@ create_table "coding_prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| t.text "answer" t.text "error" + t.integer "error_line_no" end create_table "coding_prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| @@ -516,6 +517,7 @@ t.integer "test_case_id", null: false t.integer "user_id", null: false t.text "execution_feedback" + t.integer "feedback_line_no" t.datetime "created_at" t.datetime "updated_at" t.boolean "pass", null: false From fabdf505f4804e4f4d81c8327c241744565d4371 Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Tue, 1 Feb 2022 10:23:30 -0800 Subject: [PATCH 33/53] Remove "try it here" link in notice after exercise is created or updated. The user is already redirected to the exercise practice page, so the link is redundant. --- app/controllers/exercises_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 767aea22..f19e9795 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -447,7 +447,7 @@ def upload_create # Notify user of success success_msgs << - "
  • X#{e.id}: #{e.name} saved, try it #{view_context.link_to 'here', exercise_practice_path(e)}.
  • " + "
  • X#{e.id}: #{e.name} saved
  • " end end From 7ad6d8d88ddf527270f6bc15a50edbadcc01b4e2 Mon Sep 17 00:00:00 2001 From: Ayaan Kazerouni Date: Thu, 3 Feb 2022 10:56:09 -0800 Subject: [PATCH 34/53] Update Dockerfile to place Gemfile at appropriate location Update some gems --- Dockerfile | 12 +- Gemfile.lock | 355 ++++++++++++++++++++++++++------------------------- 2 files changed, 188 insertions(+), 179 deletions(-) diff --git a/Dockerfile b/Dockerfile index eb9b6c79..52e145d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone #install 'development tools' build-essential dkms curl libxslt-dev libpq-dev python-dev python-pip python-feedvalidator python-software-properties python-sphinx libmariadbclient-dev libcurl4-gnutls-dev libevent-dev libffi-dev libssl-dev stunnel4 libsqlite3-dev # libmariadbclient-dev RUN apt-get update -qq \ - && apt-get install -y \ + && apt-get install -y --fix-missing \ apt-utils \ build-essential \ libpq-dev \ @@ -56,14 +56,14 @@ RUN gem install bundler -v $BUNDLER_VERSION \ && bundle config --global bin "$GEM_HOME/bin" \ && bundle config git.allow_insecure true -COPY Gemfile Gemfile -COPY Gemfile.lock Gemfile.lock - -RUN bundle install - VOLUME ${BASEDIR} WORKDIR ${BASEDIR} +COPY Gemfile ${BASEDIR}/Gemfile +COPY Gemfile.lock ${BASEDIR}/Gemfile.lock + +RUN bundle install + COPY runservers.sh runservers.sh RUN find /code-workout -type d -exec chmod 2775 {} \; diff --git a/Gemfile.lock b/Gemfile.lock index 6d7ffafa..380752ea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,18 +6,18 @@ GIT GIT remote: git://github.com/seuros/capistrano-puma.git - revision: 6112323390cff15539d947882d72d937622cfdf4 + revision: f9801f6762d152c5d9da18ce726c7561cc4f9a8b specs: - capistrano3-puma (4.0.0) + capistrano3-puma (5.2.0) capistrano (~> 3.7) capistrano-bundler - puma (~> 4.0) + puma (>= 4.0, < 6.0) GIT remote: git://github.com/voormedia/rails-erd.git - revision: 0fbb1cdf2c84b06afd12974baace8d512bb798da + revision: e41243f6d33303bfc9bdc1cff159bb1986cbee22 specs: - rails-erd (1.6.0) + rails-erd (1.6.1) activerecord (>= 4.2) activesupport (>= 4.2) choice (~> 0.2.0) @@ -45,9 +45,9 @@ GEM erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_record-acts_as (3.1.0) - activerecord (>= 4.2, < 5.2.2.rc1) - activesupport (>= 4.2, < 5.2.2.rc1) + active_record-acts_as (4.0.3) + activerecord (>= 4.2) + activesupport (>= 4.2) active_record_union (1.3.0) activerecord (>= 4.0) activeadmin (1.4.3) @@ -79,22 +79,23 @@ GEM tzinfo (~> 1.1) acts-as-taggable-on (5.0.0) activerecord (>= 4.2.8) - acts_as_list (0.9.19) - activerecord (>= 3.0) - addressable (2.6.0) - public_suffix (>= 2.0.2, < 4.0) - airbrussh (1.3.2) + acts_as_list (1.0.4) + activerecord (>= 4.2) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - annotate (2.7.5) + annotate (3.1.1) activerecord (>= 3.2, < 7.0) - rake (>= 10.4, < 13.0) - arbre (1.2.1) - activesupport (>= 3.0.0) + rake (>= 10.4, < 14.0) + arbre (1.4.0) + activesupport (>= 3.0.0, < 6.2) + ruby2_keywords (>= 0.0.2, < 1.0) arel (6.0.4) - autoprefixer-rails (9.6.0) - execjs - awesome_print (1.8.0) - bcrypt (3.1.13) + autoprefixer-rails (10.4.2.0) + execjs (~> 2) + awesome_print (1.9.2) + bcrypt (3.1.16) bcrypt_pbkdf (1.1.0) bootstrap-editable-rails (0.0.9) railties (>= 3.1) @@ -106,28 +107,29 @@ GEM bootstrap3-datetimepicker-rails (4.17.47) momentjs-rails (>= 2.8.1) builder (3.2.4) - byebug (11.0.1) - cancancan (3.0.1) - capistrano (3.11.0) + byebug (11.1.3) + cancancan (3.3.0) + capistrano (3.16.0) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (1.6.0) + capistrano-bundler (2.0.1) capistrano (~> 3.1) - capistrano-rails (1.4.0) + capistrano-rails (1.6.1) capistrano (~> 3.1) - capistrano-bundler (~> 1.1) + capistrano-bundler (>= 1.1, < 3) capistrano-rvm (0.1.2) capistrano (~> 3.0) sshkit (~> 1.2) - capybara (3.15.1) + capybara (3.36.0) addressable + matrix mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - regexp_parser (~> 1.2) + regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) carrierwave (1.3.2) activemodel (>= 4.0.0) @@ -152,10 +154,10 @@ GEM celluloid-supervision (0.20.6) timers (>= 4.1.1) choice (0.2.0) - cocoon (1.2.14) + cocoon (1.2.15) codemirror-rails (5.16.0) railties (>= 3.0, < 6.0) - coderay (1.1.2) + coderay (1.1.3) coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) @@ -163,57 +165,72 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.6) + concurrent-ruby (1.1.9) crass (1.0.6) css3-progress-bar-rails (0.5.1) rails (>= 3.1) - csv_shaper (1.3.0) + csv_shaper (1.3.2) activesupport (>= 3.0.0) - daemons (1.3.1) - declarative (0.0.10) - devise (4.7.1) + daemons (1.4.1) + declarative (0.0.20) + devise (4.8.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - diff-lcs (1.3) - domain_name (0.5.20180417) + diff-lcs (1.5.0) + domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - ed25519 (1.2.4) - equatable (0.6.1) + ed25519 (1.3.0) erubis (2.7.0) eventmachine (1.2.7) exception_handler (0.3.45) - execjs (2.7.0) - factory_bot (5.0.2) + execjs (2.8.1) + factory_bot (5.2.0) activesupport (>= 4.2.0) - factory_bot_rails (5.0.2) - factory_bot (~> 5.0.2) + factory_bot_rails (5.2.0) + factory_bot (~> 5.2.0) railties (>= 4.2.0) - faker (1.9.4) - i18n (>= 0.7) - pastel (~> 0.7.2) - thor (~> 0.20.0) - tty-pager (~> 0.12.0) - tty-screen (~> 0.6.5) - tty-tree (~> 0.3.0) - faraday (0.15.4) + faker (2.2.1) + i18n (>= 0.8) + faraday (1.9.3) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.3) multipart-post (>= 1.2, < 3) - ffi (1.11.1) - font-awesome-rails (4.7.0.5) - railties (>= 3.2, < 6.1) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + ffi (1.15.5) + font-awesome-rails (4.7.0.8) + railties (>= 3.2, < 8.0) formtastic (3.1.5) actionpack (>= 3.2.13) formtastic-bootstrap (3.1.1) formtastic (>= 3.0) - formtastic_i18n (0.6.0) - friendly_id (5.2.5) + formtastic_i18n (0.7.0) + friendly_id (5.4.2) activerecord (>= 4.0.0) globalid (0.4.2) activesupport (>= 4.2.0) gravtastic (3.2.6) - haml (5.1.1) + haml (5.2.2) temple (>= 0.8.0) tilt haml-rails (1.0.0) @@ -225,13 +242,14 @@ GEM has_scope (0.7.2) actionpack (>= 4.1) activesupport (>= 4.1) - hashie (3.6.0) + hashie (5.0.0) html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) nokogiri (>= 1.6.0) ruby_parser (~> 3.5) - http-cookie (1.0.3) + http-accept (1.7.0) + http-cookie (1.0.4) domain_name (~> 0.5) i18n (0.9.5) concurrent-ruby (~> 1.0) @@ -247,95 +265,93 @@ GEM has_scope (~> 0.6) railties (>= 4.2, < 5.3) responders - jquery-rails (4.3.5) + jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - js-routes (1.4.7) + js-routes (2.2.2) railties (>= 4) - sprockets-rails - jwt (2.2.1) - kaminari (1.2.1) + jwt (2.3.0) + kaminari (1.2.2) activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.1) - kaminari-activerecord (= 1.2.1) - kaminari-core (= 1.2.1) - kaminari-actionview (1.2.1) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) actionview - kaminari-core (= 1.2.1) - kaminari-activerecord (1.2.1) + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) activerecord - kaminari-core (= 1.2.1) - kaminari-core (1.2.1) + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) log_file (0.0.3) - loofah (2.6.0) + loofah (2.13.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - method_source (0.9.2) - mime-types (3.2.2) + matrix (0.4.2) + method_source (1.0.0) + mime-types (3.4.1) mime-types-data (~> 3.2015) - mime-types-data (3.2019.0331) + mime-types-data (3.2022.0105) mini_magick (4.11.0) - mini_mime (1.0.2) + mini_mime (1.1.2) mini_portile2 (2.4.0) - minitest (5.14.1) + minitest (5.15.0) modernizr-rails (2.7.1) - momentjs-rails (2.20.1) + momentjs-rails (2.29.1.1) railties (>= 3.1) - multi_json (1.13.1) + multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) mysql2 (0.4.10) - net-scp (2.0.0) - net-ssh (>= 2.6.5, < 6.0.0) - net-ssh (5.2.0) + net-scp (3.0.0) + net-ssh (>= 2.6.5, < 7.0.0) + net-ssh (6.1.0) netrc (0.11.0) - nio4r (2.5.2) - nokogiri (1.10.9) + nio4r (2.5.8) + nokogiri (1.10.10) mini_portile2 (~> 2.4.0) - oauth (0.5.4) - oauth2 (1.4.1) - faraday (>= 0.8, < 0.16.0) + oauth (0.5.8) + oauth2 (1.4.7) + faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) oj (2.18.5) oj_mimic_json (1.0.1) - omniauth (1.9.0) - hashie (>= 3.4.6, < 3.7.0) + omniauth (1.9.1) + hashie (>= 3.4.6) rack (>= 1.6.2, < 3) - omniauth-cas (1.1.1) + omniauth-cas (2.0.0) addressable (~> 2.3) nokogiri (~> 1.5) omniauth (~> 1.2) - omniauth-facebook (5.0.0) + omniauth-facebook (9.0.0) omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (0.7.0) + omniauth-google-oauth2 (0.8.2) jwt (>= 2.0) - omniauth (>= 1.1.1) - omniauth-oauth2 (>= 1.5) - omniauth-oauth2 (1.6.0) oauth2 (~> 1.1) - omniauth (~> 1.9) + omniauth (~> 1.1) + omniauth-oauth2 (>= 1.6) + omniauth-oauth2 (1.7.2) + oauth2 (~> 1.4) + omniauth (>= 1.9, < 3) orm_adapter (0.5.0) - pastel (0.7.3) - equatable (~> 0.6) - tty-color (~> 0.5) polyamorous (1.1.0) activerecord (>= 3.0) - power_assert (1.1.4) - pry (0.12.2) - coderay (~> 1.1.0) - method_source (~> 0.9.0) - public_suffix (3.1.1) - puma (4.3.5) + power_assert (2.0.1) + pry (0.14.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.6) + puma (4.3.10) nio4r (~> 2.0) - rabl (0.14.1) + rabl (0.15.0) activesupport (>= 2.3.14) rack (1.6.13) rack-test (0.6.3) @@ -351,35 +367,35 @@ GEM bundler (>= 1.3.0, < 2.0) railties (= 4.2.11.3) sprockets-rails - rails-deprecated_sanitizer (1.0.3) + rails-deprecated_sanitizer (1.0.4) activesupport (>= 4.2.0.alpha) rails-dom-testing (1.0.9) activesupport (>= 4.2.0, < 5.0) nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.3.0) + rails-html-sanitizer (1.4.2) loofah (~> 2.3) - rails_same_site_cookie (0.1.8) + rails_same_site_cookie (0.1.9) rack (>= 1.5) - user_agent_parser (~> 2.5) + user_agent_parser (~> 2.6) railties (4.2.11.3) actionpack (= 4.2.11.3) activesupport (= 4.2.11.3) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.3.3) + rake (13.0.6) ransack (1.8.10) actionpack (>= 3.0, < 5.2) activerecord (>= 3.0, < 5.2) activesupport (>= 3.0, < 5.2) i18n - rb-fsevent (0.10.3) - rb-inotify (0.10.0) + rb-fsevent (0.11.0) + rb-inotify (0.10.1) ffi (~> 1.0) - rdoc (6.1.1) - redcarpet (3.4.0) - regexp_parser (1.5.1) - remotipart (1.4.3) + rdoc (6.3.3) + redcarpet (3.5.1) + regexp_parser (2.2.0) + remotipart (1.4.4) representable (2.4.1) declarative (~> 0.0.5) uber (~> 0.0.15) @@ -387,49 +403,57 @@ GEM responders (2.4.1) actionpack (>= 4.2.0, < 6.0) railties (>= 4.2.0, < 6.0) - rest-client (2.0.2) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rspec-core (3.8.2) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.4) + rexml (3.2.5) + rspec-core (3.10.2) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-mocks (3.8.1) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-rails (3.8.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.2) - ruby-graphviz (1.2.4) - ruby_parser (3.13.1) - sexp_processor (~> 4.9) - rubyzip (1.3.0) + rspec-support (~> 3.10.0) + rspec-rails (4.1.2) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.10) + rspec-expectations (~> 3.10) + rspec-mocks (~> 3.10) + rspec-support (~> 3.10) + rspec-support (3.10.3) + ruby-graphviz (1.2.5) + rexml + ruby2_keywords (0.0.5) + ruby_parser (3.18.1) + sexp_processor (~> 4.16) + rubyzip (2.3.2) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - sdoc (1.0.0) - rdoc (>= 5.0) - sexp_processor (4.12.1) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + sdoc (2.3.0) + rdoc (>= 5.0, < 6.4.0) + sexp_processor (4.16.0) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.1) + sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) @@ -438,47 +462,32 @@ GEM activerecord (>= 3.0) activesupport (>= 3.0) polyamorous (~> 1.1.0) - sshkit (1.19.1) + sshkit (1.21.2) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) ssrf_filter (1.0.7) - strings (0.1.5) - strings-ansi (~> 0.1) - unicode-display_width (~> 1.5) - unicode_utils (~> 1.4) - strings-ansi (0.1.0) sucker_punch (1.6.0) celluloid (~> 0.17.2) - temple (0.8.1) + temple (0.8.2) test-unit (3.0.9) power_assert - thin (1.7.2) + thin (1.8.1) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - thor (0.20.3) + thor (1.2.1) thread_safe (0.3.6) - tilt (2.0.9) - timers (4.3.0) + tilt (2.0.10) + timers (4.3.3) truncate_html (0.9.3) - tty-color (0.5.0) - tty-pager (0.12.1) - strings (~> 0.1.4) - tty-screen (~> 0.6) - tty-which (~> 0.4) - tty-screen (0.6.5) - tty-tree (0.3.0) - tty-which (0.4.1) - tzinfo (1.2.7) + tzinfo (1.2.9) thread_safe (~> 0.1) uber (0.0.15) - uglifier (4.1.20) + uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.7.6) - unicode-display_width (1.6.0) - unicode_utils (1.4.0) + unf_ext (0.0.8) user_agent_parser (2.7.0) wannabe_bool (0.7.1) warden (1.2.7) From e61f88f8da394af601f3829a357e4d372edcb05e Mon Sep 17 00:00:00 2001 From: i-m-karanagarwal <77572300+i-m-karanagarwal@users.noreply.github.com> Date: Thu, 7 Apr 2022 21:34:56 +0530 Subject: [PATCH 35/53] Fixed Gemfile according to new github policies --- Gemfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 43766f40..3e7065b1 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem 'coffee-script-source' gem 'test-unit', '~> 3.0.9' gem 'nokogiri', '~> 1.10.4' gem 'csv_shaper' -gem 'andand', github: 'raganwald/andand' +gem 'andand', git: 'https://github.com/raganwald/andand.git' gem 'responders' # Can't move above 1.1 until migrating to rails 4.2+ gem 'friendly_id', '~> 5' gem 'active_record-acts_as' @@ -50,7 +50,7 @@ group :development, :test do gem 'sqlite3', '~> 1.3.0' gem 'rspec-rails' gem 'annotate' - gem 'rails-erd', github: 'voormedia/rails-erd' + gem 'rails-erd', git: 'https://github.com/voormedia/rails-erd' gem 'faker' # Needed for debugging support in Aptana Studio. Disabled, since these # two gems do not support Ruby 2.0 yet :-(. @@ -113,7 +113,7 @@ group :deploy do gem 'capistrano-bundler' gem 'capistrano-rails' gem 'capistrano-rvm' - gem 'capistrano3-puma', github: 'seuros/capistrano-puma' + gem 'capistrano3-puma', git: 'https://github.com/seuros/capistrano-puma' end #for multi-color progress bar From d3eaa7b4380398cbce51f3d0507f9f61d2e15754 Mon Sep 17 00:00:00 2001 From: Divyansh Mishra Date: Thu, 17 Nov 2022 12:31:55 -0500 Subject: [PATCH 36/53] Peml integration basic --- Dockerfile | 4 +- Gemfile | 1 + Gemfile.lock | 30 +++++++++++++++ app/controllers/exercises_controller.rb | 51 ++++++++++++++++++++++++- docker-compose.yml | 6 +-- 5 files changed, 85 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 29bcd94e..51e8d176 100644 --- a/Dockerfile +++ b/Dockerfile @@ -57,11 +57,11 @@ RUN gem install bundler -v $BUNDLER_VERSION COPY Gemfile Gemfile COPY Gemfile.lock Gemfile.lock - +RUN echo Gemfile.lock #RUN bundle update #RUN bundle check || bundle install RUN bundle install - +RUN bundle exec peml #VOLUME ${BASEDIR} WORKDIR ${BASEDIR} diff --git a/Gemfile b/Gemfile index e5d7380e..381031e7 100644 --- a/Gemfile +++ b/Gemfile @@ -27,6 +27,7 @@ gem 'acts-as-taggable-on' gem 'representable', '~> 2.1' gem 'redcarpet' gem 'loofah', '>= 2.3.1' +gem 'peml', github: 'CSSPLICE/peml' gem 'truncate_html' gem 'tzinfo' # For timezone support gem 'active_record_union' diff --git a/Gemfile.lock b/Gemfile.lock index 12c5ccc6..b0cf8d41 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,16 @@ +GIT + remote: https://github.com/CSSPLICE/peml.git + revision: 91e6bcb3a6923dcb05c669eb6409383058bf1a7c + specs: + peml (0.1.1) + dottie (~> 0.0.1) + json_schemer (>= 0.2) + kramdown (~> 2.3.1) + kramdown-parser-gfm (~> 1.1.0) + liquid (>= 3.0.6) + parslet (>= 1.8) + redcarpet (>= 3.5) + GIT remote: https://github.com/raganwald/andand.git revision: d6c4545b6649c70495c26e2038206c5fdb2d14d6 @@ -189,6 +202,9 @@ GEM diff-lcs (1.4.4) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) + dottie (0.0.2) + ecma-re-validator (0.2.1) + regexp_parser (~> 1.2) ed25519 (1.2.4) erubi (1.9.0) erubis (2.7.0) @@ -230,6 +246,7 @@ GEM haml (>= 4.0.6, < 6.0) html2haml (>= 1.0.1) railties (>= 5.1) + hana (1.3.7) has_scope (0.7.2) actionpack (>= 4.1) activesupport (>= 4.1) @@ -265,6 +282,11 @@ GEM js-routes (1.4.9) railties (>= 4) sprockets-rails + json_schemer (0.2.16) + ecma-re-validator (~> 0.2) + hana (~> 1.3) + regexp_parser (~> 1.5) + uri_template (~> 0.7) jwt (2.2.2) kaminari (1.2.1) activesupport (>= 4.1.0) @@ -278,6 +300,11 @@ GEM activerecord kaminari-core (= 1.2.1) kaminari-core (1.2.1) + kramdown (2.3.2) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + liquid (5.4.0) listen (3.3.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) @@ -341,6 +368,7 @@ GEM oauth2 (~> 1.4) omniauth (~> 1.9) orm_adapter (0.5.0) + parslet (2.0.0) polyamorous (2.3.2) activerecord (>= 5.2.1) power_assert (1.2.0) @@ -483,6 +511,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.7) + uri_template (0.7.0) user_agent_parser (2.7.0) wannabe_bool (0.7.1) warden (1.2.9) @@ -559,6 +588,7 @@ DEPENDENCIES omniauth-cas omniauth-facebook omniauth-google-oauth2 + peml! pry puma (~> 4.3.5) rabl diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index ef7e715e..ea53db6e 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -3,6 +3,7 @@ class ExercisesController < ApplicationController require 'oauth/request_proxy/rack_request' require 'zip' require 'tempfile' + require 'peml' load_and_authorize_resource @@ -326,11 +327,17 @@ def cleanFile(files,fileList) # POST /exercises/upload_create def upload_create if params[:exercise] + peml=false exercise_params = params[:exercise] exercise_version_params = exercise_params[:exercise_version] edit_rights = exercise_params[:exercise_collection_id].to_i text_representation = exercise_version_params['text_representation'] - hash = YAML.load(text_representation) + if text_representation.to_s.include? ('exercise_id') + hash = Peml::Loader.new.load(text_representation) + peml=true + else + hash = YAML.load(text_representation) + end else text_representation = File.read(params[:form][:file].path) hash = YAML.load(text_representation) @@ -341,10 +348,14 @@ def upload_create if fileList != "" && !files.nil? files = cleanFile(files,fileList) end + if(peml) + hash = convert_peml(hash) + end if !hash.kind_of?(Array) hash = [hash] end - + + puts(hash) # figure out if we need to add this to an exercise collection exercise_collection = nil if edit_rights == 0 @@ -977,6 +988,42 @@ def create_new_version return newexercise end + # -------------------------------------------------------------- + # Convert the parsed peml hash into a + # hash corresponding to exercise data model + def convert_peml(hash) + #starting with three compulsory peml keys + new_hash = {"external_id" => hash["exercise_id"], "name", hash["title"]} + new_hash["current_version"] = {} + new_hash["current_version"]["version"] = 1 + if(hash["author"].is_a? String) + new_hash["current_version"]["creator"] = hash["author"] + else + new_hash["current_version"]["creator"] = hash["author"].key?("name") ? hash["author"].key?("name") : hash["author"].key?("email") + end + new_hash["experience"] = hash["difficulty"] + new_hash["tag_list"] = hash["tag"] + new_hash["style_list"] = "code writing" #dynamically handle which coding style it is + new_hash["language_list"] = "" + hash["systems"].each do |system| + new_hash["language_list"]+=system["language"] + end + new_hash["is_public"] = hash["is_public"] + new_hash["current_version"]["prompts"] = [] + prompt = {"position" => 1, "question" => hash["instructions"], "class_name" => "", "methos_name" => ""} + + #------------------------------------------------------------------------------------------- + # This part also needs to be dynamically handled to check if these files are in src instead + prompt["starter_code"] = hash["assets"]["code"]["starter"]["files"][0]["content"] + prompt["wrapper_code"] = hash["assets"]["code"]["wrapper"]["files"][0]["content"] + prompt["tests"] = hash["assets"]["test"]["files"][0]["content"] + #------------------------------------------------------------------------------------------- + + #dynamically handle which type of prompt it is + new_hash["current_version"]["prompts"]<<{"coding_prompt" => prompt} + new_hash + end + # ------------------------------------------------------------- # Only allow a trusted parameter "white list" through. diff --git a/docker-compose.yml b/docker-compose.yml index f2115c6f..dedb1323 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.8' services: db_dev: - image: mysql:5.7 + image: mariadb environment: MYSQL_ROOT_PASSWORD: root MYSQL_USER: codeworkout @@ -10,9 +10,9 @@ services: ports: - "3307:3306" volumes: - - dbdata:/var/lib/mysql:delegated + - dbdata:/var/lib/mariadb:delegated db_test: - image: mysql:5.7 + image: mariadb environment: MYSQL_ROOT_PASSWORD: root MYSQL_USER: codeworkout From 24aa0557d3cb69bed750f68e1cb7fa4269a329fc Mon Sep 17 00:00:00 2001 From: Divyansh Mishra Date: Mon, 28 Nov 2022 16:07:34 -0500 Subject: [PATCH 37/53] Peml integration refactoring --- Gemfile | 1 + Gemfile.lock | 1 + app/controllers/exercises_controller.rb | 58 ++--------------- app/utils/peml_parsing_util.rb | 83 +++++++++++++++++++++++++ 4 files changed, 91 insertions(+), 52 deletions(-) create mode 100644 app/utils/peml_parsing_util.rb diff --git a/Gemfile b/Gemfile index 381031e7..4fa46919 100644 --- a/Gemfile +++ b/Gemfile @@ -31,6 +31,7 @@ gem 'peml', github: 'CSSPLICE/peml' gem 'truncate_html' gem 'tzinfo' # For timezone support gem 'active_record_union' +gem 'dottie', '~> 0.0.1' gem 'mysql2', '~> 0.4.0' gem 'modernizr-rails' gem 'rubyzip', '>= 1.3.0' diff --git a/Gemfile.lock b/Gemfile.lock index b0cf8d41..21fd95c6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -557,6 +557,7 @@ DEPENDENCIES css3-progress-bar-rails csv_shaper devise + dottie (~> 0.0.1) ed25519 exception_handler (~> 0.8.0.0) factory_bot_rails diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index ea53db6e..cdccaaec 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -3,8 +3,6 @@ class ExercisesController < ApplicationController require 'oauth/request_proxy/rack_request' require 'zip' require 'tempfile' - require 'peml' - load_and_authorize_resource skip_authorize_resource only: [:practice, :call_open_pop] @@ -327,35 +325,28 @@ def cleanFile(files,fileList) # POST /exercises/upload_create def upload_create if params[:exercise] - peml=false exercise_params = params[:exercise] exercise_version_params = exercise_params[:exercise_version] edit_rights = exercise_params[:exercise_collection_id].to_i text_representation = exercise_version_params['text_representation'] - if text_representation.to_s.include? ('exercise_id') - hash = Peml::Loader.new.load(text_representation) - peml=true - else - hash = YAML.load(text_representation) - end else text_representation = File.read(params[:form][:file].path) - hash = YAML.load(text_representation) edit_rights = 0 # Personal exercise end + if text_representation.to_s.include? ('exercise_id') + hash = PemlParsingUtil.new.parse(text_representation) + else + hash = YAML.load(text_representation) + end files = exercise_params[:files] fileList = exercise_params[:fileList] if fileList != "" && !files.nil? files = cleanFile(files,fileList) end - if(peml) - hash = convert_peml(hash) - end if !hash.kind_of?(Array) hash = [hash] end - - puts(hash) + # figure out if we need to add this to an exercise collection exercise_collection = nil if edit_rights == 0 @@ -988,43 +979,6 @@ def create_new_version return newexercise end - # -------------------------------------------------------------- - # Convert the parsed peml hash into a - # hash corresponding to exercise data model - def convert_peml(hash) - #starting with three compulsory peml keys - new_hash = {"external_id" => hash["exercise_id"], "name", hash["title"]} - new_hash["current_version"] = {} - new_hash["current_version"]["version"] = 1 - if(hash["author"].is_a? String) - new_hash["current_version"]["creator"] = hash["author"] - else - new_hash["current_version"]["creator"] = hash["author"].key?("name") ? hash["author"].key?("name") : hash["author"].key?("email") - end - new_hash["experience"] = hash["difficulty"] - new_hash["tag_list"] = hash["tag"] - new_hash["style_list"] = "code writing" #dynamically handle which coding style it is - new_hash["language_list"] = "" - hash["systems"].each do |system| - new_hash["language_list"]+=system["language"] - end - new_hash["is_public"] = hash["is_public"] - new_hash["current_version"]["prompts"] = [] - prompt = {"position" => 1, "question" => hash["instructions"], "class_name" => "", "methos_name" => ""} - - #------------------------------------------------------------------------------------------- - # This part also needs to be dynamically handled to check if these files are in src instead - prompt["starter_code"] = hash["assets"]["code"]["starter"]["files"][0]["content"] - prompt["wrapper_code"] = hash["assets"]["code"]["wrapper"]["files"][0]["content"] - prompt["tests"] = hash["assets"]["test"]["files"][0]["content"] - #------------------------------------------------------------------------------------------- - - #dynamically handle which type of prompt it is - new_hash["current_version"]["prompts"]<<{"coding_prompt" => prompt} - new_hash - end - - # ------------------------------------------------------------- # Only allow a trusted parameter "white list" through. def exercise_params diff --git a/app/utils/peml_parsing_util.rb b/app/utils/peml_parsing_util.rb new file mode 100644 index 00000000..5d14e23e --- /dev/null +++ b/app/utils/peml_parsing_util.rb @@ -0,0 +1,83 @@ +require 'peml' +require 'dottie/ext' +require 'net/http' +require 'uri' + +class PemlParsingUtil + def parse (text_representation) + convert_peml(Peml::Loader.new.load(text_representation).dottie!) + end + + # Convert the parsed peml hash into a hash corresponding to exercise data model + def convert_peml(hash) + #starting with three compulsory peml keys + new_hash = {"external_id" => hash["exercise_id"], "name" => hash["title"]}.dottie! + new_hash["experience"] = hash["difficulty"] + new_hash["tag_list"] = hash["tag"].to_s + + # PEML does not have an is_public equivalent so we put this value under a key of the same name + new_hash["is_public"] = hash["is_public"] + + # PEML is designed to handle programming assignments and 'code writing' is the equivalent in code-workout + new_hash["style_list"] = "code writing" + + new_hash["language_list"] = "" + hash["systems"].each do |system| + new_hash["language_list"]+=system["language"] + end + + new_hash["current_version"] = {} + new_hash["current_version.version"] = hash["version.id"] + new_hash["current_version.creator"] = get_author(hash) + new_hash["current_version.prompts"] = [] + prompt = {"position" => 1, "question" => hash["instructions"], "class_name" => "", "method_name" => ""} + + #------------------------------------------------------------------------------------------- + # PEML assets are either remote URLs or array of files which have different keys. + # We try to fetch content from the files. + prompt["starter_code"] = get_content(hash["assets.code.starter"]) + prompt["wrapper_code"] = get_content(hash["assets.code.wrapper"]) + prompt["tests"] = get_content(hash["assets.tests"]) + #------------------------------------------------------------------------------------------- + + #Again, PEML is designed for coding problems and thus, 'coding_prompt' + new_hash["current_version"]["prompts"]<<{"coding_prompt" => prompt} + new_hash + end + + def get_author(hash) + creator = "" + if hash.key?("authors") + hash["authors"].each do |author| + if author.is_a? String + creator += author + else + creator += author.key?("email") ? author["email"] : author["name"] + end + creator += "," + end + creator.delete_suffix!(",") + elsif(hash.key?("author")) + if hash["author"].is_a? String + creator = hash["author"] + else + creator = hash["author"].key?("email") ? hash["author.email"] : hash["author.name"] + end + elsif(hash.key?("license")) + creator = hash["license.owner"] + end + creator + end + + def get_content(asset_child) + asset_collection = [] + if asset_child.is_a? String && asset_child =~ URI::regexp + asset_collection << Net::HTTP.get(URI.parse(asset_child)) + else + asset_child.each do |asset_file| + asset_collection << asset_file["files.content"] + end + end + asset_collection.join(',') + end +end \ No newline at end of file From 9b74718030566c4f6f20f4e5e28a351e4abb63cc Mon Sep 17 00:00:00 2001 From: Divyansh Mishra Date: Mon, 28 Nov 2022 18:58:23 -0500 Subject: [PATCH 38/53] Bug fixed and added help page --- app/controllers/help_controller.rb | 3 +++ app/utils/peml_parsing_util.rb | 19 +++++++++++++------ app/views/help/exercise_peml_format.haml | 11 +++++++++++ app/views/help/index.html.haml | 3 +++ config/routes.rb | 1 + 5 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 app/views/help/exercise_peml_format.haml diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 2dd68eb9..41bc3450 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -10,4 +10,7 @@ def exercise_format def lti_configuration end + def exercise_peml_format + end + end diff --git a/app/utils/peml_parsing_util.rb b/app/utils/peml_parsing_util.rb index 5d14e23e..924072e4 100644 --- a/app/utils/peml_parsing_util.rb +++ b/app/utils/peml_parsing_util.rb @@ -37,11 +37,11 @@ def convert_peml(hash) # We try to fetch content from the files. prompt["starter_code"] = get_content(hash["assets.code.starter"]) prompt["wrapper_code"] = get_content(hash["assets.code.wrapper"]) - prompt["tests"] = get_content(hash["assets.tests"]) + prompt["tests"] = get_content(hash["assets.test"]) #------------------------------------------------------------------------------------------- #Again, PEML is designed for coding problems and thus, 'coding_prompt' - new_hash["current_version"]["prompts"]<<{"coding_prompt" => prompt} + new_hash["current_version.prompts"]<<{"coding_prompt" => prompt} new_hash end @@ -71,11 +71,18 @@ def get_author(hash) def get_content(asset_child) asset_collection = [] - if asset_child.is_a? String && asset_child =~ URI::regexp - asset_collection << Net::HTTP.get(URI.parse(asset_child)) - else + if asset_child.is_a? String + begin + uri = URI.parse(asset_child) + if uri.is_a?(URI::HTTP) && !uri.host.nil? + asset_collection << Net::HTTP.get(uri) + end + rescue URI::InvalidURIError + asset_collection << "" + end + elsif asset_child.is_a? Array asset_child.each do |asset_file| - asset_collection << asset_file["files.content"] + asset_collection << asset_file["files"]["content"] end end asset_collection.join(',') diff --git a/app/views/help/exercise_peml_format.haml b/app/views/help/exercise_peml_format.haml new file mode 100644 index 00000000..b1ba4ac3 --- /dev/null +++ b/app/views/help/exercise_peml_format.haml @@ -0,0 +1,11 @@ +%h1 PEML Format for Exercises + +%p + This page describes how to use PEML's + %a{ href: 'https://cssplice.github.io/peml/schemas/exercise.html#src' } data model + to describe assignments in CodeWorkout. PEML stands for Programming Exercise Markup + Language, and, as the name suggests, can be used to describe programming assignments + (PEML does not have support for multiple choice questions). PEML follows a key-value + structure with support for nested collections and dictionaries. The PEML data model + describes a set of required keys, a set of recommended keys, and certain optional keys. + Some of the keys are discussed in the following sections. \ No newline at end of file diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index 0f2c874c..bfc31590 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -4,6 +4,9 @@ %li %a{ href: '/help/exercise_format' } Format for defining exercises + %li + %a{ href: '/help/exercise_peml_format' } + [New] Format Exercises in PEML %li %a{ href: '/help/lti_configuration' } Configuration/setup for LTI connectivity in LMSes diff --git a/config/routes.rb b/config/routes.rb index 55355324..ed3e33f9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -188,6 +188,7 @@ get 'help' => 'help#index' get 'help/exercise_format' => 'help#exercise_format' get 'help/lti_configuration' => 'help/lti_configuration' + get 'help/exercise_peml_format' => 'help#exercise_peml_format' get 'static_pages/mockup1' => 'static_pages#mockup1' get 'static_pages/mockup2' => 'static_pages#mockup2' From cab8fff57e453be59c1ca0c5f351c30116e7b6d0 Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Wed, 22 Nov 2023 16:23:33 -0500 Subject: [PATCH 39/53] creates new exercise collection for SPLICE along with a route to export data for catalog (/gym/exercises/embed_collection and /gym/exercises/export Signed-off-by: Alex Hicks --- app/assets/stylesheets/custom.scss | 30 +++++++++ app/controllers/exercises_controller.rb | 38 ++++++++++- app/models/exercise.rb | 19 +++++- .../exercises/embed_collection.html.haml | 63 +++++++++++++++++++ config/routes.rb | 4 +- docker-compose.yml | 4 +- 6 files changed, 153 insertions(+), 5 deletions(-) create mode 100644 app/views/exercises/embed_collection.html.haml diff --git a/app/assets/stylesheets/custom.scss b/app/assets/stylesheets/custom.scss index 21c9fa4c..ae662ad9 100644 --- a/app/assets/stylesheets/custom.scss +++ b/app/assets/stylesheets/custom.scss @@ -569,3 +569,33 @@ ul.ui-autocomplete { max-height: 5em; height: auto; } + +// syling for embed collection page for SPLICE +.exercise-container.card { + width: 200%; // Adjust width as needed + // padding-left: 0 // +} + +.iframe-label-container { + clear: both; // Clear floats to ensure this container stays below preceding content + margin-top: 8px; // Add margin at the top to create space between this container and the preceding content + margin-bottom: 8px; // Adjust spacing below the label + // padding-left: 0 +} + +.iframe-label-container label { + display: block; + font-size: 11px; + margin-bottom: 5px; + +} + +.exercise-details { + margin-bottom: 10px; // Adds space before the button + padding-left: 20px; + + input.form-control { + width: 40%; // text field the same width as the thumbnail + font-size: 9px; + } +} diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index f19e9795..371d1b62 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -6,7 +6,7 @@ class ExercisesController < ApplicationController load_and_authorize_resource - skip_authorize_resource only: [:practice, :call_open_pop] + skip_authorize_resource only: [:practice, :call_open_pop, :embed_collection, :export] #~ Action methods ........................................................... after_action :allow_iframe, only: [:practice, :embed] @@ -27,6 +27,42 @@ def index end + # This embed_collection fetches all exercises for the embed_collections page and provides a simplified iframe urls of exercises for SPLICE + def embed_collection + if current_user + @exercises = Exercise.visible_to_user(current_user) + else + @exercises = Exercise.publicly_visible + end + @exercises = @exercises.page(params[:page]) + end + + # ------------------------------------------------------------- + # The export function gets all exercises metadata for SPLICE + # GET /gym/exercises/export + def export + @exercises = Exercise.all + export_data = @exercises.map do |exercise| + workout_names = exercise.exercise_workouts.map { |ew| ew.workout.name }.uniq + { + "Platform_name": "Code-Workout", + "URL": "https://codeworkout.cs.vt.edu", + "LTI_Instructions_URL": " https://opendsa-server.cs.vt.edu/guides/opendsa-canvas", + "Exercise_type": Exercise::TYPE_NAMES[exercise.question_type], + "license": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)", + "Description": exercise.exercise_collection&.description, # Safely fetching description + "Author": "Stephen Edwards", + "Institution": "VT", + "Keywords": workout_names.join(', '), + "Exercise_Name": exercise.name, + "Iframe_URL": exercise.iframe_url, + "LTI_URL": exercise.lti_launch_url + } + end + render json: export_data + end + + # ------------------------------------------------------------- # GET /exercises/download.csv def download diff --git a/app/models/exercise.rb b/app/models/exercise.rb index ee202140..c2c6008e 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -109,7 +109,8 @@ class Exercise < ActiveRecord::Base scope :visible_through_user, -> (u) { joins{exercise_owners.outer}.joins{exercise_collection.outer}. where{ (exercise_owners.owner == u) | (exercise_collection.user == u) } } - + attr_accessor :iframe_url # to get values to define in iframe url function for SPLICE + #~ Class methods ............................................................ # ------------------------------------------------------------- @@ -194,6 +195,22 @@ def self.publicly_visible end + # the iframeurl, iframe-embedcode and ltilaunch is to display and export each exercises information for SPLICE + def iframe_url + base_url = "https://code-workout.cs.vt.edu" # to be dynamically fetched maybe from a config file + "#{base_url}/gym/exercises/#{self.id}/practice" + end + + def iframe_embed_code + "" + end + + def lti_launch_url + base_url = "https://code-workout.cs.vt.edu" # to be fetched dynamically + "#{base_url}/lti/launch/gym/exercises/#{self.id}/practice" + end + + # ------------------------------------------------------------- def self.visible_through_user_group(user) Exercise.joins(exercise_collection: [ user_group: :memberships ]) diff --git a/app/views/exercises/embed_collection.html.haml b/app/views/exercises/embed_collection.html.haml new file mode 100644 index 00000000..f719d6fb --- /dev/null +++ b/app/views/exercises/embed_collection.html.haml @@ -0,0 +1,63 @@ +.container + %ol.breadcrumb.mb-4 + %li= link_to 'Home', root_path + %li= link_to 'Gym', gym_url + %li.active Exercises + + %h1.mb-3 Exercises + + - if can? :create, Exercise + %p.mb-4= link_to 'Create New', new_exercise_path, class: 'btn btn-primary' + + - if @exercises.size > 0 + .row + - @exercises.in_groups_of(2, false) do |group| + - group.each do |exercise| + .col-md-6.mb-4 + .exercise-container.card + .card-body + = render partial: 'exercise', locals: { exercise: exercise, user: current_user } + + - if exercise.iframe_url.present? + .exercise-details.mt-3 + .iframe-label-container + %label.mb-1 IFrame Embed Code: + %input.form-control.mb-2{ id: "iframe-code-#{exercise.id}", type: 'text', value: exercise.iframe_embed_code, readonly: true } + .buttons.mt-2 + %button.btn.btn-primary.mr-2{ 'data-toggle' => 'modal', 'data-target' => "#infoModal-#{exercise.id}" } + Generate LTI Launch Info + %button.btn.btn-primary{ 'data-toggle' => 'modal', 'data-target' => "#previewModal-#{exercise.id}" } + Preview + .modal.fade{ id: "infoModal-#{exercise.id}", tabindex: '-1', role: 'dialog', 'aria-labelledby' => "infoModalLabel-#{exercise.id}", 'aria-hidden' => 'true' } + .modal-dialog{ role: 'document' } + .modal-content + .modal-header + %h5.modal-title + Iframe and LTI Launch Information + %button.close{ type: 'button', 'data-dismiss' => 'modal', 'aria-label' => 'Close' } + %span{ 'aria-hidden' => 'true' } × + .modal-body + %p + %strong IFrame URL: + %input.form-control{ type: 'text', value: exercise.iframe_url, readonly: true } + %p + %strong LTI Launch URL: + %input.form-control{ type: 'text', value: exercise.lti_launch_url, readonly: true, disabled: true } + .modal.fade{ id: "previewModal-#{exercise.id}", tabindex: '-1', role: 'dialog', 'aria-labelledby' => "previewModalLabel-#{exercise.id}", 'aria-hidden' => 'true' } + .modal-dialog{ role: 'document' } + .modal-content + .modal-header + %h5.modal-title Preview + %button.close{ type: 'button', 'data-dismiss' => 'modal', 'aria-label' => 'Close' } + %span{ 'aria-hidden' => 'true' } × + .modal-body + %iframe{ src: exercise.iframe_url, width: '100%', height: '500', frameborder: '0', allowfullscreen: true } + .clearfix + = paginate @exercises + - else + %p.mt-4 + No public exercises are available to view right now. Please wait for contributors to add more. + +-# this page is to display the catalog of code workout's exercises for SPLICE + + diff --git a/config/routes.rb b/config/routes.rb index 4cdf4df6..4e801f9f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -66,7 +66,9 @@ as: :exercises_query_data get 'exercises/download_attempt_data' => 'exercises#download_attempt_data', as: :download_exercise_attempt_data - # At the bottom, so the routes above take precedence over existing ids + get 'exercises/embed_collection' => + 'exercises#embed_collection', as: :exercises_embed_collection + get 'exercises/export' => 'exercises#export', as: :exercises_export resources :exercises # /gym/workouts ... diff --git a/docker-compose.yml b/docker-compose.yml index 91facf81..d66cfe9e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.8' services: db_dev: - image: mysql:5.7 + image: mariadb:10.2 environment: MYSQL_ROOT_PASSWORD: root MYSQL_USER: codeworkout @@ -12,7 +12,7 @@ services: volumes: - dbdata:/var/lib/mysql:delegated db_test: - image: mysql:5.7 + image: mariadb:10.2 environment: MYSQL_ROOT_PASSWORD: root MYSQL_USER: codeworkout From 7fa0b75055870823e5627ff1c56c938cf81c95ea Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Tue, 5 Dec 2023 02:03:40 -0500 Subject: [PATCH 40/53] remove collection and update urls Signed-off-by: Alex Hicks --- app/assets/stylesheets/custom.scss | 30 --------- app/controllers/exercises_controller.rb | 14 +---- app/models/exercise.rb | 4 +- .../exercises/embed_collection.html.haml | 63 ------------------- config/routes.rb | 3 +- 5 files changed, 5 insertions(+), 109 deletions(-) delete mode 100644 app/views/exercises/embed_collection.html.haml diff --git a/app/assets/stylesheets/custom.scss b/app/assets/stylesheets/custom.scss index ae662ad9..21c9fa4c 100644 --- a/app/assets/stylesheets/custom.scss +++ b/app/assets/stylesheets/custom.scss @@ -569,33 +569,3 @@ ul.ui-autocomplete { max-height: 5em; height: auto; } - -// syling for embed collection page for SPLICE -.exercise-container.card { - width: 200%; // Adjust width as needed - // padding-left: 0 // -} - -.iframe-label-container { - clear: both; // Clear floats to ensure this container stays below preceding content - margin-top: 8px; // Add margin at the top to create space between this container and the preceding content - margin-bottom: 8px; // Adjust spacing below the label - // padding-left: 0 -} - -.iframe-label-container label { - display: block; - font-size: 11px; - margin-bottom: 5px; - -} - -.exercise-details { - margin-bottom: 10px; // Adds space before the button - padding-left: 20px; - - input.form-control { - width: 40%; // text field the same width as the thumbnail - font-size: 9px; - } -} diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 371d1b62..93898e90 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -6,7 +6,7 @@ class ExercisesController < ApplicationController load_and_authorize_resource - skip_authorize_resource only: [:practice, :call_open_pop, :embed_collection, :export] + skip_authorize_resource only: [:practice, :call_open_pop, :export] #~ Action methods ........................................................... after_action :allow_iframe, only: [:practice, :embed] @@ -27,16 +27,6 @@ def index end - # This embed_collection fetches all exercises for the embed_collections page and provides a simplified iframe urls of exercises for SPLICE - def embed_collection - if current_user - @exercises = Exercise.visible_to_user(current_user) - else - @exercises = Exercise.publicly_visible - end - @exercises = @exercises.page(params[:page]) - end - # ------------------------------------------------------------- # The export function gets all exercises metadata for SPLICE # GET /gym/exercises/export @@ -45,7 +35,7 @@ def export export_data = @exercises.map do |exercise| workout_names = exercise.exercise_workouts.map { |ew| ew.workout.name }.uniq { - "Platform_name": "Code-Workout", + "Platform_name": "CodeWorkout", "URL": "https://codeworkout.cs.vt.edu", "LTI_Instructions_URL": " https://opendsa-server.cs.vt.edu/guides/opendsa-canvas", "Exercise_type": Exercise::TYPE_NAMES[exercise.question_type], diff --git a/app/models/exercise.rb b/app/models/exercise.rb index c2c6008e..628a5d60 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -197,7 +197,7 @@ def self.publicly_visible # the iframeurl, iframe-embedcode and ltilaunch is to display and export each exercises information for SPLICE def iframe_url - base_url = "https://code-workout.cs.vt.edu" # to be dynamically fetched maybe from a config file + base_url = "https://codeworkoutdev.cs.vt.edu" # to be dynamically fetched maybe from a config file "#{base_url}/gym/exercises/#{self.id}/practice" end @@ -206,7 +206,7 @@ def iframe_embed_code end def lti_launch_url - base_url = "https://code-workout.cs.vt.edu" # to be fetched dynamically + base_url = "https://codeworkoutdev.cs.vt.edu" # to be fetched dynamically "#{base_url}/lti/launch/gym/exercises/#{self.id}/practice" end diff --git a/app/views/exercises/embed_collection.html.haml b/app/views/exercises/embed_collection.html.haml deleted file mode 100644 index f719d6fb..00000000 --- a/app/views/exercises/embed_collection.html.haml +++ /dev/null @@ -1,63 +0,0 @@ -.container - %ol.breadcrumb.mb-4 - %li= link_to 'Home', root_path - %li= link_to 'Gym', gym_url - %li.active Exercises - - %h1.mb-3 Exercises - - - if can? :create, Exercise - %p.mb-4= link_to 'Create New', new_exercise_path, class: 'btn btn-primary' - - - if @exercises.size > 0 - .row - - @exercises.in_groups_of(2, false) do |group| - - group.each do |exercise| - .col-md-6.mb-4 - .exercise-container.card - .card-body - = render partial: 'exercise', locals: { exercise: exercise, user: current_user } - - - if exercise.iframe_url.present? - .exercise-details.mt-3 - .iframe-label-container - %label.mb-1 IFrame Embed Code: - %input.form-control.mb-2{ id: "iframe-code-#{exercise.id}", type: 'text', value: exercise.iframe_embed_code, readonly: true } - .buttons.mt-2 - %button.btn.btn-primary.mr-2{ 'data-toggle' => 'modal', 'data-target' => "#infoModal-#{exercise.id}" } - Generate LTI Launch Info - %button.btn.btn-primary{ 'data-toggle' => 'modal', 'data-target' => "#previewModal-#{exercise.id}" } - Preview - .modal.fade{ id: "infoModal-#{exercise.id}", tabindex: '-1', role: 'dialog', 'aria-labelledby' => "infoModalLabel-#{exercise.id}", 'aria-hidden' => 'true' } - .modal-dialog{ role: 'document' } - .modal-content - .modal-header - %h5.modal-title - Iframe and LTI Launch Information - %button.close{ type: 'button', 'data-dismiss' => 'modal', 'aria-label' => 'Close' } - %span{ 'aria-hidden' => 'true' } × - .modal-body - %p - %strong IFrame URL: - %input.form-control{ type: 'text', value: exercise.iframe_url, readonly: true } - %p - %strong LTI Launch URL: - %input.form-control{ type: 'text', value: exercise.lti_launch_url, readonly: true, disabled: true } - .modal.fade{ id: "previewModal-#{exercise.id}", tabindex: '-1', role: 'dialog', 'aria-labelledby' => "previewModalLabel-#{exercise.id}", 'aria-hidden' => 'true' } - .modal-dialog{ role: 'document' } - .modal-content - .modal-header - %h5.modal-title Preview - %button.close{ type: 'button', 'data-dismiss' => 'modal', 'aria-label' => 'Close' } - %span{ 'aria-hidden' => 'true' } × - .modal-body - %iframe{ src: exercise.iframe_url, width: '100%', height: '500', frameborder: '0', allowfullscreen: true } - .clearfix - = paginate @exercises - - else - %p.mt-4 - No public exercises are available to view right now. Please wait for contributors to add more. - --# this page is to display the catalog of code workout's exercises for SPLICE - - diff --git a/config/routes.rb b/config/routes.rb index 4e801f9f..61a3050d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -66,9 +66,8 @@ as: :exercises_query_data get 'exercises/download_attempt_data' => 'exercises#download_attempt_data', as: :download_exercise_attempt_data - get 'exercises/embed_collection' => - 'exercises#embed_collection', as: :exercises_embed_collection get 'exercises/export' => 'exercises#export', as: :exercises_export + # At the bottom, so the routes above take precedence over existing ids resources :exercises # /gym/workouts ... From da0e63bed62abcd9d559804cb55fa78c12edf138 Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Mon, 11 Dec 2023 20:04:51 -0500 Subject: [PATCH 41/53] tweaks to SPLICE API export endpoint --- app/controllers/exercises_controller.rb | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 93898e90..41373dd3 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -35,18 +35,19 @@ def export export_data = @exercises.map do |exercise| workout_names = exercise.exercise_workouts.map { |ew| ew.workout.name }.uniq { - "Platform_name": "CodeWorkout", - "URL": "https://codeworkout.cs.vt.edu", - "LTI_Instructions_URL": " https://opendsa-server.cs.vt.edu/guides/opendsa-canvas", - "Exercise_type": Exercise::TYPE_NAMES[exercise.question_type], + "catalog_type": "SLCItemCatalog", + "platform_name": "CodeWorkout", + "url": "https://codeworkout.cs.vt.edu", + "lti_instructions_url": "https://opendsa-server.cs.vt.edu/guides/opendsa-canvas", + "exercise_type": Exercise::TYPE_NAMES[exercise.question_type], "license": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)", - "Description": exercise.exercise_collection&.description, # Safely fetching description - "Author": "Stephen Edwards", - "Institution": "VT", - "Keywords": workout_names.join(', '), - "Exercise_Name": exercise.name, - "Iframe_URL": exercise.iframe_url, - "LTI_URL": exercise.lti_launch_url + "description": exercise.exercise_collection&.description, # Safely fetching description + "author": "Stephen Edwards", + "institution": "Virginia Tech", + "keywords": workout_names.join(', '), + "exercise_Name": exercise.name, + "iframe_url": exercise.iframe_url, + "lti_url": exercise.lti_launch_url } end render json: export_data From 2d2b4f1cc613a37b9d033a6bcaed92c1dd6321dd Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Mon, 11 Dec 2023 20:21:24 -0500 Subject: [PATCH 42/53] typo in exercise_name --- app/controllers/exercises_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 41373dd3..63b8a305 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -45,7 +45,7 @@ def export "author": "Stephen Edwards", "institution": "Virginia Tech", "keywords": workout_names.join(', '), - "exercise_Name": exercise.name, + "exercise_name": exercise.name, "iframe_url": exercise.iframe_url, "lti_url": exercise.lti_launch_url } From f1fd0615e3466296c42ba700fed3d22809a50f7e Mon Sep 17 00:00:00 2001 From: Yemi Aina Date: Thu, 21 Mar 2024 17:27:57 -0400 Subject: [PATCH 43/53] updating keywords as array and split exercise name phrases into words --- app/controllers/exercises_controller.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 63b8a305..b63679a8 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -31,11 +31,16 @@ def index # The export function gets all exercises metadata for SPLICE # GET /gym/exercises/export def export + # filter out stop/connector words for keywords from workout phrases or names + stop_words = ['the', 'and', 'a', 'to', 'of', 'in', 'for', 'on', 'with', 'as', 'by', 'at', 'from', 'is', 'that', 'which', 'it', 'an', 'be', 'this', 'are', 'we', 'can', 'if', 'has', 'but'] @exercises = Exercise.all export_data = @exercises.map do |exercise| - workout_names = exercise.exercise_workouts.map { |ew| ew.workout.name }.uniq + workout_names = exercise.exercise_workouts.map { |ew| ew.workout.name }.uniq.push(exercise.name) + # split phrases and remove any stop/connector words + keywords_array = workout_names.map { |phrase| phrase.downcase.split(/\W+/) }.flatten.uniq.reject { |word| stop_words.include?(word) || word.empty? } + { - "catalog_type": "SLCItemCatalog", + "catalog_type": "SLCItemCatalog", "platform_name": "CodeWorkout", "url": "https://codeworkout.cs.vt.edu", "lti_instructions_url": "https://opendsa-server.cs.vt.edu/guides/opendsa-canvas", @@ -44,7 +49,7 @@ def export "description": exercise.exercise_collection&.description, # Safely fetching description "author": "Stephen Edwards", "institution": "Virginia Tech", - "keywords": workout_names.join(', '), + "keywords": keywords_array, "exercise_name": exercise.name, "iframe_url": exercise.iframe_url, "lti_url": exercise.lti_launch_url From f70514feae3d04b140fad0186aab56081d668de4 Mon Sep 17 00:00:00 2001 From: s-edwards Date: Fri, 15 Nov 2024 11:18:20 -0500 Subject: [PATCH 44/53] removed before_filter references, post-merge cleanup --- Gemfile | 1 - Gemfile.lock | 11 ++++++----- app/controllers/course_offerings_controller.rb | 8 ++++---- app/controllers/upload_roster_controller.rb | 2 +- app/controllers/workout_offerings_controller.rb | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 36fe34cb..7836afae 100644 --- a/Gemfile +++ b/Gemfile @@ -126,7 +126,6 @@ gem 'rest-client' # Gems for cookie updates gem 'user_agent_parser', '~> 2.7.0' gem 'rails_same_site_cookie' -gem 'sprockets', '< 4.0.0' gem 'image_hash' # Gems for resource uploder diff --git a/Gemfile.lock b/Gemfile.lock index a36fd03f..123e5b98 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -22,10 +22,10 @@ GIT revision: b148515f78476b68ab8e09bcc494e82ceb53eba0 branch: v4.x specs: - capistrano3-puma (5.0.0.beta1) + capistrano3-puma (4.0.0) capistrano (~> 3.7) capistrano-bundler - puma (>= 4.0, < 6.0) + puma (~> 4.0) GIT remote: https://github.com/voormedia/rails-erd @@ -441,8 +441,8 @@ GEM rspec-support (~> 3.8.0) rspec-expectations (3.8.4) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-mocks (3.10.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) rspec-rails (3.8.2) @@ -456,6 +456,7 @@ GEM rspec-support (3.8.2) ruby-graphviz (1.2.5) rexml + ruby2_keywords (0.0.5) ruby_parser (3.13.1) sexp_processor (~> 4.9) rubyzip (2.3.0) @@ -548,7 +549,7 @@ DEPENDENCIES capistrano-rails capistrano-rvm capistrano3-puma (~> 4.0.0)! - capybara + capybara (~> 3.12.0) carrierwave (= 1.3.2) cocoon codemirror-rails diff --git a/app/controllers/course_offerings_controller.rb b/app/controllers/course_offerings_controller.rb index 5376e87c..150ce761 100644 --- a/app/controllers/course_offerings_controller.rb +++ b/app/controllers/course_offerings_controller.rb @@ -1,5 +1,5 @@ class CourseOfferingsController < ApplicationController - before_filter :rename_course_offering_id_param + before_action :rename_course_offering_id_param load_and_authorize_resource @@ -154,7 +154,7 @@ def enroll if @course_offering && !already_enrolled && (can_enroll || enrollee_manages_course || current_user_manages_course) - + co = CourseEnrollment.new( course_offering: @course_offering, @@ -187,8 +187,8 @@ def enroll end else message = "Could not enroll #{@user.display_name} in #{@course_offering.display_name_with_term} because" - reasons = "#{errors.to_sentence}." - message = "#{message} #{reasons}" + reasons = "#{errors.to_sentence}." + message = "#{message} #{reasons}" respond_to do |format| format.html { flash[:warning] = 'Unable to enroll in that course.' diff --git a/app/controllers/upload_roster_controller.rb b/app/controllers/upload_roster_controller.rb index 63c4d248..0b454d08 100644 --- a/app/controllers/upload_roster_controller.rb +++ b/app/controllers/upload_roster_controller.rb @@ -1,5 +1,5 @@ class UploadRosterController < ApplicationController - before_filter :authenticate_user! + before_action :authenticate_user! load_and_authorize_resource :course_offering diff --git a/app/controllers/workout_offerings_controller.rb b/app/controllers/workout_offerings_controller.rb index 901f5424..3522ad16 100644 --- a/app/controllers/workout_offerings_controller.rb +++ b/app/controllers/workout_offerings_controller.rb @@ -1,5 +1,5 @@ class WorkoutOfferingsController < ApplicationController - skip_before_filter :authenticate_user!, :only => :practice + skip_before_action :authenticate_user!, :only => :practice load_and_authorize_resource From db126474ba0b5260d8a3668d994923adb82db8b3 Mon Sep 17 00:00:00 2001 From: s-edwards Date: Fri, 15 Nov 2024 11:52:57 -0500 Subject: [PATCH 45/53] fixed errant skip_before_action clause (?) --- app/controllers/workout_offerings_controller.rb | 4 ++-- config/deploy/staging.rb | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/workout_offerings_controller.rb b/app/controllers/workout_offerings_controller.rb index 3522ad16..173110d3 100644 --- a/app/controllers/workout_offerings_controller.rb +++ b/app/controllers/workout_offerings_controller.rb @@ -1,8 +1,8 @@ class WorkoutOfferingsController < ApplicationController - skip_before_action :authenticate_user!, :only => :practice + # Isn't this handled by authorize_resource already? + # skip_before_action :authenticate_user!, :only => :practice load_and_authorize_resource - skip_authorize_resource :only => :practice #~ Action methods ........................................................... diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index a094a694..815c836e 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -1,5 +1,6 @@ set :stage, :staging -set :branch, 'rails-5-upgrade' +# set :branch, 'rails-5-upgrade' +set :branch, 'staging' set :rails_env, 'staging' # Simple Role Syntax From 06b7bf8b678757742c7cb7521345632b681395c9 Mon Sep 17 00:00:00 2001 From: s-edwards Date: Mon, 18 Nov 2024 13:31:44 -0500 Subject: [PATCH 46/53] updated db/schema.rb after successful deployment --- db/schema.rb | 289 +++++++++++++++++++++++++-------------------------- 1 file changed, 139 insertions(+), 150 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index e2fb7443..08510747 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,9 +10,9 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20211101005101) do +ActiveRecord::Schema.define(version: 2021_11_01_005101) do - create_table "active_admin_comments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "active_admin_comments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "namespace" t.text "body" t.string "resource_id", default: "", null: false @@ -26,7 +26,7 @@ t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id" end - create_table "attempts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "attempts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "user_id", null: false t.integer "exercise_version_id", null: false t.datetime "submit_time", null: false @@ -47,14 +47,14 @@ t.index ["workout_score_id"], name: "index_attempts_on_workout_score_id" end - create_table "attempts_tag_user_scores", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "attempts_tag_user_scores", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "attempt_id" t.integer "tag_user_score_id" t.index ["attempt_id", "tag_user_score_id"], name: "attempts_tag_user_scores_idx", unique: true t.index ["tag_user_score_id"], name: "attempts_tag_user_scores_tag_user_score_id_fk" end - create_table "choices", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "choices", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "multiple_choice_prompt_id", null: false t.integer "position", null: false t.text "feedback" @@ -65,20 +65,20 @@ t.index ["multiple_choice_prompt_id"], name: "index_choices_on_multiple_choice_prompt_id" end - create_table "choices_multiple_choice_prompt_answers", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "choices_multiple_choice_prompt_answers", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "choice_id" t.integer "multiple_choice_prompt_answer_id" t.index ["choice_id", "multiple_choice_prompt_answer_id"], name: "choices_multiple_choice_prompt_answers_idx", unique: true t.index ["multiple_choice_prompt_answer_id"], name: "choices_MC_prompt_answers_MC_prompt_answer_id_fk" end - create_table "coding_prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "coding_prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.text "answer" t.text "error" t.integer "error_line_no" end - create_table "coding_prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "coding_prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.datetime "created_at" t.datetime "updated_at" t.string "class_name" @@ -89,7 +89,7 @@ t.boolean "hide_examples", default: false, null: false end - create_table "course_enrollments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "course_enrollments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "user_id", null: false t.integer "course_offering_id", null: false t.integer "course_role_id", null: false @@ -99,7 +99,7 @@ t.index ["user_id"], name: "index_course_enrollments_on_user_id" end - create_table "course_exercises", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "course_exercises", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "course_id", null: false t.integer "exercise_id", null: false t.datetime "created_at" @@ -108,7 +108,7 @@ t.index ["exercise_id"], name: "course_exercises_exercise_id_fk" end - create_table "course_offerings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "course_offerings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "course_id", null: false t.integer "term_id", null: false t.string "label", default: "", null: false @@ -123,7 +123,7 @@ t.index ["term_id"], name: "index_course_offerings_on_term_id" end - create_table "course_roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "course_roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "name", default: "", null: false t.boolean "can_manage_course", default: false, null: false t.boolean "can_manage_assignments", default: false, null: false @@ -132,7 +132,7 @@ t.boolean "builtin", default: false, null: false end - create_table "courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "name", default: "", null: false t.string "number", default: "", null: false t.integer "organization_id", null: false @@ -147,20 +147,23 @@ t.index ["user_group_id"], name: "index_courses_on_user_group_id" end - create_table "errors", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| - t.text "class_name" - t.text "status" + create_table "errors", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "usable_type" + t.integer "usable_id" + t.string "class_name" t.text "message" t.text "trace" - t.text "target" - t.text "referrer" + t.text "target_url" + t.text "referer_url" t.text "params" t.text "user_agent" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.index ["class_name"], name: "index_errors_on_class_name" + t.index ["created_at"], name: "index_errors_on_created_at" end - create_table "exercise_collections", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "exercise_collections", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "name" t.text "description" t.integer "user_group_id" @@ -175,20 +178,20 @@ t.index ["user_id"], name: "index_exercise_collections_on_user_id" end - create_table "exercise_families", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "exercise_families", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" end - create_table "exercise_owners", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "exercise_owners", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "exercise_id", null: false t.integer "owner_id", null: false t.index ["exercise_id", "owner_id"], name: "index_exercise_owners_on_exercise_id_and_owner_id", unique: true t.index ["owner_id"], name: "exercise_owners_owner_id_fk" end - create_table "exercise_versions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "exercise_versions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "stem_id" t.datetime "created_at" t.datetime "updated_at" @@ -203,16 +206,14 @@ t.index ["stem_id"], name: "index_exercise_versions_on_stem_id" end - add_index "exercise_versions", ["creator_id"], name: "exercise_versions_creator_id_fk", using: :btree - add_index "exercise_versions", ["irt_data_id"], name: "exercise_versions_irt_data_id_fk", using: :btree - add_index "exercise_versions", ["stem_id"], name: "index_exercise_versions_on_stem_id", using: :btree - - create_table "exercise_versions_resource_files", id: false, force: :cascade do |t| - t.integer "exercise_version_id", limit: 4, null: false - t.integer "resource_file_id", limit: 4, null: false + create_table "exercise_versions_resource_files", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "exercise_version_id", null: false + t.integer "resource_file_id", null: false + t.index ["exercise_version_id"], name: "index_exercise_versions_resource_files_on_exercise_version_id" + t.index ["resource_file_id"], name: "index_exercise_versions_resource_files_on_resource_file_id" end - create_table "exercise_workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "exercise_workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "exercise_id", null: false t.integer "workout_id", null: false t.integer "position", null: false @@ -223,7 +224,7 @@ t.index ["workout_id"], name: "exercise_workouts_workout_id_fk" end - create_table "exercises", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "exercises", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "question_type", null: false t.integer "current_version_id" t.datetime "created_at" @@ -244,13 +245,7 @@ t.index ["is_public"], name: "index_exercises_on_is_public" end - add_index "exercises", ["exercise_collection_id"], name: "index_exercises_on_exercise_collection_id", using: :btree - add_index "exercises", ["exercise_family_id"], name: "index_exercises_on_exercise_family_id", using: :btree - add_index "exercises", ["external_id"], name: "index_exercises_on_external_id", unique: true, using: :btree - add_index "exercises", ["irt_data_id"], name: "exercises_irt_data_id_fk", using: :btree - add_index "exercises", ["is_public"], name: "index_exercises_on_is_public", using: :btree - - create_table "friendly_id_slugs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "friendly_id_slugs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "slug", default: "", null: false t.integer "sluggable_id", null: false t.string "sluggable_type", limit: 50 @@ -262,14 +257,14 @@ t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" end - create_table "global_roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "global_roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "name", default: "", null: false t.boolean "can_manage_all_courses", default: false, null: false t.boolean "can_edit_system_configuration", default: false, null: false t.boolean "builtin", default: false, null: false end - create_table "group_access_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "group_access_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "user_id" t.integer "user_group_id" t.boolean "pending", default: true @@ -280,7 +275,7 @@ t.index ["user_id"], name: "index_group_access_requests_on_user_id" end - create_table "identities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "identities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "user_id", null: false t.string "provider", default: "", null: false t.string "uid", default: "", null: false @@ -290,20 +285,14 @@ t.index ["user_id"], name: "index_identities_on_user_id" end - create_table "irt_data", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "irt_data", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "attempt_count", null: false t.float "sum_of_scores", null: false t.float "difficulty", null: false t.float "discrimination", null: false end - create_table "languages", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "license_policies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "license_policies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "name" t.text "description" t.boolean "can_fork" @@ -312,7 +301,7 @@ t.datetime "updated_at" end - create_table "licenses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "licenses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "name" t.text "description" t.string "url" @@ -322,7 +311,7 @@ t.index ["license_policy_id"], name: "index_licenses_on_license_policy_id" end - create_table "lms_instances", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "lms_instances", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "consumer_key" t.string "consumer_secret" t.datetime "created_at" @@ -335,14 +324,14 @@ t.index ["url"], name: "index_lms_instances_on_url", unique: true end - create_table "lms_types", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| - t.string "name", default: "", null: false + create_table "lms_types", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name", null: false t.datetime "created_at" t.datetime "updated_at" t.index ["name"], name: "index_lms_types_on_name", unique: true end - create_table "lti_identities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "lti_identities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "lti_user_id" t.integer "user_id" t.integer "lms_instance_id" @@ -352,7 +341,7 @@ t.index ["user_id"], name: "index_lti_identities_on_user_id" end - create_table "lti_workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "lti_workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "workout_id" t.string "lms_assignment_id", null: false t.datetime "created_at" @@ -362,22 +351,22 @@ t.index ["workout_id"], name: "index_lti_workouts_on_workout_id" end - create_table "memberships", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "memberships", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "user_id" t.integer "user_group_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "multiple_choice_prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "multiple_choice_prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| end - create_table "multiple_choice_prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "multiple_choice_prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.boolean "allow_multiple", default: false, null: false t.boolean "is_scrambled", default: true, null: false end - create_table "organizations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "organizations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" @@ -387,18 +376,18 @@ t.index ["slug"], name: "index_organizations_on_slug", unique: true end - create_table "ownerships", force: :cascade do |t| - t.string "filename", limit: 255 - t.integer "resource_file_id", limit: 4 - t.integer "exercise_version_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "ownerships", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "filename" + t.integer "resource_file_id" + t.integer "exercise_version_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["exercise_version_id"], name: "index_ownerships_on_exercise_version_id" + t.index ["filename"], name: "index_ownerships_on_filename" + t.index ["resource_file_id"], name: "index_ownerships_on_resource_file_id" end - add_index "ownerships", ["exercise_version_id"], name: "index_ownerships_on_exercise_version_id", using: :btree - add_index "ownerships", ["filename"], name: "index_ownerships_on_filename", using: :btree - - create_table "prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "attempt_id" t.integer "prompt_id" t.integer "actable_id" @@ -409,7 +398,7 @@ t.index ["prompt_id"], name: "index_prompt_answers_on_prompt_id" end - create_table "prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "exercise_version_id", null: false t.text "question", null: false t.integer "position", null: false @@ -424,23 +413,20 @@ t.index ["irt_data_id"], name: "prompts_irt_data_id_fk" end - add_index "prompts", ["actable_id"], name: "index_prompts_on_actable_id", using: :btree - add_index "prompts", ["irt_data_id"], name: "prompts_irt_data_id_fk", using: :btree - - create_table "resource_files", force: :cascade do |t| - t.string "filename", limit: 255 - t.string "token", limit: 255, default: "", null: false - t.integer "user_id", limit: 4, null: false - t.boolean "public", default: true + create_table "resource_files", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "filename" + t.string "token", default: "", null: false + t.integer "user_id", null: false + t.boolean "public", default: true t.datetime "created_at" t.datetime "updated_at" - t.string "hashval", limit: 255 + t.string "hashval" + t.index ["hashval"], name: "index_resource_files_on_hashval" t.index ["token"], name: "index_resource_files_on_token" t.index ["user_id"], name: "index_resource_files_on_user_id" - t.index ["hashval"], name: "index_resource_files_on_hashval" end - create_table "signups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "signups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "first_name" t.string "last_name_name" t.string "email" @@ -450,13 +436,13 @@ t.datetime "updated_at" end - create_table "stems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "stems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.text "preamble" t.datetime "created_at" t.datetime "updated_at" end - create_table "student_extensions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "student_extensions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "user_id" t.integer "workout_offering_id" t.datetime "soft_deadline" @@ -469,7 +455,7 @@ t.index ["workout_offering_id"], name: "index_student_extensions_on_workout_offering_id" end - create_table "tag_user_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "tag_user_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "user_id", null: false t.integer "experience", default: 0 t.datetime "created_at" @@ -478,7 +464,7 @@ t.index ["user_id"], name: "index_tag_user_scores_on_user_id" end - create_table "taggings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "taggings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "tag_id" t.integer "taggable_id" t.string "taggable_type" @@ -497,13 +483,13 @@ t.index ["tagger_id"], name: "index_taggings_on_tagger_id" end - create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "name" t.integer "taggings_count", default: 0 t.index ["name"], name: "index_tags_on_name", unique: true end - create_table "terms", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "terms", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "season", null: false t.date "starts_on", null: false t.date "ends_on", null: false @@ -515,11 +501,11 @@ t.index ["year", "season"], name: "index_terms_on_year_and_season" end - create_table "test_case_results", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "test_case_results", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "test_case_id", null: false t.integer "user_id", null: false t.text "execution_feedback" - t.integer "feedback_line_no" + t.integer "feedback_line_no" t.datetime "created_at" t.datetime "updated_at" t.boolean "pass", null: false @@ -529,7 +515,7 @@ t.index ["user_id"], name: "index_test_case_results_on_user_id" end - create_table "test_cases", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "test_cases", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.text "negative_feedback" t.float "weight", null: false t.text "description" @@ -545,22 +531,22 @@ t.index ["coding_prompt_id"], name: "index_test_cases_on_coding_prompt_id" end - create_table "time_zones", force: :cascade do |t| - t.string "name", limit: 255 - t.string "zone", limit: 255 - t.string "display_as", limit: 255 + create_table "time_zones", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name" + t.string "zone" + t.string "display_as" t.datetime "created_at" t.datetime "updated_at" end - create_table "user_groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "user_groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "name" t.datetime "created_at" t.datetime "updated_at" t.text "description" end - create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" @@ -592,7 +578,7 @@ t.index ["time_zone_id"], name: "index_users_on_time_zone_id" end - create_table "visualization_loggings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "visualization_loggings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "user_id" t.integer "exercise_id" t.integer "workout_id" @@ -605,7 +591,7 @@ t.index ["workout_offering_id"], name: "index_visualization_loggings_on_workout_offering_id" end - create_table "workout_offerings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "workout_offerings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "course_offering_id", null: false t.integer "workout_id", null: false t.datetime "created_at" @@ -613,53 +599,51 @@ t.datetime "opening_date" t.datetime "soft_deadline" t.datetime "hard_deadline" - t.boolean "published", default: true, null: false - t.integer "time_limit", limit: 4 - t.integer "workout_policy_id", limit: 4 - t.integer "continue_from_workout_id", limit: 4 - t.string "lms_assignment_id", limit: 255 - t.boolean "most_recent", default: true - t.string "lms_assignment_url", limit: 255 - t.integer "attempt_limit", limit: 4 - end - - add_index "workout_offerings", ["continue_from_workout_id"], name: "workout_offerings_continue_from_workout_id_fk", using: :btree - add_index "workout_offerings", ["course_offering_id"], name: "index_workout_offerings_on_course_offering_id", using: :btree - add_index "workout_offerings", ["lms_assignment_id"], name: "index_workout_offerings_on_lms_assignment_id", using: :btree - add_index "workout_offerings", ["workout_id"], name: "index_workout_offerings_on_workout_id", using: :btree - add_index "workout_offerings", ["workout_policy_id"], name: "index_workout_offerings_on_workout_policy_id", using: :btree - - create_table "workout_owners", force: :cascade do |t| - t.integer "workout_id", limit: 4, null: false - t.integer "owner_id", limit: 4, null: false - end - - add_index "workout_owners", ["owner_id"], name: "workout_owners_owner_id_fk", using: :btree - add_index "workout_owners", ["workout_id", "owner_id"], name: "index_workout_owners_on_workout_id_and_owner_id", unique: true, using: :btree - - create_table "workout_policies", force: :cascade do |t| - t.boolean "hide_thumbnails_before_start" - t.boolean "hide_feedback_before_finish" - t.boolean "hide_compilation_feedback_before_finish" - t.boolean "no_review_before_close" - t.boolean "hide_feedback_in_review_before_close" - t.boolean "hide_thumbnails_in_review_before_close" - t.boolean "no_hints" - t.boolean "no_faq" - t.string "name", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "invisible_before_review" - t.string "description", limit: 255 - t.boolean "hide_score_before_finish" - t.boolean "hide_score_in_review_before_close" - end - - create_table "workout_scores", force: :cascade do |t| - t.integer "workout_id", limit: 4, null: false - t.integer "user_id", limit: 4, null: false - t.float "score", limit: 24 - t.boolean "completed" + t.boolean "published", default: true, null: false + t.integer "time_limit" + t.integer "workout_policy_id" + t.integer "continue_from_workout_id" + t.string "lms_assignment_id" + t.boolean "most_recent", default: true + t.string "lms_assignment_url" + t.integer "attempt_limit" + t.index ["continue_from_workout_id"], name: "workout_offerings_continue_from_workout_id_fk" + t.index ["course_offering_id"], name: "index_workout_offerings_on_course_offering_id" + t.index ["lms_assignment_id"], name: "index_workout_offerings_on_lms_assignment_id" + t.index ["workout_id"], name: "index_workout_offerings_on_workout_id" + t.index ["workout_policy_id"], name: "index_workout_offerings_on_workout_policy_id" + end + + create_table "workout_owners", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "workout_id", null: false + t.integer "owner_id", null: false + t.index ["owner_id"], name: "workout_owners_owner_id_fk" + t.index ["workout_id", "owner_id"], name: "index_workout_owners_on_workout_id_and_owner_id", unique: true + end + + create_table "workout_policies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.boolean "hide_thumbnails_before_start" + t.boolean "hide_feedback_before_finish" + t.boolean "hide_compilation_feedback_before_finish" + t.boolean "no_review_before_close" + t.boolean "hide_feedback_in_review_before_close" + t.boolean "hide_thumbnails_in_review_before_close" + t.boolean "no_hints" + t.boolean "no_faq" + t.string "name" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "invisible_before_review" + t.string "description" + t.boolean "hide_score_before_finish" + t.boolean "hide_score_in_review_before_close" + end + + create_table "workout_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "workout_id", null: false + t.integer "user_id", null: false + t.float "score" + t.boolean "completed" t.datetime "completed_at" t.datetime "last_attempted_at" t.integer "exercises_completed" @@ -677,7 +661,7 @@ t.index ["workout_offering_id"], name: "workout_scores_workout_offering_id_fk" end - create_table "workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t| + create_table "workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "name", default: "", null: false t.boolean "scrambled", default: false t.datetime "created_at" @@ -711,6 +695,7 @@ add_foreign_key "courses", "organizations", name: "courses_organization_id_fk" add_foreign_key "exercise_owners", "exercises", name: "exercise_owners_exercise_id_fk" add_foreign_key "exercise_owners", "users", column: "owner_id", name: "exercise_owners_owner_id_fk" + add_foreign_key "exercise_versions", "exercises", name: "exercise_versions_exercise_id_fk" add_foreign_key "exercise_versions", "irt_data", column: "irt_data_id", name: "exercise_versions_irt_data_id_fk" add_foreign_key "exercise_versions", "stems", name: "exercise_versions_stem_id_fk" add_foreign_key "exercise_versions", "users", column: "creator_id", name: "exercise_versions_creator_id_fk" @@ -719,13 +704,16 @@ add_foreign_key "exercise_workouts", "exercises", name: "exercise_workouts_exercise_id_fk" add_foreign_key "exercise_workouts", "workouts", name: "exercise_workouts_workout_id_fk" add_foreign_key "exercises", "exercise_families", name: "exercises_exercise_family_id_fk" + add_foreign_key "exercises", "exercise_versions", column: "current_version_id", name: "exercises_current_version_id_fk" add_foreign_key "exercises", "irt_data", column: "irt_data_id", name: "exercises_irt_data_id_fk" add_foreign_key "identities", "users", name: "identities_user_id_fk" add_foreign_key "lms_instances", "lms_types", name: "lms_instances_lms_type_id_fk" - add_foreign_key "lti_workouts", "lms_instances", name: "lti_workouts_lms_instance_id_fk" + add_foreign_key "lti_workouts", "lms_instances" add_foreign_key "ownerships", "exercise_versions" + add_foreign_key "ownerships", "resource_files" add_foreign_key "prompt_answers", "attempts", name: "prompt_answers_attempt_id_fk" add_foreign_key "prompt_answers", "prompts", name: "prompt_answers_prompt_id_fk" + add_foreign_key "prompts", "exercise_versions", name: "prompts_exercise_version_id_fk" add_foreign_key "prompts", "irt_data", column: "irt_data_id", name: "prompts_irt_data_id_fk" add_foreign_key "resource_files", "users", name: "resource_files_user_id_fk" add_foreign_key "student_extensions", "users", name: "student_extensions_user_id_fk" @@ -734,6 +722,7 @@ add_foreign_key "test_case_results", "coding_prompt_answers", name: "test_case_results_coding_prompt_answer_id_fk" add_foreign_key "test_case_results", "test_cases", name: "test_case_results_test_case_id_fk" add_foreign_key "test_case_results", "users", name: "test_case_results_user_id_fk" + add_foreign_key "test_cases", "coding_prompts", name: "test_cases_coding_prompt_id_fk" add_foreign_key "users", "global_roles", name: "users_global_role_id_fk" add_foreign_key "users", "time_zones", name: "users_time_zone_id_fk" add_foreign_key "users", "workout_scores", column: "current_workout_score_id", name: "users_current_workout_score_id_fk" @@ -743,7 +732,7 @@ add_foreign_key "workout_offerings", "workouts", name: "workout_offerings_workout_id_fk" add_foreign_key "workout_owners", "users", column: "owner_id", name: "workout_owners_owner_id_fk" add_foreign_key "workout_owners", "workouts", name: "workout_owners_workout_id_fk" - add_foreign_key "workout_scores", "lti_workouts", name: "workout_scores_lti_workout_id_fk" + add_foreign_key "workout_scores", "lti_workouts" add_foreign_key "workout_scores", "users", name: "workout_scores_user_id_fk" add_foreign_key "workout_scores", "workout_offerings", name: "workout_scores_workout_offering_id_fk" add_foreign_key "workout_scores", "workouts", name: "workout_scores_workout_id_fk" From e2afc7b634f4fdd501415a7c39718b2c0931bdf5 Mon Sep 17 00:00:00 2001 From: s-edwards Date: Tue, 10 Dec 2024 10:38:19 -0500 Subject: [PATCH 47/53] added rails 4.2 version constraint to 2024 migrations --- .../20240207035240_add_compound_index_to_workout_scores.rb | 2 +- db/migrate/20240207040304_add_compound_index_to_attempts.rb | 2 +- .../20240207161742_add_lti_user_id_index_to_lti_identities.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/migrate/20240207035240_add_compound_index_to_workout_scores.rb b/db/migrate/20240207035240_add_compound_index_to_workout_scores.rb index 1be6f06f..52ca4a00 100644 --- a/db/migrate/20240207035240_add_compound_index_to_workout_scores.rb +++ b/db/migrate/20240207035240_add_compound_index_to_workout_scores.rb @@ -1,4 +1,4 @@ -class AddCompoundIndexToWorkoutScores < ActiveRecord::Migration +class AddCompoundIndexToWorkoutScores < ActiveRecord::Migration[4.2] def change add_index :workout_scores, [:user_id, :workout_id, :workout_offering_id], name: 'idx_ws_on_user_workout_workout_offering' diff --git a/db/migrate/20240207040304_add_compound_index_to_attempts.rb b/db/migrate/20240207040304_add_compound_index_to_attempts.rb index 6c3d48b6..cbda48c9 100644 --- a/db/migrate/20240207040304_add_compound_index_to_attempts.rb +++ b/db/migrate/20240207040304_add_compound_index_to_attempts.rb @@ -1,4 +1,4 @@ -class AddCompoundIndexToAttempts < ActiveRecord::Migration +class AddCompoundIndexToAttempts < ActiveRecord::Migration[4.2] def change add_index :attempts, [:user_id, :exercise_version_id], name: 'idx_attempts_on_user_exercise_version' diff --git a/db/migrate/20240207161742_add_lti_user_id_index_to_lti_identities.rb b/db/migrate/20240207161742_add_lti_user_id_index_to_lti_identities.rb index 6a94b856..f04b9f7c 100644 --- a/db/migrate/20240207161742_add_lti_user_id_index_to_lti_identities.rb +++ b/db/migrate/20240207161742_add_lti_user_id_index_to_lti_identities.rb @@ -1,4 +1,4 @@ -class AddLtiUserIdIndexToLtiIdentities < ActiveRecord::Migration +class AddLtiUserIdIndexToLtiIdentities < ActiveRecord::Migration[4.2] def change add_index :lti_identities, :lti_user_id end From cb9070a3896124e44d5f1412710735077f594d2f Mon Sep 17 00:00:00 2001 From: s-edwards Date: Fri, 7 Feb 2025 10:59:41 -0500 Subject: [PATCH 48/53] updated from live staging server --- db/schema.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 8cb24948..81f27878 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20240207161742) do +ActiveRecord::Schema.define(version: 2024_02_07_161742) do create_table "active_admin_comments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "namespace" @@ -43,13 +43,12 @@ t.decimal "worker_time", precision: 10 t.index ["active_score_id"], name: "index_attempts_on_active_score_id" t.index ["exercise_version_id"], name: "index_attempts_on_exercise_version_id" + t.index ["user_id", "exercise_version_id"], name: "idx_attempts_on_user_exercise_version" t.index ["user_id"], name: "index_attempts_on_user_id" + t.index ["workout_score_id", "exercise_version_id"], name: "idx_attempts_on_workout_score_exercise_version" t.index ["workout_score_id"], name: "index_attempts_on_workout_score_id" end - add_index "attempts", ["user_id", "exercise_version_id"], name: "idx_attempts_on_user_exercise_version", using: :btree - add_index "attempts", ["workout_score_id", "exercise_version_id"], name: "idx_attempts_on_workout_score_exercise_version", using: :btree - create_table "attempts_tag_user_scores", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "attempt_id" t.integer "tag_user_score_id" @@ -341,11 +340,10 @@ t.datetime "created_at" t.datetime "updated_at" t.index ["lms_instance_id"], name: "index_lti_identities_on_lms_instance_id" + t.index ["lti_user_id"], name: "index_lti_identities_on_lti_user_id" t.index ["user_id"], name: "index_lti_identities_on_user_id" end - add_index "lti_identities", ["lti_user_id"], name: "index_lti_identities_on_lti_user_id", using: :btree - create_table "lti_workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.integer "workout_id" t.string "lms_assignment_id", null: false @@ -661,13 +659,12 @@ t.integer "lti_workout_id" t.datetime "started_at" t.index ["lti_workout_id"], name: "index_workout_scores_on_lti_workout_id" + t.index ["user_id", "workout_id", "workout_offering_id"], name: "idx_ws_on_user_workout_workout_offering" t.index ["user_id"], name: "index_workout_scores_on_user_id" t.index ["workout_id"], name: "index_workout_scores_on_workout_id" t.index ["workout_offering_id"], name: "workout_scores_workout_offering_id_fk" end - add_index "workout_scores", ["user_id", "workout_id", "workout_offering_id"], name: "idx_ws_on_user_workout_workout_offering", using: :btree - create_table "workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "name", default: "", null: false t.boolean "scrambled", default: false @@ -700,6 +697,7 @@ add_foreign_key "course_offerings", "courses", name: "course_offerings_course_id_fk" add_foreign_key "course_offerings", "terms", name: "course_offerings_term_id_fk" add_foreign_key "courses", "organizations", name: "courses_organization_id_fk" + add_foreign_key "exercise_owners", "exercises", name: "exercise_owners_exercise_id_fk" add_foreign_key "exercise_owners", "users", column: "owner_id", name: "exercise_owners_owner_id_fk" add_foreign_key "exercise_versions", "exercises", name: "exercise_versions_exercise_id_fk" add_foreign_key "exercise_versions", "irt_data", column: "irt_data_id", name: "exercise_versions_irt_data_id_fk" From c2af174eb595bacff0f0338d94656b55abca45af Mon Sep 17 00:00:00 2001 From: s-edwards Date: Fri, 7 Feb 2025 11:20:45 -0500 Subject: [PATCH 49/53] fixed publicly_visible() error --- app/models/exercise.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/models/exercise.rb b/app/models/exercise.rb index 6249e1af..b6dff0a9 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -187,16 +187,16 @@ def self.visible_to_user(user) def self.publicly_visible public_license = Exercise.joins( exercise_collection: [ license: :license_policy ]) - .where(is_public: nil, exercise_collection: - { license: - { license_policy: - { is_public: true } } } - ) + .where('exercises.is_public is null and license_policies.is_public = true') + # .where(is_public: nil, exercise_collection: + # { license: + # { license_policy: + # { is_public: true } } } + # ) - public_exercise = Exercise.where(is_public: true) + public_exercises = Exercise.where(is_public: true) - return Exercise.joins(exercise_collection: [ license: :license_policy ]) - .where('(exercises.is_public is null and license_policies.is_public = true) or exercises.is_public = true') + return public_exercises.union(public_license) end From fcf881da54ec8731571e9e23022d77fea3c41b51 Mon Sep 17 00:00:00 2001 From: s-edwards Date: Tue, 18 Feb 2025 11:38:55 -0500 Subject: [PATCH 50/53] upgraded errors table for v0.8.0.0 of exception_handler gem --- .../20250218154318_upgrade_errors_table.rb | 21 +++++++++++++++++++ db/schema.rb | 11 +++++----- 2 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20250218154318_upgrade_errors_table.rb diff --git a/db/migrate/20250218154318_upgrade_errors_table.rb b/db/migrate/20250218154318_upgrade_errors_table.rb new file mode 100644 index 00000000..2cdf61ca --- /dev/null +++ b/db/migrate/20250218154318_upgrade_errors_table.rb @@ -0,0 +1,21 @@ +class UpgradeErrorsTable < ActiveRecord::Migration[5.2] + + # Upgrades the structure of the "errors" table used to store exception + # data using the exception_handler gem. The gem changed the table structure + # without including a corresponding migration of its own, so this migration + # is intended to change the structure to match the gem's 0.8.0.0 version. + + # The list of attributes from the exception model class in the gem: + # ATTRS = %i(class_name status message trace target referrer params user_agent) + + # The old structure: (class_name message trace target_url referer_url params user_agent) + + def change + change_table :errors do |t| + t.rename :target_url, :target + t.rename :referer_url, :referrer + t.change :class_name, :text + t.text :status + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 81f27878..a73a45ac 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2024_02_07_161742) do +ActiveRecord::Schema.define(version: 2025_02_18_154318) do create_table "active_admin_comments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "namespace" @@ -152,16 +152,17 @@ create_table "errors", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.string "usable_type" t.integer "usable_id" - t.string "class_name" + t.text "class_name" t.text "message" t.text "trace" - t.text "target_url" - t.text "referer_url" + t.text "target" + t.text "referrer" t.text "params" t.text "user_agent" t.datetime "created_at" t.datetime "updated_at" - t.index ["class_name"], name: "index_errors_on_class_name" + t.text "status" + t.index ["class_name"], name: "index_errors_on_class_name", length: 1024 t.index ["created_at"], name: "index_errors_on_created_at" end From f2498269b8ff67050c0121ab71e917748c841e73 Mon Sep 17 00:00:00 2001 From: s-edwards Date: Thu, 20 Feb 2025 22:23:48 -0500 Subject: [PATCH 51/53] PEML translation now working, but still some data model mismatches (method name, class name, and csv-unquoted) --- app/controllers/exercises_controller.rb | 56 ++++--- app/utils/peml_parsing_util.rb | 200 +++++++++++++++--------- app/views/layouts/_flash.html.haml | 5 +- config/routes.rb | 12 +- 4 files changed, 172 insertions(+), 101 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index d4efbf16..ddf6431d 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -165,7 +165,7 @@ def new # ------------------------------------------------------------- # GET /exercises/1/edit def edit - puts "ResourceFile.UPLOAD_PATH = #{ResourceFile::UPLOAD_PATH}" + logger.debug "ResourceFile.UPLOAD_PATH = #{ResourceFile::UPLOAD_PATH}" @exercise_version = @exercise.current_version @attached_files = [] @exercise_version.ownerships.each do |e| @@ -201,6 +201,7 @@ def edit # ------------------------------------------------------------- # POST /exercises def create + # REMOVE? ex = Exercise.new exercise_version = ExerciseVersion.new(exercise: ex) msg = params[:exercise] || params[:coding_question] @@ -275,6 +276,7 @@ def random_exercise # ------------------------------------------------------------- # POST exercises/create_mcqs def create_mcqs + # REMOVE CSV.foreach(params[:form].fetch(:mcqfile).path, {headers: true}) do |row| if row['Question'].include?('Python') next @@ -289,22 +291,26 @@ def create_mcqs # ------------------------------------------------------------- # GET exercises/upload_mcqs def upload_mcqs + # REMOVE end # ------------------------------------------------------------- # GET exercises/upload_exercises def upload + # REMOVE end # ------------------------------------------------------------- def upload_yaml + # REMOVE end # ------------------------------------------------------------- def yaml_create + # REMOVE @yaml_exers = YAML.load_file(params[:form].fetch(:yamlfile).path) @yaml_exers.each do |exercise| @ex = Exercise.new @@ -371,22 +377,30 @@ def upload_create text_representation = File.read(params[:form][:file].path) edit_rights = 0 # Personal exercise end - if text_representation.to_s.include? ('exercise_id') - hash = PemlParsingUtil.new.parse(text_representation) - else + if text_representation.start_with?('---') hash = YAML.load(text_representation) - end - files = exercise_params[:files] - fileList = exercise_params[:fileList] - if fileList != "" && !files.nil? - files = cleanFile(files,fileList) + else + logger.debug '==========' + logger.debug 'PEML Input' + logger.debug '==========' + logger.debug text_representation + hash = PemlParsingUtil.new.parse(text_representation) + logger.debug '==========' + logger.debug 'PEML Hash' + logger.debug '==========' + logger.debug hash.to_yaml + logger.debug '==========' end if !hash.kind_of?(Array) hash = [hash] end files = exercise_params[:files] - puts "files = #{files.inspect}" + fileList = exercise_params[:fileList] + if fileList != "" && !files.nil? + files = cleanFile(files,fileList) + end + logger.debug "files = #{files.inspect}" @attached_files = exercise_params[:attached_files] if @attached_files == "null" @attached_files = nil @@ -394,7 +408,7 @@ def upload_create if @attached_files @attached_files = JSON.parse(@attached_files) end - puts "attached files = #{@attached_files.inspect}" + logger.debug "attached files = #{@attached_files.inspect}" # figure out if we need to add this to an exercise collection exercise_collection = nil @@ -430,7 +444,7 @@ def upload_create if !e.save success_all = false # put together an error message - error_msgs << "Errors while saving exercise #{e.andand.name}:
      " + error_msgs << "

      Errors while saving exercise #{e.andand.name}:

        " e.errors.full_messages.each do |msg| error_msgs << "
      • #{msg}
      • " end @@ -444,16 +458,16 @@ def upload_create # copy all retained resource files, skipping any to be removed prev_version = e.exercise_versions.offset(1).first if prev_version - puts "processing ownerships from prev version #{prev_version.id}" + logger.debug "processing ownerships from prev version #{prev_version.id}" prev_version.ownerships.each do |o| - puts "checking ownership #{o.inspect}" + logger.debug "checking ownership #{o.inspect}" # Double-loop isn't the greatest design, but both lists are short @attached_files.each do |a| - puts "checking against attachment #{a.inspect}" + logger.debug "checking against attachment #{a.inspect}" # uploaded flag is true if it was previously uploaded # deleted flag is true if it is to be pruned/removed from exercise if a['name'] == o.filename && a['uploaded'] && !a['deleted'] - puts "adding ownership record" + logger.debug "adding ownership record" ownertable = ex_ver.ownerships.create!( filename: o.filename, resource_file: o.resource_file) @@ -464,9 +478,9 @@ def upload_create # Now add all newly uploaded attached files if files files.each do |file| - puts "processing new upload #{file.inspect}" + logger.debug "processing new upload #{file.inspect}" @attached_files.each do |a| - puts "checking against attachment #{a.inspect}" + logger.debug "checking against attachment #{a.inspect}" if a['name'] == file.original_filename && !a['uploaded'] && !a['deleted'] Ownership.create!( filename: file.original_filename, @@ -495,10 +509,10 @@ def upload_create redirect_to @return_to, flash: { success: success_msgs.html_safe } and return else if !success_msgs.blank? - error_msgs << 'Some exercises were successfully saved.' + error_msgs << '

        Some exercises were successfully saved.

        ' error_msgs << '
          ' + success_msgs.join('') + '
        ' end - redirect_to @return_to, flash: { error: error_msgs.join("").html_safe } and return + redirect_back fallback_location: @return_to, flash: { error: error_msgs.join("").html_safe } and return end end @@ -934,7 +948,7 @@ def evaluate if exercise_prompt_answer.save CodeWorker.new.async.perform(@attempt.id) else - puts 'IMPROPER PROMPT', + logger.error 'IMPROPER PROMPT', 'unable to save prompt_answer: ' \ "#{prompt_answer.errors.full_messages.to_s}", 'IMPROPER PROMPT' diff --git a/app/utils/peml_parsing_util.rb b/app/utils/peml_parsing_util.rb index 924072e4..0018549e 100644 --- a/app/utils/peml_parsing_util.rb +++ b/app/utils/peml_parsing_util.rb @@ -4,87 +4,141 @@ require 'uri' class PemlParsingUtil - def parse (text_representation) - convert_peml(Peml::Loader.new.load(text_representation).dottie!) - end + def parse (text_representation) + convert_peml(Peml::Loader.new.load(text_representation).dottie!) + end # Convert the parsed peml hash into a hash corresponding to exercise data model - def convert_peml(hash) + def convert_peml(hash) + hash = Dottie(hash) #starting with three compulsory peml keys - new_hash = {"external_id" => hash["exercise_id"], "name" => hash["title"]}.dottie! - new_hash["experience"] = hash["difficulty"] - new_hash["tag_list"] = hash["tag"].to_s + new_hash = { + 'external_id' => hash['exercise_id'], + 'name' => hash['title'] + }.dottie! + new_hash['experience'] = hash['difficulty'] if hash['difficulty'] + new_hash['tag_list'] = hash['tags.topics'].to_s if hash['tags.topics'] - # PEML does not have an is_public equivalent so we put this value under a key of the same name - new_hash["is_public"] = hash["is_public"] + # PEML does not have an is_public equivalent so we put this value + # under a key of the same name + # new_hash["is_public"] = hash["is_public"] - # PEML is designed to handle programming assignments and 'code writing' is the equivalent in code-workout - new_hash["style_list"] = "code writing" + # PEML is designed to handle programming assignments and 'code writing' + # is the equivalent in code-workout + new_hash['style_list'] = hash['tags.style'].to_s || 'code writing' - new_hash["language_list"] = "" - hash["systems"].each do |system| - new_hash["language_list"]+=system["language"] - end + starter_code = nil + wrapper_code = nil + tests = nil + systems = hash['systems'] + if systems + system = systems.first + new_hash['language_list'] = system['language'] + # assets should be under the system, so try to grab them here first + Rails.logger.debug 'get_file_content(system[\'assets.code.starter\'])' + starter_code = get_file_content(system['assets.code.starter']) + Rails.logger.debug 'get_file_content(system[\'assets.code.wrapper\'])' + wrapper_code = get_file_content(system['assets.code.wrapper']) + Rails.logger.debug 'get_file_content(system[\'assets.test\'])' + tests = get_file_content(system['assets.test']) + end - new_hash["current_version"] = {} - new_hash["current_version.version"] = hash["version.id"] - new_hash["current_version.creator"] = get_author(hash) - new_hash["current_version.prompts"] = [] - prompt = {"position" => 1, "question" => hash["instructions"], "class_name" => "", "method_name" => ""} - - #------------------------------------------------------------------------------------------- - # PEML assets are either remote URLs or array of files which have different keys. - # We try to fetch content from the files. - prompt["starter_code"] = get_content(hash["assets.code.starter"]) - prompt["wrapper_code"] = get_content(hash["assets.code.wrapper"]) - prompt["tests"] = get_content(hash["assets.test"]) - #------------------------------------------------------------------------------------------- - - #Again, PEML is designed for coding problems and thus, 'coding_prompt' - new_hash["current_version.prompts"]<<{"coding_prompt" => prompt} - new_hash - end + new_hash['current_version'] = {} + new_hash['current_version.version'] = hash['version.id'] if hash['version.id'] + new_hash['current_version.creator'] = get_author_email(hash) + new_hash['current_version.prompts'] = [] + prompt = { + 'position' => 1, + 'question' => hash['instructions'], + 'class_name' => 'Answer', + 'method_name' => 'answer' + } - def get_author(hash) - creator = "" - if hash.key?("authors") - hash["authors"].each do |author| - if author.is_a? String - creator += author - else - creator += author.key?("email") ? author["email"] : author["name"] - end - creator += "," - end - creator.delete_suffix!(",") - elsif(hash.key?("author")) - if hash["author"].is_a? String - creator = hash["author"] - else - creator = hash["author"].key?("email") ? hash["author.email"] : hash["author.name"] - end - elsif(hash.key?("license")) - creator = hash["license.owner"] - end - creator - end + #----------------------------------------------------------------------- + # PEML assets might be at the global level, if they apply to all + # systems, so fill in missing assets here + Rails.logger.debug 'assets:' + Rails.logger.debug hash['assets'].to_yaml + Rails.logger.debug 'get_file_content(hash[\'assets.code.starter\'])' + starter_code ||= get_file_content(hash['assets.code.starter']) + prompt['starter_code'] = starter_code if starter_code + Rails.logger.debug 'get_file_content(hash[\'assets.code.wrapper\'])' + wrapper_code ||= get_file_content(hash['assets.code.wrapper']) + prompt['wrapper_code'] = wrapper_code if wrapper_code + Rails.logger.debug 'get_file_content(hash[\'assets.test\'])' + tests ||= get_file_content(hash['assets.test']) + # FIXME: give error if missing tests + prompt['tests'] = tests if tests + #----------------------------------------------------------------------- + + # Again, PEML is designed for coding problems and thus, 'coding_prompt' + new_hash['current_version.prompts'] << { 'coding_prompt' => prompt } + new_hash + end - def get_content(asset_child) - asset_collection = [] - if asset_child.is_a? String - begin - uri = URI.parse(asset_child) - if uri.is_a?(URI::HTTP) && !uri.host.nil? - asset_collection << Net::HTTP.get(uri) - end - rescue URI::InvalidURIError - asset_collection << "" - end - elsif asset_child.is_a? Array - asset_child.each do |asset_file| - asset_collection << asset_file["files"]["content"] - end + def get_author_email(hash) + creator = hash['author.email'] || hash['license.owner.email'] + if !creator and hash.key?('authors') + creator = hash['authors[0].email'] + end + Rails.logger.debug "get_author_email() = '#{creator}'" + creator + end + + def get_file_content(files) + content = nil + file = nil + Rails.logger.debug '==========' + Rails.logger.debug 'get_file_content(files), files:' + Rails.logger.debug '==========' + Rails.logger.debug files.to_yaml + Rails.logger.debug files.inspect + if files + file = files['files'][0] + Rails.logger.debug '==========' + Rails.logger.debug 'get_file_content(files), file:' + Rails.logger.debug '==========' + Rails.logger.debug file.to_yaml + Rails.logger.debug file.inspect + end + if file.is_a? String + file.strip! + if file.sub!(/^url\((.*)\)$/, '\1') + uri = URI.parse(file) + if uri.is_a?(URI::HTTP) && !uri.host.nil? + content = Net::HTTP.get(uri) end - asset_collection.join(',') + else + # FIXME: is this an error? + content = file end -end \ No newline at end of file + + # FIXME: add error checking if URL not parsable/readable + elsif file.is_a? Hash + content = file['content'] + else + # FIXME: add error checking if not a hash + end + content + end + +# def get_content(asset_child) +# asset_collection = [] +# if asset_child.is_a? String +# begin +# uri = URI.parse(asset_child) +# if uri.is_a?(URI::HTTP) && !uri.host.nil? +# asset_collection << Net::HTTP.get(uri) +# end +# rescue URI::InvalidURIError +# # asset_collection << "" +# # FIXME: Needs error message generation +# end +# elsif asset_child.is_a? Array +# asset_child.each do |asset_file| +# asset_collection << asset_file["files"]["content"] +# end +# end +# asset_collection.join(',') +# end +end diff --git a/app/views/layouts/_flash.html.haml b/app/views/layouts/_flash.html.haml index ecd80db3..4d6fa16b 100644 --- a/app/views/layouts/_flash.html.haml +++ b/app/views/layouts/_flash.html.haml @@ -3,4 +3,7 @@ %div{ class: "alert #{flash_class_for(type)} fade in", role: 'alert' } %button.close{ data: { dismiss: 'alert'} } × = icon_tag_for(type) - = message + - if message && message.start_with?('<') + = raw message + - else + = message diff --git a/config/routes.rb b/config/routes.rb index ae1c50c9..3e7f25b5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -46,14 +46,14 @@ # /gym/exercises ... get 'exercises/call_open_pop' => 'exercises#call_open_pop' - get 'exercises_import' => 'exercises#upload_yaml' - post 'exercises_yaml_create' => 'exercises#yaml_create' + get 'exercises_import' => 'exercises#upload_yaml' # REMOVE + post 'exercises_yaml_create' => 'exercises#yaml_create' # REMOVE get 'exercises/upload' => 'exercises#upload', as: :exercises_upload get 'exercises/download' => 'exercises#download', as: :exercises_download post 'exercises/upload_create' => 'exercises#upload_create' get 'exercises/upload_mcqs' => 'exercises#upload_mcqs', - as: :exercises_upload_mcqs - post 'exercises/create_mcqs' => 'exercises#create_mcqs' + as: :exercises_upload_mcqs # REMOVE + post 'exercises/create_mcqs' => 'exercises#create_mcqs' # REMOVE get '/exercises/any' => 'exercises#random_exercise', as: :random_exercise get 'exercises/:id/practice' => 'exercises#practice', @@ -87,8 +87,8 @@ as: :practice_workout get 'workouts/:id/evaluate' => 'workouts#evaluate', as: :workout_evaluate get 'workouts_dummy' => 'workouts#dummy' - get 'workouts_import' => 'workouts#upload_yaml' - post 'workouts_yaml_create' => 'workouts#yaml_create' + get 'workouts_import' => 'workouts#upload_yaml' # REMOVE? + post 'workouts_yaml_create' => 'workouts#yaml_create' # REMOVE? post 'workouts/search' => 'workouts#search', as: :workouts_search get 'workouts/:id/download_attempt_data' => 'workouts#download_attempt_data', as: :download_workout_attempt_data From d89df52facb20367395281656fc034383b3cc0e2 Mon Sep 17 00:00:00 2001 From: s-edwards Date: Sun, 23 Feb 2025 20:06:50 -0500 Subject: [PATCH 52/53] Updates to PEML data mapping --- app/controllers/exercises_controller.rb | 130 ++++++++++--------- app/utils/peml_parsing_util.rb | 158 +++++++++++++++++++----- 2 files changed, 198 insertions(+), 90 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index ddf6431d..7a7f6543 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -377,6 +377,8 @@ def upload_create text_representation = File.read(params[:form][:file].path) edit_rights = 0 # Personal exercise end + error_msgs = [] + # FIXME: add support for JSON here as well if text_representation.start_with?('---') hash = YAML.load(text_representation) else @@ -384,12 +386,23 @@ def upload_create logger.debug 'PEML Input' logger.debug '==========' logger.debug text_representation - hash = PemlParsingUtil.new.parse(text_representation) + hash = PemlParsingUtil.new.parse(text_representation, error_msgs) logger.debug '==========' logger.debug 'PEML Hash' logger.debug '==========' logger.debug hash.to_yaml logger.debug '==========' + + if !error_msgs.empty? + raw_msgs = error_msgs + error_msgs = [] + error_msgs << "Errors while parsing PEML for exercise #{hash['name']}:
          " + raw_msgs.each do |msg| + error_msgs << "
        • #{msg}
        • " + end + error_msgs << "
        " + end + end if !hash.kind_of?(Array) hash = [hash] @@ -437,79 +450,82 @@ def upload_create # parse the text_representation exercises = ExerciseRepresenter.for_collection.new([]).from_hash(hash) - success_all = true - error_msgs = [] + success_all = error_msgs.empty? success_msgs = [] - exercises.each do |e| - if !e.save - success_all = false - # put together an error message - error_msgs << "

        Errors while saving exercise #{e.andand.name}:

          " - e.errors.full_messages.each do |msg| - error_msgs << "
        • #{msg}
        • " - end - error_msgs << "
        " - else # successfully created the exercise - ex_ver = e.current_version - - # make the current user an exercise owner if they aren't already - e.add_owner!(current_user) - - # copy all retained resource files, skipping any to be removed - prev_version = e.exercise_versions.offset(1).first - if prev_version - logger.debug "processing ownerships from prev version #{prev_version.id}" - prev_version.ownerships.each do |o| - logger.debug "checking ownership #{o.inspect}" - # Double-loop isn't the greatest design, but both lists are short - @attached_files.each do |a| - logger.debug "checking against attachment #{a.inspect}" - # uploaded flag is true if it was previously uploaded - # deleted flag is true if it is to be pruned/removed from exercise - if a['name'] == o.filename && a['uploaded'] && !a['deleted'] - logger.debug "adding ownership record" - ownertable = ex_ver.ownerships.create!( - filename: o.filename, - resource_file: o.resource_file) + successful_exercise = nil + if success_all + exercises.each do |e| + if !e.save + success_all = false + # put together an error message + error_msgs << "Errors while saving exercise #{e.andand.name}:
          " + e.errors.full_messages.each do |msg| + error_msgs << "
        • #{msg}
        • " + end + error_msgs << "
        " + else # successfully created the exercise + successful_exercise ||= e + ex_ver = e.current_version + + # make the current user an exercise owner if they aren't already + e.add_owner!(current_user) + + # copy all retained resource files, skipping any to be removed + prev_version = e.exercise_versions.offset(1).first + if prev_version + logger.debug "processing ownerships from prev version #{prev_version.id}" + prev_version.ownerships.each do |o| + logger.debug "checking ownership #{o.inspect}" + # Double-loop isn't the greatest design, but both lists are short + @attached_files.each do |a| + logger.debug "checking against attachment #{a.inspect}" + # uploaded flag is true if it was previously uploaded + # deleted flag is true if it is to be pruned/removed from exercise + if a['name'] == o.filename && a['uploaded'] && !a['deleted'] + logger.debug "adding ownership record" + ownertable = ex_ver.ownerships.create!( + filename: o.filename, + resource_file: o.resource_file) + end end end end - end - # Now add all newly uploaded attached files - if files - files.each do |file| - logger.debug "processing new upload #{file.inspect}" - @attached_files.each do |a| - logger.debug "checking against attachment #{a.inspect}" - if a['name'] == file.original_filename && !a['uploaded'] && !a['deleted'] - Ownership.create!( - filename: file.original_filename, - exercise_version: ex_ver, - resource_file: ResourceFile.for_upload(file, current_user) - ) + # Now add all newly uploaded attached files + if files + files.each do |file| + logger.debug "processing new upload #{file.inspect}" + @attached_files.each do |a| + logger.debug "checking against attachment #{a.inspect}" + if a['name'] == file.original_filename && !a['uploaded'] && !a['deleted'] + Ownership.create!( + filename: file.original_filename, + exercise_version: ex_ver, + resource_file: ResourceFile.for_upload(file, current_user) + ) + end end end end - end - # Add exercise to collection - exercise_collection.andand.add(e, override: true) + # Add exercise to collection + exercise_collection.andand.add(e, override: true) - # Update the text representation - e.current_version.update(text_representation: text_representation) + # Update the text representation + e.current_version.update(text_representation: text_representation) - # Notify user of success - success_msgs << - "
      • X#{e.id}: #{e.name} saved
      • " + # Notify user of success + success_msgs << + "
      • X#{e.id}: #{e.name} saved
      • " + end end end if success_all success_msgs = '
          ' + success_msgs.join("") + '
        ' - redirect_to @return_to, flash: { success: success_msgs.html_safe } and return + redirect_to exercise_practice_path(successful_exercise), flash: { success: success_msgs.html_safe } and return else if !success_msgs.blank? - error_msgs << '

        Some exercises were successfully saved.

        ' + error_msgs << 'Some exercises were successfully saved.' error_msgs << '
          ' + success_msgs.join('') + '
        ' end redirect_back fallback_location: @return_to, flash: { error: error_msgs.join("").html_safe } and return diff --git a/app/utils/peml_parsing_util.rb b/app/utils/peml_parsing_util.rb index 0018549e..9a58bd08 100644 --- a/app/utils/peml_parsing_util.rb +++ b/app/utils/peml_parsing_util.rb @@ -4,20 +4,24 @@ require 'uri' class PemlParsingUtil - def parse (text_representation) - convert_peml(Peml::Loader.new.load(text_representation).dottie!) + def parse (text_representation, error_msgs) + peml = Peml::Loader.new.load(text_representation).dottie! + error_msgs.concat(Peml::validate(peml)) + convert_peml(peml, error_msgs) end # Convert the parsed peml hash into a hash corresponding to exercise data model - def convert_peml(hash) + def convert_peml(hash, error_msgs) hash = Dottie(hash) #starting with three compulsory peml keys new_hash = { 'external_id' => hash['exercise_id'], 'name' => hash['title'] }.dottie! - new_hash['experience'] = hash['difficulty'] if hash['difficulty'] - new_hash['tag_list'] = hash['tags.topics'].to_s if hash['tags.topics'] + content = hash['difficulty'] + new_hash['experience'] = content if content + content = hash['tags.topics'] + new_hash['tag_list'] = content.to_s if content # PEML does not have an is_public equivalent so we put this value # under a key of the same name @@ -27,55 +31,69 @@ def convert_peml(hash) # is the equivalent in code-workout new_hash['style_list'] = hash['tags.style'].to_s || 'code writing' - starter_code = nil - wrapper_code = nil - tests = nil + prompt = { + 'position' => 1, + 'question' => hash['instructions'] + } systems = hash['systems'] if systems system = systems.first new_hash['language_list'] = system['language'] # assets should be under the system, so try to grab them here first Rails.logger.debug 'get_file_content(system[\'assets.code.starter\'])' - starter_code = get_file_content(system['assets.code.starter']) + content = get_file_content(system['assets.code.starter']) + prompt['starter_code'] = content if content Rails.logger.debug 'get_file_content(system[\'assets.code.wrapper\'])' - wrapper_code = get_file_content(system['assets.code.wrapper']) - Rails.logger.debug 'get_file_content(system[\'assets.test\'])' - tests = get_file_content(system['assets.test']) + content = get_file_content(system['assets.code.wrapper']) + prompt['wrapper_code'] = content if content + Rails.logger.debug 'get_test_file_content(prompt, system[\'assets.test\'])' + get_test_file_content(prompt, system['assets.test']) end new_hash['current_version'] = {} new_hash['current_version.version'] = hash['version.id'] if hash['version.id'] new_hash['current_version.creator'] = get_author_email(hash) new_hash['current_version.prompts'] = [] - prompt = { - 'position' => 1, - 'question' => hash['instructions'], - 'class_name' => 'Answer', - 'method_name' => 'answer' - } #----------------------------------------------------------------------- # PEML assets might be at the global level, if they apply to all # systems, so fill in missing assets here Rails.logger.debug 'assets:' Rails.logger.debug hash['assets'].to_yaml - Rails.logger.debug 'get_file_content(hash[\'assets.code.starter\'])' - starter_code ||= get_file_content(hash['assets.code.starter']) - prompt['starter_code'] = starter_code if starter_code - Rails.logger.debug 'get_file_content(hash[\'assets.code.wrapper\'])' - wrapper_code ||= get_file_content(hash['assets.code.wrapper']) - prompt['wrapper_code'] = wrapper_code if wrapper_code - Rails.logger.debug 'get_file_content(hash[\'assets.test\'])' - tests ||= get_file_content(hash['assets.test']) + if !prompt['starter_code'] + Rails.logger.debug 'get_file_content(hash[\'assets.code.starter\'])' + prompt['starter_code'] = get_file_content(hash['assets.code.starter']) + end + if !prompt['wrapper_code'] + Rails.logger.debug 'get_file_content(hash[\'assets.code.wrapper\'])' + prompt['wrapper_code'] = get_file_content(hash['assets.code.wrapper']) + end + Rails.logger.debug 'get_test_file_content(prompt, hash[\'assets.test\'])' + get_test_file_content(prompt, hash['assets.test']) # FIXME: give error if missing tests - prompt['tests'] = tests if tests #----------------------------------------------------------------------- + if !prompt['class_name'] + prompt['class_name'] = 'Answer' + end + if !prompt['method_name'] + prompt['method_name'] = 'answer' + end # Again, PEML is designed for coding problems and thus, 'coding_prompt' new_hash['current_version.prompts'] << { 'coding_prompt' => prompt } new_hash end + + #----------------------------------------------------------------------- + # Tries to find the email of the author from the given hash. + # + # First, it tries to find it in the 'author.email' key, then in the + # 'license.owner.email' key. If neither works and the 'authors' key + # exists, it takes the email from the first author. + # + # @param hash [Hash] the hash to search for the author's email + # @return [String, nil] the author's email if found, otherwise nil def get_author_email(hash) creator = hash['author.email'] || hash['license.owner.email'] if !creator and hash.key?('authors') @@ -85,22 +103,96 @@ def get_author_email(hash) creator end - def get_file_content(files) - content = nil - file = nil + + #----------------------------------------------------------------------- + def get_test_file_content(prompt, files) Rails.logger.debug '==========' - Rails.logger.debug 'get_file_content(files), files:' + Rails.logger.debug 'get_test_file_content(prompt, files), prompt:' + Rails.logger.debug '==========' + Rails.logger.debug prompt.to_yaml + Rails.logger.debug '==========' + Rails.logger.debug 'get_test_file_content(prompt, files), files:' Rails.logger.debug '==========' Rails.logger.debug files.to_yaml Rails.logger.debug files.inspect - if files + if files and !prompt['tests'] file = files['files'][0] Rails.logger.debug '==========' - Rails.logger.debug 'get_file_content(files), file:' + Rails.logger.debug 'get_test_file_content(prompt, files), file:' Rails.logger.debug '==========' Rails.logger.debug file.to_yaml Rails.logger.debug file.inspect + file.dottie! + + # copy class and method names from file pattern properties, if present + class_name = file['pattern.class_name'] + prompt['class_name'] = class_name if class_name + method_name = file['pattern.method_name'] + prompt['method_name'] = method_name if method_name + + pattern_actual = file['pattern.actual'] || file['pattern_actual'] + + if !prompt['method_name'] && pattern_actual + Rails.logger.debug "pattern_actual = '#{pattern_actual}'" + # pattern.actual: subject.oneFinder({{nums}}) + method_name = pattern_actual.sub(/^.*subject\.(\w+)\(.*$/, '\1') + Rails.logger.debug "extracted method name = '#{method_name}'" + prompt['method_name'] = method_name if method_name + end + + # Extract file content + content = get_file_content(file) + + if content + # format: text/csv-unquoted + # Need to handle this + + # format: text/csv + # Need to handle this + # Drop first line of colum headers + content = content.lines[1..-1].join if content + + # Need to re-assemble straight CSV from either format + prompt['tests'] = content + end + end + Rails.logger.debug '==========' + Rails.logger.debug 'get_test_file_content(prompt, files) => prompt:' + Rails.logger.debug '==========' + Rails.logger.debug prompt.to_yaml + end + + #----------------------------------------------------------------------- + # Retrieves the content from the first file description in a PEML files + # array. + # + # - If the file content is a string and matches a URL pattern, it fetches + # the content from the URL. + # - If the file is a hash, it retrieves the 'content' key's value. + # + # Logs detailed information about the files and content retrieval process + # for debugging. + # + # @param files [Hash] A hash containing file information, expected to have + # a 'files' key. + # @return [String, nil] The content of the file, or nil if content cannot + # be retrieved. + def get_file_content(files) + content = nil + Rails.logger.debug '==========' + Rails.logger.debug 'get_file_content(files), files:' + Rails.logger.debug '==========' + Rails.logger.debug files.to_yaml + Rails.logger.debug files.inspect + file = files + if file and files['files'] + file = files['files'][0] end + Rails.logger.debug '==========' + Rails.logger.debug 'get_file_content(files), file:' + Rails.logger.debug '==========' + Rails.logger.debug file.to_yaml + Rails.logger.debug file.inspect if file.is_a? String file.strip! if file.sub!(/^url\((.*)\)$/, '\1') From 61bbf0616d89a9a7d86da7d01f0d944700ea2fcf Mon Sep 17 00:00:00 2001 From: Alex Hicks Date: Wed, 8 Oct 2025 14:56:07 -0400 Subject: [PATCH 53/53] fix package sources for deprecation in base of image --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dockerfile b/Dockerfile index 1f8a8716..561d7767 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,11 @@ ARG BASEDIR='/code-workout' ENV TZ=America/New_York RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +RUN sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list && \ + sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list && \ + apt-get -o Acquire::Check-Valid-Until=false update && \ + apt-get install -y --no-install-recommends build-essential + #install 'development tools' build-essential dkms curl libxslt-dev libpq-dev python-dev python-pip python-feedvalidator python-software-properties python-sphinx libmariadbclient-dev libcurl4-gnutls-dev libevent-dev libffi-dev libssl-dev stunnel4 libsqlite3-dev # libmariadbclient-dev RUN apt-get update -qq \