From 2ab37dbc78db23d18f5abd97d1008dbb9bb378ed Mon Sep 17 00:00:00 2001 From: Samuel Maldonado Date: Thu, 20 Jul 2023 13:15:10 -0400 Subject: [PATCH 01/10] Upgrade docker ubuntu to 22.04 and ruby to ruby 3 --- .dockerfiles/Dockerfile | 5 +- .dockerfiles/entrypoint-dev-rails.sh | 2 +- .github/workflows/test_ci.yml | 12 +- Gemfile | 3 +- Gemfile.lock | 231 +++++++++--------- app/jobs/split_pdf_job.rb | 23 +- app/lib/markus_csv.rb | 2 +- app/models/assignment.rb | 3 +- config/dummy_invalidate.sh | 53 ++++ lib/scanner/read_qr_code.py | 15 ++ markus.control | 4 +- markus_1.0_all.deb | Bin 2836 -> 2732 bytes requirements-qr.txt | 1 + requirements-scanner.txt | 8 +- .../assignments_controller_spec.rb | 4 +- spec/models/user_spec.rb | 21 +- 16 files changed, 228 insertions(+), 159 deletions(-) create mode 100755 config/dummy_invalidate.sh create mode 100644 lib/scanner/read_qr_code.py create mode 100644 requirements-qr.txt diff --git a/.dockerfiles/Dockerfile b/.dockerfiles/Dockerfile index 122d558c04..390b16cc39 100644 --- a/.dockerfiles/Dockerfile +++ b/.dockerfiles/Dockerfile @@ -1,7 +1,7 @@ -FROM ubuntu:focal AS base +FROM ubuntu:jammy AS base ARG NODE_MAJOR=18 -ARG BUNDLER_VERSION='2.3.17' +ARG BUNDLER_VERSION='2.4.13' ARG USER=markus # Required in order to ensure bind-mounts are owned by the correct user inside the container @@ -69,6 +69,7 @@ ENV PATH="$GEM_HOME/bin:$GEM_HOME/gems/bin:$PATH" RUN apt-get update -qq && \ DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends openssh-server \ python3 \ + python3-dev \ python3-venv \ equivs diff --git a/.dockerfiles/entrypoint-dev-rails.sh b/.dockerfiles/entrypoint-dev-rails.sh index 7db53e3e36..85425ffc2f 100755 --- a/.dockerfiles/entrypoint-dev-rails.sh +++ b/.dockerfiles/entrypoint-dev-rails.sh @@ -9,7 +9,7 @@ npm list &> /dev/null || npm ci # install python packages [ -f ./venv/bin/python3 ] || python3 -m venv ./venv ./venv/bin/python3 -m pip install --upgrade pip > /dev/null -./venv/bin/python3 -m pip install -r requirements-jupyter.txt -r requirements-scanner.txt > /dev/null +./venv/bin/python3 -m pip install -r requirements-jupyter.txt -r requirements-scanner.txt -r requirements-qr.txt > /dev/null # setup the database (checks for db existence first) until pg_isready -q; do diff --git a/.github/workflows/test_ci.yml b/.github/workflows/test_ci.yml index db2edd3232..111e900aa5 100644 --- a/.github/workflows/test_ci.yml +++ b/.github/workflows/test_ci.yml @@ -9,10 +9,10 @@ on: jobs: test: if: github.event.pull_request.draft == false - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 services: postgres: - image: postgres:12 + image: postgres:14 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres @@ -49,7 +49,7 @@ jobs: - name: Set up ruby and cache gems uses: ruby/setup-ruby@v1 with: - ruby-version: ruby-2.7 + ruby-version: ruby-3.0 bundler-cache: true - name: Set up node and cache packages uses: actions/setup-node@v3 @@ -66,13 +66,13 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('requirements-jupyter.txt') }}-${{ hashFiles('requirements-scanner.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements-jupyter.txt') }}-${{ hashFiles('requirements-scanner.txt') }}-${{ hashFiles('requirements-qr.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Install python packages run: | python3.9 -m venv venv - ./venv/bin/pip install -r requirements-jupyter.txt -r requirements-scanner.txt + ./venv/bin/pip install -r requirements-jupyter.txt -r requirements-scanner.txt -r requirements-qr.txt - name: Configure server run: | sudo rm -f /etc/localtime @@ -113,7 +113,7 @@ jobs: finish: needs: test if: github.event.pull_request.draft == false - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Coveralls Finished uses: coverallsapp/github-action@v2 diff --git a/Gemfile b/Gemfile index 03be7180ae..414457cbde 100644 --- a/Gemfile +++ b/Gemfile @@ -44,9 +44,8 @@ gem 'rails-i18n', '~> 7.0.0' gem 'combine_pdf' gem 'prawn' gem 'prawn-qrcode' -gem 'rmagick' +gem 'rmagick', '~> 5.2.0' gem 'rtesseract' -gem 'zxing_cpp', require: 'zxing' # Ruby miscellany gem 'json' diff --git a/Gemfile.lock b/Gemfile.lock index c04aeffe78..4414135ec2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,80 +3,80 @@ GEM specs: action_policy (0.6.5) ruby-next-core (>= 0.14.0) - actioncable (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) + actioncable (7.0.5) + actionpack (= 7.0.5) + activesupport (= 7.0.5) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + actionmailbox (7.0.5) + actionpack (= 7.0.5) + activejob (= 7.0.5) + activerecord (= 7.0.5) + activestorage (= 7.0.5) + activesupport (= 7.0.5) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4.3) - actionpack (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activesupport (= 7.0.4.3) + actionmailer (7.0.5) + actionpack (= 7.0.5) + actionview (= 7.0.5) + activejob (= 7.0.5) + activesupport (= 7.0.5) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4.3) - actionview (= 7.0.4.3) - activesupport (= 7.0.4.3) - rack (~> 2.0, >= 2.2.0) + actionpack (7.0.5) + actionview (= 7.0.5) + activesupport (= 7.0.5) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4.3) - actionpack (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + actiontext (7.0.5) + actionpack (= 7.0.5) + activerecord (= 7.0.5) + activestorage (= 7.0.5) + activesupport (= 7.0.5) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4.3) - activesupport (= 7.0.4.3) + actionview (7.0.5) + activesupport (= 7.0.5) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.4.3) - activesupport (= 7.0.4.3) + activejob (7.0.5) + activesupport (= 7.0.5) globalid (>= 0.3.6) activejob-status (1.0.0) activejob (>= 6.0) activesupport (>= 6.0) - activemodel (7.0.4.3) - activesupport (= 7.0.4.3) + activemodel (7.0.5) + activesupport (= 7.0.5) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (7.0.4.3) - activemodel (= 7.0.4.3) - activesupport (= 7.0.4.3) + activerecord (7.0.5) + activemodel (= 7.0.5) + activesupport (= 7.0.5) activerecord-session_store (2.0.0) actionpack (>= 5.2.4.1) activerecord (>= 5.2.4.1) multi_json (~> 1.11, >= 1.11.2) rack (>= 2.0.8, < 3) railties (>= 5.2.4.1) - activestorage (7.0.4.3) - actionpack (= 7.0.4.3) - activejob (= 7.0.4.3) - activerecord (= 7.0.4.3) - activesupport (= 7.0.4.3) + activestorage (7.0.5) + actionpack (= 7.0.5) + activejob (= 7.0.5) + activerecord (= 7.0.5) + activesupport (= 7.0.5) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.4.3) + activesupport (7.0.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -84,13 +84,13 @@ GEM addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - autoprefixer-rails (10.4.7.0) + autoprefixer-rails (10.4.13.0) execjs (~> 2) awesome_print (1.9.2) - better_errors (2.9.1) - coderay (>= 1.0.0) + better_errors (2.10.0) erubi (>= 1.0.0) rack (>= 0.9.0) + rouge (>= 1.0.0) better_html (2.0.1) actionview (>= 6.0) activesupport (>= 6.0) @@ -102,13 +102,13 @@ GEM debug_inspector (>= 0.0.1) bootsnap (1.16.0) msgpack (~> 1.2) - brakeman (5.4.1) + brakeman (6.0.0) builder (3.2.4) bullet (7.0.7) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) - capybara (3.39.0) + capybara (3.39.1) addressable matrix mini_mime (>= 0.1.3) @@ -117,23 +117,22 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - chunky_png (1.3.12) - coderay (1.1.3) + chunky_png (1.4.0) combine_pdf (1.0.23) matrix ruby-rc4 (>= 0.1.5) concurrent-ruby (1.2.2) - config (4.1.0) + config (4.2.0) deep_merge (~> 1.2, >= 1.2.1) dry-validation (~> 1.0, >= 1.0.0) - connection_pool (2.4.0) + connection_pool (2.4.1) cookies_eu (1.7.8) js_cookie_rails (~> 2.2.0) crack (0.4.5) rexml crass (1.0.6) date (3.3.3) - debug_inspector (1.0.0) + debug_inspector (1.1.0) deep_merge (1.2.2) descriptive_statistics (2.5.1) diff-lcs (1.5.0) @@ -150,19 +149,19 @@ GEM concurrent-ruby (~> 1.0) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) - dry-schema (1.13.0) + dry-schema (1.13.2) concurrent-ruby (~> 1.0) dry-configurable (~> 1.0, >= 1.0.1) dry-core (~> 1.0, < 2) dry-initializer (~> 3.0) - dry-logic (>= 1.5, < 2) + dry-logic (>= 1.4, < 2) dry-types (>= 1.7, < 2) zeitwerk (~> 2.6) - dry-types (1.7.0) + dry-types (1.7.1) concurrent-ruby (~> 1.0) - dry-core (~> 1.0, < 2) - dry-inflector (~> 1.0, < 2) - dry-logic (>= 1.4, < 2) + dry-core (~> 1.0) + dry-inflector (~> 1.0) + dry-logic (~> 1.4) zeitwerk (~> 2.6) dry-validation (1.10.0) concurrent-ruby (~> 1.0) @@ -177,7 +176,7 @@ GEM actionmailer (>= 5.2, < 8) activesupport (>= 5.2, < 8) execjs (2.8.1) - factory_bot (6.2.0) + factory_bot (6.2.1) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) @@ -195,9 +194,9 @@ GEM globalid (1.1.0) activesupport (>= 5.0) hashdiff (1.0.1) - highline (2.0.3) + highline (2.1.0) histogram (0.2.4.1) - i18n (1.12.0) + i18n (1.13.0) concurrent-ruby (~> 1.0) i18n-js (4.2.3) glob (>= 0.4.0) @@ -213,7 +212,7 @@ GEM rails-i18n rainbow (>= 2.2.2, < 4.0) terminal-table (>= 1.5.1) - js-routes (2.2.4) + js-routes (2.2.5) railties (>= 4) js_cookie_rails (2.2.0) railties (>= 3.1) @@ -225,9 +224,9 @@ GEM listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.20.0) + loofah (2.21.3) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) machinist (2.0) mail (2.8.1) mini_mime (>= 0.1.1) @@ -238,10 +237,9 @@ GEM matrix (0.4.2) method_source (1.0.0) mini_mime (1.1.2) - mini_portile2 (2.8.2) minitest (5.18.0) - mono_logger (1.1.1) - msgpack (1.6.0) + mono_logger (1.1.2) + msgpack (1.7.1) multi_json (1.15.0) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) @@ -255,13 +253,13 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.9) - nokogiri (1.14.3) - mini_portile2 (~> 2.8.0) + nokogiri (1.15.2-aarch64-linux) racc (~> 1.4) - parser (3.2.1.1) + parser (3.2.2.1) ast (~> 2.4.1) pdf-core (0.9.0) pg (1.5.3) + pkg-config (1.5.1) pluck_to_hash (1.0.2) activerecord (>= 4.0.2) activesupport (>= 4.0.2) @@ -271,35 +269,35 @@ GEM prawn-qrcode (0.5.2) prawn (>= 1) rqrcode (>= 1.0.0) - psych (5.0.1) + psych (5.1.0) stringio public_suffix (5.0.1) - puma (6.2.2) + puma (6.3.0) nio4r (~> 2.0) raabro (1.4.0) racc (1.6.2) rack (2.2.7) rack-cors (2.0.1) rack (>= 2.0.0) - rack-protection (3.0.5) + rack-protection (3.0.6) rack rack-test (2.1.0) rack (>= 1.3) railroady (1.6.0) - rails (7.0.4.3) - actioncable (= 7.0.4.3) - actionmailbox (= 7.0.4.3) - actionmailer (= 7.0.4.3) - actionpack (= 7.0.4.3) - actiontext (= 7.0.4.3) - actionview (= 7.0.4.3) - activejob (= 7.0.4.3) - activemodel (= 7.0.4.3) - activerecord (= 7.0.4.3) - activestorage (= 7.0.4.3) - activesupport (= 7.0.4.3) + rails (7.0.5) + actioncable (= 7.0.5) + actionmailbox (= 7.0.5) + actionmailer (= 7.0.5) + actionpack (= 7.0.5) + actiontext (= 7.0.5) + actionview (= 7.0.5) + activejob (= 7.0.5) + activemodel (= 7.0.5) + activerecord (= 7.0.5) + activestorage (= 7.0.5) + activesupport (= 7.0.5) bundler (>= 1.15.0) - railties (= 7.0.4.3) + railties (= 7.0.5) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -307,24 +305,25 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.5.0) - loofah (~> 2.19, >= 2.19.1) - rails-i18n (7.0.3) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + rails-i18n (7.0.7) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - rails_performance (1.0.4) + rails_performance (1.0.5.2) rails redis redis-namespace - railties (7.0.4.3) - actionpack (= 7.0.4.3) - activesupport (= 7.0.4.3) + railties (7.0.5) + actionpack (= 7.0.5) + activesupport (= 7.0.5) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) - raindrops (0.20.0) + raindrops (0.20.1) rake (13.0.6) rb-fsevent (0.11.2) rb-inotify (0.10.1) @@ -353,27 +352,29 @@ GEM resque (>= 1.27) rufus-scheduler (~> 3.2, != 3.3) rexml (3.2.5) - rmagick (2.16.0) - rqrcode (1.1.2) + rmagick (5.2.0) + pkg-config (~> 1.4) + rouge (4.1.2) + rqrcode (2.2.0) chunky_png (~> 1.0) - rqrcode_core (~> 0.1) - rqrcode_core (0.1.2) - rspec-core (3.12.0) + rqrcode_core (~> 1.0) + rqrcode_core (1.2.0) + rspec-core (3.12.2) rspec-support (~> 3.12.0) - rspec-expectations (3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.0) + rspec-mocks (3.12.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-rails (6.0.1) + rspec-rails (6.0.3) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) - rspec-core (~> 3.11) - rspec-expectations (~> 3.11) - rspec-mocks (~> 3.11) - rspec-support (~> 3.11) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) rspec-support (3.12.0) rtesseract (3.1.2) ruby-next-core (0.15.3) @@ -383,7 +384,7 @@ GEM rubyzip (2.3.2) rufus-scheduler (3.8.2) fugit (~> 1.1, >= 1.1.6) - rugged (1.5.1) + rugged (1.6.3) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) sassc (2.4.0) @@ -394,7 +395,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.9.0) + selenium-webdriver (4.9.1) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -404,7 +405,7 @@ GEM shoulda-callback-matchers (1.1.4) activesupport (>= 3) shoulda-context (2.0.0) - shoulda-matchers (4.3.0) + shoulda-matchers (4.5.1) activesupport (>= 4.2.0) simplecov (0.22.0) docile (~> 1.1) @@ -413,10 +414,10 @@ GEM simplecov-html (0.12.3) simplecov-lcov (0.8.0) simplecov_json_formatter (0.1.4) - sinatra (3.0.5) + sinatra (3.0.6) mustermann (~> 3.0) rack (~> 2.2, >= 2.2.4) - rack-protection (= 3.0.5) + rack-protection (= 3.0.6) tilt (~> 2.0) smart_properties (1.17.0) sprockets (4.2.0) @@ -426,12 +427,12 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - stringio (3.0.4) + stringio (3.0.6) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - terser (1.1.14) + terser (1.1.15) execjs (>= 0.3.0, < 3) - thor (1.2.1) + thor (1.2.2) tilt (2.1.0) time-warp (1.0.15) timeout (0.3.2) @@ -454,12 +455,9 @@ GEM xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.6.8) - zxing_cpp (0.1.1) - ffi (~> 1.1) - rmagick (~> 2.13) PLATFORMS - ruby + aarch64-linux DEPENDENCIES action_policy @@ -511,7 +509,7 @@ DEPENDENCIES responders resque resque-scheduler - rmagick + rmagick (~> 5.2.0) rspec-rails (~> 6.0.1) rtesseract rubyzip @@ -528,7 +526,6 @@ DEPENDENCIES time-warp unicorn webmock - zxing_cpp BUNDLED WITH - 2.3.17 + 2.4.13 diff --git a/app/jobs/split_pdf_job.rb b/app/jobs/split_pdf_job.rb index b2601ff05b..99365160d3 100644 --- a/app/jobs/split_pdf_job.rb +++ b/app/jobs/split_pdf_job.rb @@ -42,18 +42,24 @@ def perform(exam_template, _path, split_pdf_log, _original_filename = nil, _curr original_pdf = File.binread(File.join(raw_dir, "#{split_page.id}.pdf")) # convert PDF to an image - img = Magick::Image.from_blob(original_pdf) do - self.quality = 100 - self.density = '200' + img = Magick::Image.from_blob(original_pdf) do |options| + options.quality = 100 + options.density = '200' end.first qr_file_location = File.join(raw_dir, "#{split_page.id}.jpg") img.crop(Magick::NorthWestGravity, img.columns, img.rows / 5.0).write(qr_file_location) img.destroy! code_regex = /(?[\w-]+)-(?\d+)-(?\d+)/ - m = code_regex.match(ZXing.decode(qr_file_location)) || code_regex.match(RTesseract.new(qr_file_location).to_s) + python_exe = Rails.application.config.python + read_qr_py_file = Rails.root.join('lib/scanner/read_qr_code.py').to_s + stdout, status = Open3.capture2(python_exe, read_qr_py_file, qr_file_location) + if status.success? + m = code_regex.match(stdout) + else + m = code_regex.match(RTesseract.new(qr_file_location).to_s) + end status = '' - if m.nil? new_page.save File.join(error_dir, "#{split_page.id}.pdf") num_pages_qr_scan_error += 1 @@ -223,13 +229,12 @@ def save_pages(exam_template, partial_exams, filename = nil, split_pdf_log = nil 'application/pdf') end repo.commit(txn) - next unless exam_template.automatic_parsing && Rails.application.config.scanner_enabled begin # convert PDF to an image - imglist = Magick::Image.from_blob(cover_pdf.to_pdf) do - self.quality = 100 - self.density = '300' + imglist = Magick::Image.from_blob(cover_pdf.to_pdf) do |options| + options.quality = 100 + options.density = '300' end rescue StandardError next diff --git a/app/lib/markus_csv.rb b/app/lib/markus_csv.rb index 94778261cd..0bb4e6d01d 100644 --- a/app/lib/markus_csv.rb +++ b/app/lib/markus_csv.rb @@ -31,7 +31,7 @@ def self.parse(input, **options) if options[:encoding] input = input.encode(Encoding::UTF_8, options[:encoding]) end - CSV.parse(input, options) do |row| + CSV.parse(input, **options) do |row| yield row valid_line_count += 1 rescue CsvInvalidLineError => e diff --git a/app/models/assignment.rb b/app/models/assignment.rb index 8c994b34f6..183703dc0b 100644 --- a/app/models/assignment.rb +++ b/app/models/assignment.rb @@ -634,7 +634,7 @@ def summary_test_result_json # Generate a CSV summary of the most recent test results associated with an assignment. def summary_test_result_csv results = {} - headers = SortedSet.new + headers = Set.new summary_test_results = self.summary_test_results.as_json summary_test_results.each do |test_result| @@ -648,6 +648,7 @@ def summary_test_result_csv headers << header end + headers = headers.sort CSV.generate do |csv| csv << [nil, *headers] diff --git a/config/dummy_invalidate.sh b/config/dummy_invalidate.sh new file mode 100755 index 0000000000..425142a8a0 --- /dev/null +++ b/config/dummy_invalidate.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +######################################################################## +# Basic structure as to how a password validation script might look like +# The preferred way is to write a small C program for this though. +######################################################################## + +# Check that no username/passwords are passed on the command line +if [ "$#" -ne 0 ]; then + # HACK-ALARM?! + echo "usage: $0" 1>&2 + exit 1 +fi + +# Username is passed on the first line from stdin, the users +# password as the second line. ip address might optionally be passed +# as a third line +# WARNING: username and/or password may contain any characters except \n +# and \0. I.e. don't trust that data in any case. Thus, make +# sure your script/program accounts for that! +read user +read password +read ip + +######################################################################## +# Do your password validation here +######################################################################## + +if [ $user == 'exit1' ]; then + exit 1 +fi + +if [ $user == 'exit2' ]; then + exit 2 +fi + +if [ $user == 'exit3' ]; then + echo "custom message with error 3" + exit 3 +fi + +if [ $user == 'exit3nomsg' ]; then + exit 3 +fi + +if [ $user == 'exit4' ]; then + echo "custom message with error 4" + exit 4 +fi + +# Exit with 0 return code, if and only if user/password combination +# is valid +exit 0 diff --git a/lib/scanner/read_qr_code.py b/lib/scanner/read_qr_code.py new file mode 100644 index 0000000000..00590b1862 --- /dev/null +++ b/lib/scanner/read_qr_code.py @@ -0,0 +1,15 @@ +import sys +import cv2 +import zxingcpp + + +if __name__ == '__main__': + input_filename = sys.argv[1] + img = cv2.imread(input_filename) + results = zxingcpp.read_barcodes(img) + if len(results) == 0: + print("Could not find any barcode.") + sys.exit(1) + else: + result = results[0] + print(result.text) diff --git a/markus.control b/markus.control index 7091eaf4c2..701b486a1e 100644 --- a/markus.control +++ b/markus.control @@ -29,9 +29,9 @@ Depends: # nodejs: for serving/managing javascript nodejs (>= 18), nodejs (<< 19), # ruby: required to run Rails - ruby (>= 1:2.7) | ruby2.7, ruby (<< 1:3) | ruby2.7, + ruby (>= 1:2.7) | ruby3.0, ruby (<< 1:3) | ruby3.0, # ruby-dev: required to run rails - ruby-dev (>= 1:2.7) | ruby2.7-dev, ruby-dev (<< 1:3) | ruby2.7-dev, + ruby-dev (>= 1:2.7) | ruby3.0-dev, ruby-dev (<< 1:3) | ruby3.0-dev, # rubygems-integration: required to install ruby gems rubygems-integration, # tesseract-ocr: required for scanned exams diff --git a/markus_1.0_all.deb b/markus_1.0_all.deb index 9777a53dfc7d00d2cb613a2d864a16ab3d80aae5..bc0f1e72a40b198164f687f359d373b0997930c1 100644 GIT binary patch delta 2653 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 a@%UE850E7QL-Fr?007Wqs)T>$&%XdqRw>s2 diff --git a/requirements-qr.txt b/requirements-qr.txt new file mode 100644 index 0000000000..0cf57c7ace --- /dev/null +++ b/requirements-qr.txt @@ -0,0 +1 @@ +zxing-cpp==2.0.0 diff --git a/requirements-scanner.txt b/requirements-scanner.txt index 5c27885fc3..87c301d9fd 100644 --- a/requirements-scanner.txt +++ b/requirements-scanner.txt @@ -1,7 +1,7 @@ # TODO: replace requirements files with Pipfile file (when it is stable and supported by pip) -opencv-python==4.5.2.54 -torch==1.9.0 -torchvision==0.10.0 +opencv-python==4.7.0.72 +torch==1.10.2 +torchvision==0.11.3 Pillow==9.3.0 numpy==1.22.0 -scipy==1.7.0 +scipy==1.10.1 diff --git a/spec/controllers/assignments_controller_spec.rb b/spec/controllers/assignments_controller_spec.rb index 85046b9ee2..744a28ba75 100644 --- a/spec/controllers/assignments_controller_spec.rb +++ b/spec/controllers/assignments_controller_spec.rb @@ -177,7 +177,7 @@ assignment_results = assignment.summary_test_results - headers = SortedSet.new(test_results.headers) + headers = Set.new(test_results.headers.drop(1)).sort assignment_results.each do |result| expect(headers.include?("#{result['name']}:#{result['test_result_name']}")).to eq true end @@ -188,7 +188,7 @@ test_results = CSV.parse(response.body, headers: true) headers = test_results.headers.drop(1) - sorted_headers = SortedSet.new(headers) + sorted_headers = Set.new(headers).sort sorted_headers.each_with_index do |header, i| expect(header).to eq headers[i] end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index e5ee4da1cd..51f9037dac 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -76,45 +76,42 @@ end end context 'without a custom exit status messages' do + before do + allow(Settings).to receive(:validate_file).and_return(Rails.root.join('config/dummy_invalidate.sh')) + end context 'a successful login' do it 'should return a success message' do - allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(0) expect(User.authenticate('ab', '123')).to eq User::AUTHENTICATE_SUCCESS end end context 'an unsuccessful login' do it 'should return a failure message' do - allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(1) - expect(User.authenticate('ab', '123')).to eq User::AUTHENTICATE_ERROR + expect(User.authenticate('exit3', '123')).to eq User::AUTHENTICATE_ERROR end end end context 'with a custom exit status message' do before do allow(Settings).to receive(:validate_custom_status_message).and_return('2' => 'a two!', '3' => 'a three!') + allow(Settings).to receive(:validate_file).and_return(Rails.root.join('config/dummy_invalidate.sh')) end context 'a successful login' do it 'should return a success message' do - allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(0) expect(User.authenticate('ab', '123')).to eq User::AUTHENTICATE_SUCCESS end end context 'an unsuccessful login' do it 'should return a failure message with a 1' do - allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(1) - expect(User.authenticate('ab', '123')).to eq User::AUTHENTICATE_ERROR + expect(User.authenticate('exit1', '123')).to eq User::AUTHENTICATE_ERROR end it 'should return a failure message with a 4' do - allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(4) - expect(User.authenticate('ab', '123')).to eq User::AUTHENTICATE_ERROR + expect(User.authenticate('exit4', '123')).to eq User::AUTHENTICATE_ERROR end it 'should return a custom message with a 2' do - allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(2) - expect(User.authenticate('ab', '123')).to eq '2' + expect(User.authenticate('exit2', '123')).to eq '2' end it 'should return a custom message with a 3' do - allow_any_instance_of(Process::Status).to receive(:exitstatus).and_return(3) - expect(User.authenticate('ab', '123')).to eq '3' + expect(User.authenticate('exit3nomsg', '123')).to eq '3' end end end From 0194d820fa35ef325c9951b054dfb215e31a0e58 Mon Sep 17 00:00:00 2001 From: Samuel Maldonado Date: Thu, 20 Jul 2023 14:26:32 -0400 Subject: [PATCH 02/10] add x86_64 support to lockfile --- Gemfile.lock | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index 18d5c9affb..bc2185aef6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -254,6 +254,8 @@ GEM nio4r (2.5.9) nokogiri (1.15.2-aarch64-linux) racc (~> 1.4) + nokogiri (1.15.2-x86_64-linux) + racc (~> 1.4) parser (3.2.2.1) ast (~> 2.4.1) pdf-core (0.9.0) @@ -454,6 +456,7 @@ GEM PLATFORMS aarch64-linux + x86_64-linux DEPENDENCIES action_policy From 1f0229c4961372c557026912be6cc43e073221e2 Mon Sep 17 00:00:00 2001 From: Samuel Maldonado Date: Fri, 21 Jul 2023 15:11:53 -0400 Subject: [PATCH 03/10] update migrations for ruby 3 --- ...8_fix_annotation_label_null_category_ok.rb | 4 +- ...tion_categories_assigned_to_assignments.rb | 2 +- .../20091105182703_improve_db_indexes.rb | 2 +- ...05_make_criterion_weight_not_null_again.rb | 2 +- ...fix_precision_of_flexible_criterion_max.rb | 4 +- db/migrate/20121028211448_testing.rb | 38 +++++++++---------- ...230713153536_increase_group_name_length.rb | 2 +- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/db/migrate/20090219150618_fix_annotation_label_null_category_ok.rb b/db/migrate/20090219150618_fix_annotation_label_null_category_ok.rb index 92794c0222..9fff8bc1c7 100644 --- a/db/migrate/20090219150618_fix_annotation_label_null_category_ok.rb +++ b/db/migrate/20090219150618_fix_annotation_label_null_category_ok.rb @@ -1,9 +1,9 @@ class FixAnnotationLabelNullCategoryOk < ActiveRecord::Migration[4.2] def self.up - change_column :annotation_labels, :annotation_category_id, :integer, {:null => true} + change_column :annotation_labels, :annotation_category_id, :integer, null: true end def self.down - change_column :annotation_labels, :annotation_category_id, :integer, {:null => false} + change_column :annotation_labels, :annotation_category_id, :integer, null: true end end diff --git a/db/migrate/20090219151533_annotation_categories_assigned_to_assignments.rb b/db/migrate/20090219151533_annotation_categories_assigned_to_assignments.rb index f17cd736d3..cb9871d55a 100644 --- a/db/migrate/20090219151533_annotation_categories_assigned_to_assignments.rb +++ b/db/migrate/20090219151533_annotation_categories_assigned_to_assignments.rb @@ -1,6 +1,6 @@ class AnnotationCategoriesAssignedToAssignments < ActiveRecord::Migration[4.2] def self.up - add_column :annotation_categories, :assignment_id, :integer, {:null => false} + add_column :annotation_categories, :assignment_id, :integer, null: false end def self.down diff --git a/db/migrate/20091105182703_improve_db_indexes.rb b/db/migrate/20091105182703_improve_db_indexes.rb index 8704f4e93b..540d9ba985 100644 --- a/db/migrate/20091105182703_improve_db_indexes.rb +++ b/db/migrate/20091105182703_improve_db_indexes.rb @@ -10,7 +10,7 @@ def self.up add_index :results, :submission_id, :unique => true, :name => "results_u1" - change_column :groups, :group_name, :string, {:limit => 30} + change_column :groups, :group_name, :string, limit: 30 add_index :groups, :group_name, :name => "groups_n1" end diff --git a/db/migrate/20091116141905_make_criterion_weight_not_null_again.rb b/db/migrate/20091116141905_make_criterion_weight_not_null_again.rb index b0312ae8a5..957f438dd3 100644 --- a/db/migrate/20091116141905_make_criterion_weight_not_null_again.rb +++ b/db/migrate/20091116141905_make_criterion_weight_not_null_again.rb @@ -1,6 +1,6 @@ class MakeCriterionWeightNotNullAgain < ActiveRecord::Migration[4.2] def self.up - change_column :rubric_criteria, :weight, :float, {:null => false} + change_column :rubric_criteria, :weight, :float, null: false end def self.down diff --git a/db/migrate/20091116195456_fix_precision_of_flexible_criterion_max.rb b/db/migrate/20091116195456_fix_precision_of_flexible_criterion_max.rb index 00932e0bb4..72e367ba6b 100644 --- a/db/migrate/20091116195456_fix_precision_of_flexible_criterion_max.rb +++ b/db/migrate/20091116195456_fix_precision_of_flexible_criterion_max.rb @@ -1,9 +1,9 @@ class FixPrecisionOfFlexibleCriterionMax < ActiveRecord::Migration[4.2] def self.up - change_column :flexible_criteria, :max, :decimal, {:precision => 10, :scale => 1, :null => false} + change_column :flexible_criteria, :max, :decimal, precision: 10, scale: 1, null: false end def self.down - change_column :flexible_criteria, :max, :decimal, {:precision => 10, :scale => 0, :null => false} + change_column :flexible_criteria, :max, :decimal, precision: 10, scale: 1, null: false end end diff --git a/db/migrate/20121028211448_testing.rb b/db/migrate/20121028211448_testing.rb index 0e93109443..5546465bbd 100644 --- a/db/migrate/20121028211448_testing.rb +++ b/db/migrate/20121028211448_testing.rb @@ -13,9 +13,9 @@ def self.up end create_table :test_support_files do |t| - t.string :file_name, { :null => false } - t.references :assignment, { :null => false } - t.text :description, { :null => false } + t.string :file_name, **{ :null => false } + t.references :assignment, **{ :null => false } + t.text :description, **{ :null => false } end add_index :test_support_files, @@ -23,20 +23,20 @@ def self.up :name => "index_test_files_on_assignment_id" create_table :test_scripts do |t| - t.integer "assignment_id", { :null => false } - t.float "seq_num", { :null => false } - t.string "script_name", { :null => false } - t.text "description", { :null => false } - t.integer "max_marks", { :null => false } + t.integer "assignment_id", **{ :null => false } + t.float "seq_num", **{ :null => false } + t.string "script_name", **{ :null => false } + t.text "description", **{ :null => false } + t.integer "max_marks", **{ :null => false } t.boolean "run_on_submission" t.boolean "run_on_request" t.boolean "halts_testing" - t.string "display_description", { :null => false } - t.string "display_run_status", { :null => false } - t.string "display_marks_earned", { :null => false } - t.string "display_input", { :null => false } - t.string "display_expected_output", { :null => false } - t.string "display_actual_output", { :null => false } + t.string "display_description", **{ :null => false } + t.string "display_run_status", **{ :null => false } + t.string "display_marks_earned", **{ :null => false } + t.string "display_input", **{ :null => false } + t.string "display_expected_output", **{ :null => false } + t.string "display_actual_output", **{ :null => false } end add_index :test_scripts, @@ -49,12 +49,12 @@ def self.up t.references :test_script t.references :test_script_result t.string "name" - t.string "completion_status", { :null => false } - t.integer "marks_earned", { :null => false } + t.string "completion_status", **{ :null => false } + t.integer "marks_earned", **{ :null => false } t.integer "repo_revision" - t.text "input_description", { :null => false } - t.text "actual_output", { :null => false } - t.text "expected_output", { :null => false } + t.text "input_description", **{ :null => false } + t.text "actual_output", **{ :null => false } + t.text "expected_output", **{ :null => false } end add_index :test_results, diff --git a/db/migrate/20230713153536_increase_group_name_length.rb b/db/migrate/20230713153536_increase_group_name_length.rb index 90eba04f12..b071f0b966 100644 --- a/db/migrate/20230713153536_increase_group_name_length.rb +++ b/db/migrate/20230713153536_increase_group_name_length.rb @@ -1,5 +1,5 @@ class IncreaseGroupNameLength < ActiveRecord::Migration[7.0] def change - change_column :groups, :group_name, :string, {:limit => nil} + change_column :groups, :group_name, :string, limit: nil end end From 1dbe74c405ae476070b26ff60e475ff5a3ca0411 Mon Sep 17 00:00:00 2001 From: Samuel Maldonado Date: Fri, 21 Jul 2023 17:16:22 -0400 Subject: [PATCH 04/10] update i18n in annotation view --- app/views/annotation_categories/_annotation_text.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/annotation_categories/_annotation_text.html.erb b/app/views/annotation_categories/_annotation_text.html.erb index f57a70120b..4b1aa202e5 100644 --- a/app/views/annotation_categories/_annotation_text.html.erb +++ b/app/views/annotation_categories/_annotation_text.html.erb @@ -66,7 +66,7 @@ <% end %> <% if annotation_text[:annotation_category].nil? %>
- <%= t('activerecord.models.submission', {'count': 1}) + ': ' %> + <%= t('activerecord.models.submission', **{'count': 1}) + ': ' %> <%= link_to annotation_text[:group_name], edit_course_result_url(@current_course, annotation_text[:result_id]) %>
From fd9a1e9c8d691ba4a857f349cd052fc7b06a209c Mon Sep 17 00:00:00 2001 From: Sam Maldonado Date: Fri, 28 Jul 2023 18:03:50 -0400 Subject: [PATCH 05/10] updates based on pr feedback --- Gemfile.lock | 8 +++----- app/jobs/split_pdf_job.rb | 2 ++ app/views/annotation_categories/_annotation_text.html.erb | 2 +- {config => spec/fixtures/files}/dummy_invalidate.sh | 0 spec/models/user_spec.rb | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) rename {config => spec/fixtures/files}/dummy_invalidate.sh (100%) diff --git a/Gemfile.lock b/Gemfile.lock index 1b0c0f8377..d9922df1b7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -236,7 +236,6 @@ GEM matrix (0.4.2) method_source (1.0.0) mini_mime (1.1.2) - mini_portile2 (2.8.4) minitest (5.18.1) mono_logger (1.1.1) msgpack (1.6.0) @@ -253,8 +252,7 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.9) - nokogiri (1.15.3) - mini_portile2 (~> 2.8.2) + nokogiri (1.15.2-aarch64-linux) racc (~> 1.4) nokogiri (1.15.2-x86_64-linux) racc (~> 1.4) @@ -359,7 +357,7 @@ GEM rqrcode (2.2.0) chunky_png (~> 1.0) rqrcode_core (~> 0.1) - rqrcode_core (0.1.2) + rqrcode_core (0.2.0) rspec-core (3.12.2) rspec-support (~> 3.12.0) rspec-expectations (3.12.3) @@ -512,7 +510,7 @@ DEPENDENCIES responders resque resque-scheduler - rmagick + rmagick (~> 5.2.0) rspec-rails (~> 6.0.3) rtesseract rubyzip diff --git a/app/jobs/split_pdf_job.rb b/app/jobs/split_pdf_job.rb index 1b44989683..a28be8f1eb 100644 --- a/app/jobs/split_pdf_job.rb +++ b/app/jobs/split_pdf_job.rb @@ -60,6 +60,7 @@ def perform(exam_template, _path, split_pdf_log, _original_filename = nil, _curr m = code_regex.match(RTesseract.new(qr_file_location).to_s) end status = '' + if m.nil? new_page.save File.join(error_dir, "#{split_page.id}.pdf") num_pages_qr_scan_error += 1 @@ -236,6 +237,7 @@ def save_pages(exam_template, partial_exams, filename = nil, split_pdf_log = nil 'application/pdf') end repo.commit(txn) + next unless exam_template.automatic_parsing && Rails.application.config.scanner_enabled begin # convert PDF to an image diff --git a/app/views/annotation_categories/_annotation_text.html.erb b/app/views/annotation_categories/_annotation_text.html.erb index 4b1aa202e5..7c06b256da 100644 --- a/app/views/annotation_categories/_annotation_text.html.erb +++ b/app/views/annotation_categories/_annotation_text.html.erb @@ -66,7 +66,7 @@ <% end %> <% if annotation_text[:annotation_category].nil? %>
- <%= t('activerecord.models.submission', **{'count': 1}) + ': ' %> + <%= t('activerecord.models.submission', count: 1) + ': ' %> <%= link_to annotation_text[:group_name], edit_course_result_url(@current_course, annotation_text[:result_id]) %>
diff --git a/config/dummy_invalidate.sh b/spec/fixtures/files/dummy_invalidate.sh similarity index 100% rename from config/dummy_invalidate.sh rename to spec/fixtures/files/dummy_invalidate.sh diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 51f9037dac..00ecf7525b 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -77,7 +77,7 @@ end context 'without a custom exit status messages' do before do - allow(Settings).to receive(:validate_file).and_return(Rails.root.join('config/dummy_invalidate.sh')) + allow(Settings).to receive(:validate_file).and_return(Rails.root.join('spec/fixtures/files/dummy_invalidate.sh')) end context 'a successful login' do it 'should return a success message' do @@ -93,7 +93,7 @@ context 'with a custom exit status message' do before do allow(Settings).to receive(:validate_custom_status_message).and_return('2' => 'a two!', '3' => 'a three!') - allow(Settings).to receive(:validate_file).and_return(Rails.root.join('config/dummy_invalidate.sh')) + allow(Settings).to receive(:validate_file).and_return(Rails.root.join('spec/fixtures/files/dummy_invalidate.sh')) end context 'a successful login' do it 'should return a success message' do From fd495b05381064babb54b91cc85d7b8a9497cd31 Mon Sep 17 00:00:00 2001 From: Sam Maldonado Date: Fri, 28 Jul 2023 18:35:58 -0400 Subject: [PATCH 06/10] style fixes --- spec/models/user_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 00ecf7525b..45952395ae 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -77,7 +77,8 @@ end context 'without a custom exit status messages' do before do - allow(Settings).to receive(:validate_file).and_return(Rails.root.join('spec/fixtures/files/dummy_invalidate.sh')) + allow(Settings).to receive(:validate_file).and_return(Rails.root + .join('spec/fixtures/files/dummy_invalidate.sh')) end context 'a successful login' do it 'should return a success message' do @@ -93,7 +94,8 @@ context 'with a custom exit status message' do before do allow(Settings).to receive(:validate_custom_status_message).and_return('2' => 'a two!', '3' => 'a three!') - allow(Settings).to receive(:validate_file).and_return(Rails.root.join('spec/fixtures/files/dummy_invalidate.sh')) + allow(Settings).to receive(:validate_file).and_return(Rails.root + .join('spec/fixtures/files/dummy_invalidate.sh')) end context 'a successful login' do it 'should return a success message' do From ddbcdddc4427f0105129ecc71875ca9322ca9348 Mon Sep 17 00:00:00 2001 From: Sam Maldonado Date: Fri, 28 Jul 2023 18:46:20 -0400 Subject: [PATCH 07/10] Regenerate Gemfile.lock --- Gemfile.lock | 67 +++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d9922df1b7..6f2b8b3402 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -87,11 +87,11 @@ GEM autoprefixer-rails (10.4.13.0) execjs (~> 2) awesome_print (1.9.2) - better_errors (2.10.0) + better_errors (2.10.1) erubi (>= 1.0.0) rack (>= 0.9.0) rouge (>= 1.0.0) - better_html (2.0.1) + better_html (2.0.2) actionview (>= 6.0) activesupport (>= 6.0) ast (~> 2.0) @@ -102,13 +102,14 @@ GEM debug_inspector (>= 0.0.1) bootsnap (1.16.0) msgpack (~> 1.2) - brakeman (6.0.0) + brakeman (6.0.1) + browser (5.3.1) builder (3.2.4) bullet (7.0.7) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) - capybara (3.39.1) + capybara (3.39.2) addressable matrix mini_mime (>= 0.1.3) @@ -136,7 +137,7 @@ GEM descriptive_statistics (2.5.1) diff-lcs (1.5.0) docile (1.4.0) - dry-configurable (1.0.1) + dry-configurable (1.1.0) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) dry-core (1.0.0) @@ -211,14 +212,14 @@ GEM rails-i18n rainbow (>= 2.2.2, < 4.0) terminal-table (>= 1.5.1) - js-routes (2.2.5) + js-routes (2.2.7) railties (>= 4) js_cookie_rails (2.2.0) railties (>= 3.1) - jsbundling-rails (1.1.1) + jsbundling-rails (1.1.2) railties (>= 6.0.0) json (2.6.3) - jwt (2.7.0) + jwt (2.7.1) kgio (2.11.4) listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) @@ -236,13 +237,13 @@ GEM matrix (0.4.2) method_source (1.0.0) mini_mime (1.1.2) - minitest (5.18.1) - mono_logger (1.1.1) - msgpack (1.6.0) + minitest (5.19.0) + mono_logger (1.1.2) + msgpack (1.7.2) multi_json (1.15.0) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) - net-imap (0.3.6) + net-imap (0.3.7) date net-protocol net-pop (0.1.2) @@ -252,15 +253,16 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.9) - nokogiri (1.15.2-aarch64-linux) + nokogiri (1.15.3-aarch64-linux) racc (~> 1.4) - nokogiri (1.15.2-x86_64-linux) + nokogiri (1.15.3-x86_64-linux) racc (~> 1.4) - parser (3.2.2.1) + parser (3.2.2.3) ast (~> 2.4.1) + racc pdf-core (0.9.0) pg (1.5.3) - pkg-config (1.5.1) + pkg-config (1.5.2) pluck_to_hash (1.0.2) activerecord (>= 4.0.2) activesupport (>= 4.0.2) @@ -272,7 +274,7 @@ GEM rqrcode (>= 1.0.0) psych (5.1.0) stringio - public_suffix (5.0.1) + public_suffix (5.0.3) puma (6.3.0) nio4r (~> 2.0) raabro (1.4.0) @@ -313,7 +315,8 @@ GEM rails-i18n (7.0.7) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - rails_performance (1.0.5.2) + rails_performance (1.2.0) + browser rails redis redis-namespace @@ -334,9 +337,9 @@ GEM psych (>= 4.0.0) redcarpet (3.6.0) redis (4.8.1) - redis-namespace (1.10.0) + redis-namespace (1.11.0) redis (>= 4) - regexp_parser (2.8.0) + regexp_parser (2.8.1) responders (3.1.0) actionpack (>= 5.2) railties (>= 5.2) @@ -345,25 +348,25 @@ GEM multi_json (~> 1.0) redis-namespace (~> 1.6) sinatra (>= 0.9.2) - resque-scheduler (4.8.0) + resque-scheduler (4.9.0) mono_logger (~> 1.0) redis (>= 3.3) resque (>= 1.27) rufus-scheduler (~> 3.2, != 3.3) - rexml (3.2.5) + rexml (3.2.6) rmagick (5.2.0) pkg-config (~> 1.4) rouge (4.1.2) rqrcode (2.2.0) chunky_png (~> 1.0) - rqrcode_core (~> 0.1) - rqrcode_core (0.2.0) + rqrcode_core (~> 1.0) + rqrcode_core (1.2.0) rspec-core (3.12.2) rspec-support (~> 3.12.0) rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.5) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-rails (6.0.3) @@ -381,7 +384,7 @@ GEM ruby-rc4 (0.1.5) ruby2_keywords (0.0.5) rubyzip (2.3.2) - rufus-scheduler (3.8.2) + rufus-scheduler (3.9.1) fugit (~> 1.1, >= 1.1.6) rugged (1.6.3) sass-rails (6.0.0) @@ -394,7 +397,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.9.1) + selenium-webdriver (4.10.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -426,13 +429,13 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - stringio (3.0.6) + stringio (3.0.7) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - terser (1.1.16) + terser (1.1.17) execjs (>= 0.3.0, < 3) thor (1.2.2) - tilt (2.1.0) + tilt (2.2.0) time-warp (1.0.15) timeout (0.4.0) ttfunk (1.7.0) @@ -448,12 +451,12 @@ GEM crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) websocket (1.2.9) - websocket-driver (0.7.5) + websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.8) + zeitwerk (2.6.9) PLATFORMS aarch64-linux From 19ab10475ad92e79bb3f34ae4cf63e3ed9fe514c Mon Sep 17 00:00:00 2001 From: Sam Maldonado Date: Mon, 31 Jul 2023 16:49:56 -0400 Subject: [PATCH 08/10] remove hash from migration --- db/migrate/20121028211448_testing.rb | 38 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/db/migrate/20121028211448_testing.rb b/db/migrate/20121028211448_testing.rb index 5546465bbd..8e456733a9 100644 --- a/db/migrate/20121028211448_testing.rb +++ b/db/migrate/20121028211448_testing.rb @@ -13,9 +13,9 @@ def self.up end create_table :test_support_files do |t| - t.string :file_name, **{ :null => false } - t.references :assignment, **{ :null => false } - t.text :description, **{ :null => false } + t.string :file_name, null: false + t.references :assignment, null: false + t.text :description, null: false end add_index :test_support_files, @@ -23,20 +23,20 @@ def self.up :name => "index_test_files_on_assignment_id" create_table :test_scripts do |t| - t.integer "assignment_id", **{ :null => false } - t.float "seq_num", **{ :null => false } - t.string "script_name", **{ :null => false } - t.text "description", **{ :null => false } - t.integer "max_marks", **{ :null => false } + t.integer "assignment_id", null: false + t.float "seq_num", null: false + t.string "script_name", null: false + t.text "description", null: false + t.integer "max_marks", null: false t.boolean "run_on_submission" t.boolean "run_on_request" t.boolean "halts_testing" - t.string "display_description", **{ :null => false } - t.string "display_run_status", **{ :null => false } - t.string "display_marks_earned", **{ :null => false } - t.string "display_input", **{ :null => false } - t.string "display_expected_output", **{ :null => false } - t.string "display_actual_output", **{ :null => false } + t.string "display_description", null: false + t.string "display_run_status", null: false + t.string "display_marks_earned", null: false + t.string "display_input", null: false + t.string "display_expected_output", null: false + t.string "display_actual_output", null: false end add_index :test_scripts, @@ -49,12 +49,12 @@ def self.up t.references :test_script t.references :test_script_result t.string "name" - t.string "completion_status", **{ :null => false } - t.integer "marks_earned", **{ :null => false } + t.string "completion_status", null: false + t.integer "marks_earned", null: false t.integer "repo_revision" - t.text "input_description", **{ :null => false } - t.text "actual_output", **{ :null => false } - t.text "expected_output", **{ :null => false } + t.text "input_description", null: false + t.text "actual_output", null: false + t.text "expected_output", null: false end add_index :test_results, From 2b353a33946d7588f9c302b2bd09b628e7060b2c Mon Sep 17 00:00:00 2001 From: David Liu Date: Tue, 1 Aug 2023 15:01:56 -0400 Subject: [PATCH 09/10] Update Gemfile.lock --- Gemfile.lock | 95 +++++++++++++++++++++++++--------------------------- 1 file changed, 45 insertions(+), 50 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6f2b8b3402..c3cfd42e6b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,14 +84,14 @@ GEM addressable (2.8.4) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - autoprefixer-rails (10.4.13.0) + autoprefixer-rails (10.4.7.0) execjs (~> 2) awesome_print (1.9.2) - better_errors (2.10.1) + better_errors (2.10.0) erubi (>= 1.0.0) rack (>= 0.9.0) rouge (>= 1.0.0) - better_html (2.0.2) + better_html (2.0.1) actionview (>= 6.0) activesupport (>= 6.0) ast (~> 2.0) @@ -102,14 +102,13 @@ GEM debug_inspector (>= 0.0.1) bootsnap (1.16.0) msgpack (~> 1.2) - brakeman (6.0.1) - browser (5.3.1) + brakeman (5.4.1) builder (3.2.4) bullet (7.0.7) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) - capybara (3.39.2) + capybara (3.39.0) addressable matrix mini_mime (>= 0.1.3) @@ -132,12 +131,12 @@ GEM rexml crass (1.0.6) date (3.3.3) - debug_inspector (1.1.0) + debug_inspector (1.0.0) deep_merge (1.2.2) descriptive_statistics (2.5.1) diff-lcs (1.5.0) docile (1.4.0) - dry-configurable (1.1.0) + dry-configurable (1.0.1) dry-core (~> 1.0, < 2) zeitwerk (~> 2.6) dry-core (1.0.0) @@ -176,7 +175,7 @@ GEM actionmailer (>= 5.2, < 8) activesupport (>= 5.2, < 8) execjs (2.8.1) - factory_bot (6.2.1) + factory_bot (6.2.0) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) @@ -194,7 +193,7 @@ GEM globalid (1.1.0) activesupport (>= 5.0) hashdiff (1.0.1) - highline (2.1.0) + highline (2.0.3) histogram (0.2.4.1) i18n (1.14.1) concurrent-ruby (~> 1.0) @@ -212,14 +211,14 @@ GEM rails-i18n rainbow (>= 2.2.2, < 4.0) terminal-table (>= 1.5.1) - js-routes (2.2.7) + js-routes (2.2.5) railties (>= 4) js_cookie_rails (2.2.0) railties (>= 3.1) - jsbundling-rails (1.1.2) + jsbundling-rails (1.1.1) railties (>= 6.0.0) json (2.6.3) - jwt (2.7.1) + jwt (2.7.0) kgio (2.11.4) listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) @@ -237,13 +236,14 @@ GEM matrix (0.4.2) method_source (1.0.0) mini_mime (1.1.2) - minitest (5.19.0) - mono_logger (1.1.2) - msgpack (1.7.2) + mini_portile2 (2.8.4) + minitest (5.18.1) + mono_logger (1.1.1) + msgpack (1.6.0) multi_json (1.15.0) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) - net-imap (0.3.7) + net-imap (0.3.6) date net-protocol net-pop (0.1.2) @@ -253,13 +253,11 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.9) - nokogiri (1.15.3-aarch64-linux) + nokogiri (1.15.3) + mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.15.3-x86_64-linux) - racc (~> 1.4) - parser (3.2.2.3) + parser (3.2.1.1) ast (~> 2.4.1) - racc pdf-core (0.9.0) pg (1.5.3) pkg-config (1.5.2) @@ -272,9 +270,9 @@ GEM prawn-qrcode (0.5.2) prawn (>= 1) rqrcode (>= 1.0.0) - psych (5.1.0) + psych (5.0.1) stringio - public_suffix (5.0.3) + public_suffix (5.0.1) puma (6.3.0) nio4r (~> 2.0) raabro (1.4.0) @@ -282,7 +280,7 @@ GEM rack (2.2.7) rack-cors (2.0.1) rack (>= 2.0.0) - rack-protection (3.0.6) + rack-protection (3.0.5) rack rack-test (2.1.0) rack (>= 1.3) @@ -309,14 +307,12 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) - loofah (~> 2.21) - nokogiri (~> 1.14) - rails-i18n (7.0.7) + rails-html-sanitizer (1.5.0) + loofah (~> 2.19, >= 2.19.1) + rails-i18n (7.0.3) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) - rails_performance (1.2.0) - browser + rails_performance (1.0.4) rails redis redis-namespace @@ -328,7 +324,7 @@ GEM thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) - raindrops (0.20.1) + raindrops (0.20.0) rake (13.0.6) rb-fsevent (0.11.2) rb-inotify (0.10.1) @@ -337,9 +333,9 @@ GEM psych (>= 4.0.0) redcarpet (3.6.0) redis (4.8.1) - redis-namespace (1.11.0) + redis-namespace (1.10.0) redis (>= 4) - regexp_parser (2.8.1) + regexp_parser (2.8.0) responders (3.1.0) actionpack (>= 5.2) railties (>= 5.2) @@ -348,15 +344,15 @@ GEM multi_json (~> 1.0) redis-namespace (~> 1.6) sinatra (>= 0.9.2) - resque-scheduler (4.9.0) + resque-scheduler (4.8.0) mono_logger (~> 1.0) redis (>= 3.3) resque (>= 1.27) rufus-scheduler (~> 3.2, != 3.3) - rexml (3.2.6) + rexml (3.2.5) rmagick (5.2.0) pkg-config (~> 1.4) - rouge (4.1.2) + rouge (4.1.1) rqrcode (2.2.0) chunky_png (~> 1.0) rqrcode_core (~> 1.0) @@ -366,7 +362,7 @@ GEM rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.6) + rspec-mocks (3.12.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-rails (6.0.3) @@ -384,7 +380,7 @@ GEM ruby-rc4 (0.1.5) ruby2_keywords (0.0.5) rubyzip (2.3.2) - rufus-scheduler (3.9.1) + rufus-scheduler (3.8.2) fugit (~> 1.1, >= 1.1.6) rugged (1.6.3) sass-rails (6.0.0) @@ -397,7 +393,7 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (4.10.0) + selenium-webdriver (4.9.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -407,7 +403,7 @@ GEM shoulda-callback-matchers (1.1.4) activesupport (>= 3) shoulda-context (2.0.0) - shoulda-matchers (4.5.1) + shoulda-matchers (4.3.0) activesupport (>= 4.2.0) simplecov (0.22.0) docile (~> 1.1) @@ -416,10 +412,10 @@ GEM simplecov-html (0.12.3) simplecov-lcov (0.8.0) simplecov_json_formatter (0.1.4) - sinatra (3.0.6) + sinatra (3.0.5) mustermann (~> 3.0) rack (~> 2.2, >= 2.2.4) - rack-protection (= 3.0.6) + rack-protection (= 3.0.5) tilt (~> 2.0) smart_properties (1.17.0) sprockets (4.2.0) @@ -429,13 +425,13 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - stringio (3.0.7) + stringio (3.0.4) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - terser (1.1.17) + terser (1.1.16) execjs (>= 0.3.0, < 3) thor (1.2.2) - tilt (2.2.0) + tilt (2.1.0) time-warp (1.0.15) timeout (0.4.0) ttfunk (1.7.0) @@ -451,16 +447,15 @@ GEM crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) websocket (1.2.9) - websocket-driver (0.7.6) + websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.9) + zeitwerk (2.6.8) PLATFORMS - aarch64-linux - x86_64-linux + ruby DEPENDENCIES action_policy From 3bf7ad3a06bbf1c9fc0027b755a15bb3d0db5ec9 Mon Sep 17 00:00:00 2001 From: Samuel Maldonado Date: Tue, 1 Aug 2023 17:37:45 -0400 Subject: [PATCH 10/10] update exam template pdf parsing --- app/models/exam_template.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/exam_template.rb b/app/models/exam_template.rb index 75efbd79d5..023b564907 100644 --- a/app/models/exam_template.rb +++ b/app/models/exam_template.rb @@ -242,9 +242,9 @@ def save_cover cover = pdf.pages[0] cover_page = CombinePDF.new cover_page << cover - imglist = Magick::Image.from_blob(cover_page.to_pdf) do - self.quality = 100 - self.density = '300' + imglist = Magick::Image.from_blob(cover_page.to_pdf) do |options| + options.quality = 100 + options.density = '300' end imglist.first.write(File.join(self.base_path, 'cover.jpg')) end