diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4da35cb171d4ead463de7a883f1ba4fce9a0cbb5..fe37feead6c70ada939234eb93954ed9863f6893 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base protected def configure_permitted_parameters - devise_parameter_sanitizer.permit(:sign_up, keys: [:invitation_token]) + devise_parameter_sanitizer.permit(:sign_up, keys: [ :invitation_token ]) devise_parameter_sanitizer.permit(:account_update) do |u| u.permit(:name, :email, :password, :password_confirmation, :avatar_color, :darkmode, :languages_from, :languages_to, :telegram_username, :current_password) end @@ -12,7 +12,7 @@ class ApplicationController < ActionController::Base def authorize_shiftcoordinator unless current_user.shiftcoordinator? - render plain: 'Forbidden', status: :forbidden + render plain: "Forbidden", status: :forbidden end end end diff --git a/app/controllers/assignments_controller.rb b/app/controllers/assignments_controller.rb index 8358c167152d5eda98249ab1a6a3acc6dd355954..97715b6a9204e629a0c4a9f4df91677434fe0904 100644 --- a/app/controllers/assignments_controller.rb +++ b/app/controllers/assignments_controller.rb @@ -1,11 +1,11 @@ -require 'icalendar/tzinfo' +require "icalendar/tzinfo" class AssignmentsController < ApplicationController - before_action :authorize_shiftcoordinator, except: [:index, :by_user] + before_action :authorize_shiftcoordinator, except: [ :index, :by_user ] before_action :set_session, :set_users def index - @assignments = Assignment.all.joins(:session, :user).order('sessions.starts_at') + @assignments = Assignment.all.joins(:session, :user).order("sessions.starts_at") if params[:user_id] @assignments = @assignments.where(user_id: params[:user_id]) end @@ -14,10 +14,10 @@ class AssignmentsController < ApplicationController def create params[:user_id] ||= params[:assignment][:user_id] if params[:user_id].nil? or params[:user_id].empty? - flash.now[:alert] = 'Please select a user to assign.' + flash.now[:alert] = "Please select a user to assign." respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace(helpers.dom_id(@session), partial: "sessions/session", locals: { session: @session }), status: :unprocessable_entity } - format.html { redirect_to conference_session_path(@session.conference, @session), alert: 'Please select a user to assign.' } + format.html { redirect_to conference_session_path(@session.conference, @session), alert: "Please select a user to assign." } end return end @@ -35,13 +35,13 @@ class AssignmentsController < ApplicationController partial: "sessions/session", locals: { session: @session } ) - flash.now[:success] = 'User assigned successfully.' + flash.now[:success] = "User assigned successfully." respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace(helpers.dom_id(@session), partial: "sessions/session", locals: { session: @session }) } - format.html { redirect_to conference_session_path(@session.conference, @session), success: 'User assigned successfully.' } + format.html { redirect_to conference_session_path(@session.conference, @session), success: "User assigned successfully." } end else - flash.now[:alert] = 'Failed to assign user.' + flash.now[:alert] = "Failed to assign user." respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace(helpers.dom_id(@session), partial: "sessions/session", locals: { session: @session }), status: :unprocessable_entity } format.html { render :show, status: :unprocessable_entity } @@ -63,12 +63,12 @@ class AssignmentsController < ApplicationController ) respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace(helpers.dom_id(@session), partial: "sessions/session", locals: { session: @session }) } - format.html { redirect_to conference_session_path(@session.conference, @session), notice: 'User removed successfully.' } + format.html { redirect_to conference_session_path(@session.conference, @session), notice: "User removed successfully." } end else respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace(helpers.dom_id(@session), partial: "sessions/session", locals: { session: @session }), status: :unprocessable_entity } - format.html { redirect_to conference_session_path(@session.conference, @session), alert: 'Failed to remove user.' } + format.html { redirect_to conference_session_path(@session.conference, @session), alert: "Failed to remove user." } end end end @@ -80,7 +80,7 @@ class AssignmentsController < ApplicationController format.ics do calendar = Icalendar::Calendar.new - tz = TZInfo::Timezone.get('UTC') + tz = TZInfo::Timezone.get("UTC") calendar.add_timezone tz.ical_timezone Time.now @user.assignments.each do |assignment| @@ -96,18 +96,18 @@ class AssignmentsController < ApplicationController event = Icalendar::Event.new event.dtstart = Icalendar::Values::DateTime.new(session.starts_at, tzid: session.starts_at.time_zone.tzinfo.name) event.dtend = Icalendar::Values::DateTime.new(session.ends_at, tzid: session.ends_at.time_zone.tzinfo.name) - event.summary = [session.title, session.stage.name].join(' @ ') + event.summary = [ session.title, session.stage.name ].join(" @ ") event.description = desc.map { |l| helpers.strip_tags(l) }.join("\n\n") - event.location = [session.stage.name, session.conference.name].join(' @ ') + event.location = [ session.stage.name, session.conference.name ].join(" @ ") event.created = Icalendar::Values::DateTime.new(session.created_at) event.last_modified = Icalendar::Values::DateTime.new(session.updated_at) - event.uid = [session.conference.slug, session.ref_id].join('-') + event.uid = [ session.conference.slug, session.ref_id ].join("-") event.append_custom_property("X-ALT-DESC;FMTTYPE=text/html", desc.join("<hr>")) calendar.add_event(event) end calendar.publish - headers['Content-Type'] = 'text/calendar; charset=UTF-8' + headers["Content-Type"] = "text/calendar; charset=UTF-8" render plain: calendar.to_ical end end diff --git a/app/controllers/candidates_controller.rb b/app/controllers/candidates_controller.rb index c5f3f0466c07d0f4220c1bba2c2f89fd0e2bc1df..5f1dac044ac08292f51bbe6dfec5cbb15573723b 100644 --- a/app/controllers/candidates_controller.rb +++ b/app/controllers/candidates_controller.rb @@ -1,7 +1,7 @@ -require 'icalendar/tzinfo' +require "icalendar/tzinfo" class CandidatesController < ApplicationController - before_action :authorize_shiftcoordinator, except: [:create, :destroy_self] + before_action :authorize_shiftcoordinator, except: [ :create, :destroy_self ] def create @conference = Conference.find_by(slug: params[:conference_slug]) @@ -13,20 +13,20 @@ class CandidatesController < ApplicationController if @candidate Rails.logger.debug("Saved candidate #{@candidate.inspect}") - #@session = Session.find_by(ref_id: params[:session_ref_id]) + # @session = Session.find_by(ref_id: params[:session_ref_id]) Turbo::StreamsChannel.broadcast_replace_to( @session.conference, target: helpers.dom_id(@session), partial: "sessions/session", locals: { session: @session } ) - flash.now[:success] = 'User assigned successfully.' + flash.now[:success] = "User assigned successfully." respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace(helpers.dom_id(@session), partial: "sessions/session", locals: { session: @session }) } - format.html { redirect_to conference_session_path(@session.conference, @session), success: 'User assigned successfully.' } + format.html { redirect_to conference_session_path(@session.conference, @session), success: "User assigned successfully." } end else - flash.now[:alert] = 'Failed to record candidate.' + flash.now[:alert] = "Failed to record candidate." respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace(helpers.dom_id(@session), partial: "sessions/session", locals: { session: @session }), status: :unprocessable_entity } format.html { render :show, status: :unprocessable_entity } @@ -61,12 +61,12 @@ class CandidatesController < ApplicationController ) respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace(helpers.dom_id(session), partial: "sessions/session", locals: { session: session }) } - format.html { redirect_to conference_session_path(session.conference, session), notice: 'Candidate removed successfully.' } + format.html { redirect_to conference_session_path(session.conference, session), notice: "Candidate removed successfully." } end else respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace(helpers.dom_id(session), partial: "sessions/session", locals: { session: session }), status: :unprocessable_entity } - format.html { redirect_to conference_session_path(session.conference, session), alert: 'Failed to remove candidate.' } + format.html { redirect_to conference_session_path(session.conference, session), alert: "Failed to remove candidate." } end end end diff --git a/app/controllers/filedrop_files_controller.rb b/app/controllers/filedrop_files_controller.rb index 1487eaf31120fda9a179da38a01640a51f0ef084..88e13491cf8e520f89b7e2d1afe3d215659efe2a 100644 --- a/app/controllers/filedrop_files_controller.rb +++ b/app/controllers/filedrop_files_controller.rb @@ -1,6 +1,6 @@ class FiledropFilesController < ApplicationController before_action :authenticate_user! - before_action :set_filedrop_file, only: [:download] + before_action :set_filedrop_file, only: [ :download ] def download # Define the file path within the storage directory @@ -8,9 +8,9 @@ class FiledropFilesController < ApplicationController # Send the file to the user if File.exist?(file_path) - send_file file_path, filename: @filedrop_file.name, disposition: 'attachment' + send_file file_path, filename: @filedrop_file.name, disposition: "attachment" else - render plain: 'File not found', status: :not_found + render plain: "File not found", status: :not_found end end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 99a6a637889170940e11859080bdb4415ae5fb4c..2ea28ce93d5c854a142c75386e03be4f2f29ae00 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,6 +1,6 @@ class SessionsController < ApplicationController - before_action :authenticate_user!, except: [:index] - before_action :authorize_shiftcoordinator, except: [:index, :show] + before_action :authenticate_user!, except: [ :index ] + before_action :authorize_shiftcoordinator, except: [ :index, :show ] def index @conference = Conference.find_by(slug: params[:conference_slug]) @@ -39,13 +39,13 @@ class SessionsController < ApplicationController partial: "sessions/session", locals: { session: } ) - flash.now[:success] = 'Notes saved successfully.' + flash.now[:success] = "Notes saved successfully." respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace(helpers.dom_id(session), partial: "sessions/session", locals: { session: }) } - format.html { redirect_to conference_session_path(session.conference, session), success: 'Notes saved successfully.' } + format.html { redirect_to conference_session_path(session.conference, session), success: "Notes saved successfully." } end else - flash.now[:alert] = 'Failed to save notes.' + flash.now[:alert] = "Failed to save notes." respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.replace(helpers.dom_id(session), partial: "sessions/session", locals: { session: }), status: :unprocessable_entity } format.html { render :show, status: :unprocessable_entity } diff --git a/app/jobs/pretalx/import_job.rb b/app/jobs/pretalx/import_job.rb index 34056ad228095b7d5490be4ee08f77ff2cef080b..ac837331d75f3aaec717a75d025091b7fc11bbbd 100644 --- a/app/jobs/pretalx/import_job.rb +++ b/app/jobs/pretalx/import_job.rb @@ -1,4 +1,4 @@ -require 'httparty' +require "httparty" module Pretalx # See https://c3voc.de/wiki/schedule for more information about the format @@ -14,54 +14,54 @@ module Pretalx schedule = JSON.parse(response.body) return Rails.logger.error "Incomplete JSON received from #{conference.schedule_url}" unless - schedule.dig('schedule', 'conference', 'rooms') && - schedule.dig('schedule', 'conference', 'days') + schedule.dig("schedule", "conference", "rooms") && + schedule.dig("schedule", "conference", "days") filedrop_index = fetch_filedrop_index(conference.filedrop_url) # We keep a local hash of the stages, because the sessions reference stages by name instead of id stages = {} - schedule['schedule']['conference']['rooms'].each do |stage_data| - stages[stage_data['name']] = Stage.find_or_initialize_by(conference:, ref_id: stage_data['guid']).tap do |stage_| - stage_.name = stage_data['name'] + schedule["schedule"]["conference"]["rooms"].each do |stage_data| + stages[stage_data["name"]] = Stage.find_or_initialize_by(conference:, ref_id: stage_data["guid"]).tap do |stage_| + stage_.name = stage_data["name"] stage_.save! end end # This is where canceled sessions are moved to, so we can still easily access them - canceled_stage = Stage.find_or_initialize_by(conference:, ref_id: 'c3lingo_canceled').tap do |stage_| - stage_.name = 'Canceled talk' - stage_.description = 'A dummy stage where talks move to when they disappear from the Fahrplan' + canceled_stage = Stage.find_or_initialize_by(conference:, ref_id: "c3lingo_canceled").tap do |stage_| + stage_.name = "Canceled talk" + stage_.description = "A dummy stage where talks move to when they disappear from the Fahrplan" stage_.weight = 1000 # Sort it all the way to the right stage_.save! end # We build a list of sessions that exist in the current version of the fahrplan. That way we can move removed sessions to the "Canceled session" fake stage. existing_sessions = [] - schedule['schedule']['conference']['days'].each do |day_data| - day_data['rooms'].each do |stage_name, stage_data| + schedule["schedule"]["conference"]["days"].each do |day_data| + day_data["rooms"].each do |stage_name, stage_data| stage = stages[stage_name] stage_data.each do |session_data| - existing_sessions << session_data['guid'] - Session.find_or_initialize_by(conference:, ref_id: session_data['guid']).tap do |session| + existing_sessions << session_data["guid"] + Session.find_or_initialize_by(conference:, ref_id: session_data["guid"]).tap do |session| session.stage = stage - session.title = session_data['title'] - session.language = session_data['language'] - session.description = simple_format(session_data['abstract']) + simple_format(session_data['description']) - session.session_format = session_data['type'] - session.track = session_data['track'] - session.starts_at = session_data['date'] - hours, minutes = session_data['duration'].split(":").map(&:to_i) + session.title = session_data["title"] + session.language = session_data["language"] + session.description = simple_format(session_data["abstract"]) + simple_format(session_data["description"]) + session.session_format = session_data["type"] + session.track = session_data["track"] + session.starts_at = session_data["date"] + hours, minutes = session_data["duration"].split(":").map(&:to_i) session.ends_at = session.starts_at + hours.hours + minutes.minutes - session.url = session_data['url'] - session.speakers = session_data['persons'].map do |speaker_data| - Speaker.find_or_initialize_by(ref_id: speaker_data['guid'], conference:).tap do |speaker| - speaker.name = speaker_data['name'] || speaker_data['public_name'] - speaker.description = simple_format(speaker_data['biography']) + session.url = session_data["url"] + session.speakers = session_data["persons"].map do |speaker_data| + Speaker.find_or_initialize_by(ref_id: speaker_data["guid"], conference:).tap do |speaker| + speaker.name = speaker_data["name"] || speaker_data["public_name"] + speaker.description = simple_format(speaker_data["biography"]) speaker.save! end end - session.recorded = !session_data.fetch('do_not_record', false) + session.recorded = !session_data.fetch("do_not_record", false) update_filedrop_data(session, filedrop_index[session.ref_id], conference.filedrop_url) if filedrop_index[session.ref_id] session.save! end @@ -83,9 +83,9 @@ module Pretalx return unless data = conference.fetch_engelsystem("angeltypes/#{translation_angel_id}/shifts") shifts = data.each_with_object({}) do |shift, hash| - starts_at = parse_datetime_or_nil(conference, shift['starts_at']) + starts_at = parse_datetime_or_nil(conference, shift["starts_at"]) if hash[starts_at].nil? - hash[starts_at] = [shift] + hash[starts_at] = [ shift ] else hash[starts_at].push(shift) end @@ -112,7 +112,7 @@ module Pretalx import_engelsystem_refs(conference) RevisionSet.create!(conference:) - heartbeat = conference.data['heartbeat_url'] + heartbeat = conference.data["heartbeat_url"] HTTParty.get(heartbeat) unless heartbeat.blank? end @@ -127,7 +127,7 @@ module Pretalx basic_auth: { username: fetch_credential("filedrop_user"), password: fetch_credential("filedrop_password") }, - headers: { 'Accept' => 'application/json' }, + headers: { "Accept" => "application/json" }, timeout: 30 ) data = JSON.parse(response.body) @@ -140,7 +140,7 @@ module Pretalx return {} end - return data["talks"].each_with_object({}) do |item, hash| + data["talks"].each_with_object({}) do |item, hash| hash[item["id"]] = item end end @@ -156,14 +156,14 @@ module Pretalx # Add or update comments filedrop_data["comments"]&.each do |comment_data| - session.filedrop_comments.find_or_initialize_by(body: comment_data['body']).tap do |comment| - comment.orig_created = parse_datetime_or_nil(session.conference, comment_data['meta']['created']) + session.filedrop_comments.find_or_initialize_by(body: comment_data["body"]).tap do |comment| + comment.orig_created = parse_datetime_or_nil(session.conference, comment_data["meta"]["created"]) comment.save! end end existing_files = session.filedrop_files.pluck(:name, :checksum) - new_files = filedrop_data['files']&.map { |d| [d['name'], d.dig('meta', 'hash')] } || [] + new_files = filedrop_data["files"]&.map { |d| [ d["name"], d.dig("meta", "hash") ] } || [] # Remove files not in the JSON file (existing_files - new_files).each do |name, checksum| @@ -171,12 +171,12 @@ module Pretalx end # Add or update files - filedrop_data['files']&.each do |file_data| - session.filedrop_files.find_or_initialize_by(name: file_data['name'], checksum: file_data['meta']['hash']).tap do |file| - file.size = file_data['meta']['size'] - file.orig_created = parse_datetime_or_nil(session.conference, file_data['meta']['created']) - unless file_data['url'].blank? - file.download(filedrop_url + file_data['url'].sub(/\A\//, '')) + filedrop_data["files"]&.each do |file_data| + session.filedrop_files.find_or_initialize_by(name: file_data["name"], checksum: file_data["meta"]["hash"]).tap do |file| + file.size = file_data["meta"]["size"] + file.orig_created = parse_datetime_or_nil(session.conference, file_data["meta"]["created"]) + unless file_data["url"].blank? + file.download(filedrop_url + file_data["url"].sub(/\A\//, "")) file.save else Rails.logger.warn("Skipping incomplete file #{file.name} for #{session.ref_id}") diff --git a/app/jobs/republica_2023_or_later/import_job.rb b/app/jobs/republica_2023_or_later/import_job.rb index 995fc25866f6bed3eaf006126dd6b4cf4acf37eb..adef5fc2305e5aeb3a896a5d7a339338459aa979 100644 --- a/app/jobs/republica_2023_or_later/import_job.rb +++ b/app/jobs/republica_2023_or_later/import_job.rb @@ -1,4 +1,4 @@ -require 'httparty' +require "httparty" module Republica2023OrLater class ImportJob < ApplicationJob @@ -9,10 +9,10 @@ module Republica2023OrLater if response.success? speakers = JSON.parse(response.body) speakers.each do |speaker_data| - Speaker.find_or_initialize_by(ref_id: speaker_data['uid'], conference:).tap do |speaker| - speaker.name = speaker_data['name_raw'] - speaker.position = speaker_data['position'] - speaker.description = speaker_data['bio'] + Speaker.find_or_initialize_by(ref_id: speaker_data["uid"], conference:).tap do |speaker| + speaker.name = speaker_data["name_raw"] + speaker.position = speaker_data["position"] + speaker.description = speaker_data["bio"] speaker.save! end end @@ -25,30 +25,30 @@ module Republica2023OrLater response = HTTParty.get(url) if response.success? sessions = JSON.parse(response.body) - sessions.reject { |s| s['langcode'] == 'en' }.each do |session_data| - stage = Stage.find_or_initialize_by(conference:, ref_id: session_data['room_nid']).tap do |stage_| - stage_.name = session_data['room'] + sessions.reject { |s| s["langcode"] == "en" }.each do |session_data| + stage = Stage.find_or_initialize_by(conference:, ref_id: session_data["room_nid"]).tap do |stage_| + stage_.name = session_data["room"] stage_.save! end - Session.find_or_initialize_by(conference:, ref_id: session_data['nid']).tap do |session| + Session.find_or_initialize_by(conference:, ref_id: session_data["nid"]).tap do |session| session.stage = stage - session.title = session_data['title'] + session.title = session_data["title"] session.language = - case session_data['language'] - when 'German', 'Deutsch' - 'de' - when 'English', 'Englisch' - 'en' + case session_data["language"] + when "German", "Deutsch" + "de" + when "English", "Englisch" + "en" end - session.status = session_data['status'] - session.description = session_data['description'] - session.session_format = session_data['format'] - session.track = session_data['track'] - session.is_interpreted = (session_data['live_translation'] == "1") - session.starts_at = session_data['datetime_start'] - session.ends_at = session_data['datetime_end'] + session.status = session_data["status"] + session.description = session_data["description"] + session.session_format = session_data["format"] + session.track = session_data["track"] + session.is_interpreted = (session_data["live_translation"] == "1") + session.starts_at = session_data["datetime_start"] + session.ends_at = session_data["datetime_end"] session.url = "https://re-publica.com#{session_data['path']}" - session.speakers = session_data['speaker_uid'].map { |speaker_uid| conference.speakers.find_by!(ref_id: speaker_uid) } + session.speakers = session_data["speaker_uid"].map { |speaker_uid| conference.speakers.find_by!(ref_id: speaker_uid) } session.save! end end @@ -59,8 +59,8 @@ module Republica2023OrLater def perform(conference_slug, *args) conference = Conference.find_by(slug: conference_slug) - import_speakers(conference, conference.data['speakers_url']) - import_sessions(conference, conference.data['sessions_url']) + import_speakers(conference, conference.data["speakers_url"]) + import_sessions(conference, conference.data["sessions_url"]) revision_set = RevisionSet.create!(conference:) end end diff --git a/app/jobs/telegram_group_chat_notification_job.rb b/app/jobs/telegram_group_chat_notification_job.rb index f55fef9a7640d420cb90d910be3e595536f86850..8db5a30ca049db66e08f8273c588d2b07044f85d 100644 --- a/app/jobs/telegram_group_chat_notification_job.rb +++ b/app/jobs/telegram_group_chat_notification_job.rb @@ -1,13 +1,13 @@ -require 'telegram/bot' +require "telegram/bot" class TelegramGroupChatNotificationJob < NotificationJob queue_as :notifications def perform(**args) - channel = NotificationChannel.find_by(name: 'telegram_group_chat') + channel = NotificationChannel.find_by(name: "telegram_group_chat") Rails.logger.debug("TelegramGroupChatNotificationJob #{args.inspect}") return unless channel&.data - token = channel.data['token'] + token = channel.data["token"] return unless token args[:parse_mode] ||= "HTML" args[:target] ||= Rails.application.config.telegram_default_target diff --git a/app/jobs/telegram_notify_upcoming_job.rb b/app/jobs/telegram_notify_upcoming_job.rb index 1b34d4591a47707f15448a7562563c8631b2a2ea..8e23a84cb068dafe1c30ff17801d365b046b7879 100644 --- a/app/jobs/telegram_notify_upcoming_job.rb +++ b/app/jobs/telegram_notify_upcoming_job.rb @@ -10,7 +10,7 @@ class TelegramNotifyUpcomingJob < ApplicationJob if assignees.length.positive? notify_names = assignees.map { |a| a.telegram_username ? "@#{a.telegram_username}" : a.name } - message = notify_names.join(' ') + ": Your scheduled session <i>#{session.title}</i> starts at <b>#{session.starts_at.strftime("%H:%M")}</b> on <b>#{session.stage.name}</b>" + message = notify_names.join(" ") + ": Your scheduled session <i>#{session.title}</i> starts at <b>#{session.starts_at.strftime("%H:%M")}</b> on <b>#{session.stage.name}</b>" message += "<br>Speakers: #{session.speakers.map(&:name).join(', ')}" TelegramGroupChatNotificationJob.perform_later(text: message) diff --git a/app/models/assignment.rb b/app/models/assignment.rb index 646db6a02e8fb42e3a1b5e23ff317e530f5dab06..91f00aa62cb5593600779b27e8c1107c3c78ab56 100644 --- a/app/models/assignment.rb +++ b/app/models/assignment.rb @@ -9,10 +9,10 @@ class Assignment < ApplicationRecord after_create_commit :notify_assignment_created after_destroy_commit :notify_assignment_destroyed - scope :future, -> { joins(:session).where('sessions.starts_at' => Time.now..) } + scope :future, -> { joins(:session).where("sessions.starts_at" => Time.now..) } after_create_commit -> { - Rails.logger.debug('Created assignment, broadcasting') + Rails.logger.debug("Created assignment, broadcasting") broadcast_replace_to "sessions", target: session, partial: "sessions/session", diff --git a/app/models/conference.rb b/app/models/conference.rb index 262439f7606115dae68e2da9d0991d6f69f10aaf..29c4688cde719b06d1d799054b5aa08af595c18d 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -8,7 +8,7 @@ class Conference < ApplicationRecord validates :time_zone, presence: true, inclusion: { in: ActiveSupport::TimeZone.all.map(&:name) } - has_many :relevant_stage_links, class_name: 'RelevantStage' + has_many :relevant_stage_links, class_name: "RelevantStage" has_many :relevant_stages, through: :relevant_stage_links, source: :stage def days @@ -20,33 +20,33 @@ class Conference < ApplicationRecord end def starts_at_in_local_time - starts_at.in_time_zone(time_zone || 'UTC') + starts_at.in_time_zone(time_zone || "UTC") end def ends_at_in_local_time - ends_at.in_time_zone(time_zone || 'UTC') + ends_at.in_time_zone(time_zone || "UTC") end def schedule_url - data['schedule_url'] + data["schedule_url"] end def filedrop_url - data['filedrop_url'] + data["filedrop_url"] end def engelsystem_url - data['engelsystem_url'] + data["engelsystem_url"] end def heartbeat_url - data['heartbeat_url'] + data["heartbeat_url"] end def fetch_translation_angel_id fetch_engelsystem("angeltypes") - &.find { |t| t['name'] == 'Translation Angel' } - &.dig('id') + &.find { |t| t["name"] == "Translation Angel" } + &.dig("id") end def fetch_engelsystem(endpoint) @@ -56,15 +56,15 @@ class Conference < ApplicationRecord response = HTTParty.get( endpoint_url, headers: { - 'Accept' => 'application/json', + "Accept" => "application/json", "x-api-key" => fetch_credential("engelsystem_token") }, timeout: 10 ) - return response.success? ? JSON.parse(response.body)["data"] : nil + response.success? ? JSON.parse(response.body)["data"] : nil rescue => e Rails.logger.warn("Engelsystem query for #{endpoint} failed: #{e.message}") - return nil + nil end end @@ -73,21 +73,21 @@ class Conference < ApplicationRecord return unless data = fetch_engelsystem("angeltypes/#{translation_angel_id}/shifts") engelsystem_shifts = data.each_with_object({}) do |shift, hash| - hash[shift['id']] = shift + hash[shift["id"]] = shift &.dig("needed_angel_types") - &.find{ |t| t["angel_type"]["id"] == translation_angel_id } + &.find { |t| t["angel_type"]["id"] == translation_angel_id } &.dig("entries") - &.map{ |t| t["user"]["name"] } + &.map { |t| t["user"]["name"] } end Session - .where(conference: [self, *additional_conferences]) + .where(conference: [ self, *additional_conferences ]) .where.not(engelsystem_id: nil) .includes(assignments: :user) .group_by(&:engelsystem_id) .each do |engelsystem_id, sessions| engelsystem_assigned = engelsystem_shifts[engelsystem_id] - local_assigned = sessions.flat_map(&:assignments).map{|a|a.user.name} + local_assigned = sessions.flat_map(&:assignments).map { |a|a.user.name } only_engelsystem = engelsystem_assigned - local_assigned only_local = local_assigned - engelsystem_assigned @@ -102,6 +102,6 @@ class Conference < ApplicationRecord end end - return true + true end end diff --git a/app/models/filedrop_file.rb b/app/models/filedrop_file.rb index 5000ae25bee64c1ee2f7357648ae4a1a95add0f5..af8f3dc1ca7c822b6bc1dc6b9a3aac162c368521 100644 --- a/app/models/filedrop_file.rb +++ b/app/models/filedrop_file.rb @@ -3,7 +3,7 @@ class FiledropFile < ApplicationRecord validates :checksum, presence: true, format: { with: /\A[0-9a-fA-F]+\z/, message: "only allows hexadecimal characters" } def sanitize_filename(filename) - filename.gsub(/[^\w\s.-]/, '_') + filename.gsub(/[^\w\s.-]/, "_") end def safe_download_path(download_dir, filename) @@ -24,7 +24,7 @@ class FiledropFile < ApplicationRecord response = HTTParty.get(url) if response.success? - File.open(local_path, 'wb') do |file| + File.open(local_path, "wb") do |file| file.write(response.body) end Rails.logger.debug("File downloaded successfully and saved as #{local_path}.") @@ -41,6 +41,6 @@ class FiledropFile < ApplicationRecord session.ref_id ) FileUtils.mkdir_p(dir) - return File.join(dir, checksum) + File.join(dir, checksum) end end diff --git a/app/models/session.rb b/app/models/session.rb index 3f4ff8406e3b18ec632fa6ee359cdac77ee15527..d11923d09d79a531d9f8a6f3c6328310e5ce27d7 100644 --- a/app/models/session.rb +++ b/app/models/session.rb @@ -9,7 +9,7 @@ class Session < ApplicationRecord has_many :filedrop_comments, dependent: :destroy has_many :filedrop_files, dependent: :destroy - scope :scheduled, -> { where(status: 'scheduled') } + scope :scheduled, -> { where(status: "scheduled") } scope :future, -> { where(starts_at: Time.now..) } validates :ref_id, uniqueness: { scope: :conference_id } @@ -45,7 +45,7 @@ class Session < ApplicationRecord end def backup_needed? - return false + false end def assignees? @@ -53,11 +53,11 @@ class Session < ApplicationRecord end def filedrop? - return filedrop_files.exists? || filedrop_comments.exists? + filedrop_files.exists? || filedrop_comments.exists? end def duration_minutes - return (ends_at - starts_at) / 60.0 + (ends_at - starts_at) / 60.0 end private diff --git a/app/models/session_speaker.rb b/app/models/session_speaker.rb index 34125c28072a9f1d759cd372c76947bcd4f455e7..9f767afe686f6c0c3b0c44141adf889ec6b54667 100644 --- a/app/models/session_speaker.rb +++ b/app/models/session_speaker.rb @@ -8,7 +8,7 @@ class SessionSpeaker < ApplicationRecord private def notify_on_create - Rails.logger.debug('session_speaker.created') + Rails.logger.debug("session_speaker.created") ActiveSupport::Notifications.instrument( "session_speaker.created", record: self @@ -16,7 +16,7 @@ class SessionSpeaker < ApplicationRecord end def notify_on_destroy - Rails.logger.debug('session_speaker.destroyed') + Rails.logger.debug("session_speaker.destroyed") ActiveSupport::Notifications.instrument( "session_speaker.destroyed", record: self diff --git a/app/models/stage.rb b/app/models/stage.rb index 6470dc2a136086633699684b409b35d3cad6c2a9..ddf63a9ad591be5ad6e36cd1b147d3cb6eef31f5 100644 --- a/app/models/stage.rb +++ b/app/models/stage.rb @@ -4,6 +4,6 @@ class Stage < ApplicationRecord validates :ref_id, uniqueness: { scope: :conference_id } - has_many :relevant_stage_links, class_name: 'RelevantStage' + has_many :relevant_stage_links, class_name: "RelevantStage" has_many :relevant_conferences, through: :relevant_stage_links, source: :conference end diff --git a/app/models/user.rb b/app/models/user.rb index abb02fbc1466d77452d0cba8225c98f91ed49f8e..ecae16704ad2bfe50cd74420034fa01ad87f67b8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -4,17 +4,17 @@ class User < ApplicationRecord has_many :candidates enum :darkmode, auto: 0, light: 1, dark: 2 - validates :darkmode, inclusion: { in: %w(auto light dark) } + validates :darkmode, inclusion: { in: %w[auto light dark] } validates :password, presence: true, length: { minimum: 6 }, allow_nil: true validates :name, uniqueness: { case_sensitive: false, message: "already in use" }, allow_nil: false validates :email, uniqueness: { case_sensitive: false, message: "already in use" }, allow_nil: true, allow_blank: true before_validation :cleanup_languages - validates :languages_from, format: { with: /\A([a-z][a-z])(,[a-z][a-z])*\z/, message: "please use comma-separated two-letter codes"}, allow_blank: true + validates :languages_from, format: { with: /\A([a-z][a-z])(,[a-z][a-z])*\z/, message: "please use comma-separated two-letter codes" }, allow_blank: true validates :languages_from, length: { maximum: 14 } - validates :languages_to, format: { with: /\A([a-z][a-z])(,[a-z][a-z])*\z/, message: "please use comma-separated two-letter codes"}, allow_blank: true + validates :languages_to, format: { with: /\A([a-z][a-z])(,[a-z][a-z])*\z/, message: "please use comma-separated two-letter codes" }, allow_blank: true validates :languages_to, length: { maximum: 14 } validates :invitation_token, presence: true, on: :create @@ -26,7 +26,7 @@ class User < ApplicationRecord def self.find_for_database_authentication(warden_conditions) conditions = warden_conditions.dup if (login = conditions.delete(:name)) - where(conditions.to_h).where(["lower(name) = :value", { value: login.downcase }]).first + where(conditions.to_h).where([ "lower(name) = :value", { value: login.downcase } ]).first else Rails.logger.warn("Authentication did not query :name as expected, login will only work with exact case!") where(conditions.to_h).first @@ -34,7 +34,7 @@ class User < ApplicationRecord end def self.leaderboard - all.map { |u| [u.name, u.workload_minutes] } + all.map { |u| [ u.name, u.workload_minutes ] } .sort_by { |_, workload| -workload } .reject { |_, workload| workload.zero? } .to_h @@ -59,7 +59,7 @@ class User < ApplicationRecord end def text_color - r, g, b = avatar_color.delete_prefix('#').chars.each_slice(2).map { |hex| hex.join.to_i(16) } + r, g, b = avatar_color.delete_prefix("#").chars.each_slice(2).map { |hex| hex.join.to_i(16) } # Calculate relative luminance (WCAG 2.0 formula) luminance = (0.2126 * r + 0.7152 * g + 0.0722 * b) / 255 @@ -69,7 +69,7 @@ class User < ApplicationRecord end def initials - name.split(/\s+/).map(&:first).join('') + name.split(/\s+/).map(&:first).join("") end def set_avatar_color @@ -93,12 +93,12 @@ class User < ApplicationRecord private def valid_invitation_token - valid_tokens = ["gargamel"] + valid_tokens = [ "gargamel" ] errors.add(:invitation_token, "is invalid") unless valid_tokens.include?(invitation_token) end def cleanup_languages - self.languages_from = self.languages_from&.gsub(/\s+/, '')&.downcase - self.languages_to = self.languages_to&.gsub(/\s+/, '')&.downcase + self.languages_from = self.languages_from&.gsub(/\s+/, "")&.downcase + self.languages_to = self.languages_to&.gsub(/\s+/, "")&.downcase end end diff --git a/app/subscribers/assignment_audit_subscriber.rb b/app/subscribers/assignment_audit_subscriber.rb index 4bdb724a3d6ea5af89695441445184eb8f169513..4f01df40a92031c16569048877d8ac51ae423efc 100644 --- a/app/subscribers/assignment_audit_subscriber.rb +++ b/app/subscribers/assignment_audit_subscriber.rb @@ -10,6 +10,6 @@ class AssignmentAuditSubscriber action = event.name.split(".").last record = event.payload[:record] - ModelVersion.create!(model: 'assignment', action:, new_data: record.to_json) + ModelVersion.create!(model: "assignment", action:, new_data: record.to_json) end end diff --git a/app/subscribers/notifications_subscriber.rb b/app/subscribers/notifications_subscriber.rb index 5d07e66250f88c1a3b53553dd0943e9ad9e1fec4..5bf6deba3b26f816f6489b9da8a51f9a52d973cf 100644 --- a/app/subscribers/notifications_subscriber.rb +++ b/app/subscribers/notifications_subscriber.rb @@ -1,6 +1,6 @@ class NotificationsSubscriber def self.subscribe - ActiveSupport::Notifications.subscribe('session.updated') do |*args| + ActiveSupport::Notifications.subscribe("session.updated") do |*args| event = ActiveSupport::Notifications::Event.new(*args) new.handle_event(event) end @@ -20,7 +20,7 @@ class NotificationsSubscriber # ) # end Notification.create!( - channel: 'telegram_group_chat', + channel: "telegram_group_chat", target: ) diff --git a/app/subscribers/telegram_bot_subscriber.rb b/app/subscribers/telegram_bot_subscriber.rb index 6489657aa526ffb0f11b6d22ae911ddcecbc54e4..7d11e0445b052d12438e3ee4c819eac76a50b9b8 100644 --- a/app/subscribers/telegram_bot_subscriber.rb +++ b/app/subscribers/telegram_bot_subscriber.rb @@ -12,7 +12,7 @@ class TelegramBotSubscriber def handle_session_updated(event) Rails.logger.info("session event #{event.inspect}") - model_name, action = event.name.split('.') + model_name, action = event.name.split(".") session = event.payload[:record] changes = event.payload[:changes] @@ -25,7 +25,7 @@ class TelegramBotSubscriber return unless session.conference.relevant_stages.include? session.stage || changes["stage_id"].any? { |stage_id| session.conference.relevant_stages.include? Stage.find(stage_id) } if changes["stage_id"] - changes["stage"] = [Stage.find(changes["stage_id"].first).name, Stage.find(changes["stage_id"].last).name] + changes["stage"] = [ Stage.find(changes["stage_id"].first).name, Stage.find(changes["stage_id"].last).name ] changes.delete("stage_id") end @@ -37,7 +37,7 @@ class TelegramBotSubscriber def handle_session_speaker_event(event) Rails.logger.info("session_speaker event #{event.inspect}") - model_name, action = event.name.split('.') + model_name, action = event.name.split(".") session_speaker = event.payload[:record] session = session_speaker.session diff --git a/config/application.rb b/config/application.rb index acc422aa4b184554734ee9a5f1490ca0eb7ac1b3..f9cb58554f9ec53a4911fac11dc5b241d672574e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -14,7 +14,7 @@ module ReScheduled # Please, add to the `ignore` list any other `lib` subdirectories that do # not contain `.rb` files, or that should not be reloaded or eager loaded. # Common ones are `templates`, `generators`, or `middleware`, for example. - config.autoload_lib(ignore: %w(assets tasks)) + config.autoload_lib(ignore: %w[assets tasks]) # Configuration for the application, engines, and railties goes here. # diff --git a/config/cronotab.rb b/config/cronotab.rb index 8dc682c6edca90900c362e55bddfa16b796c0879..6185317d99d371811b7bd0579df0f1bcf71cf222 100644 --- a/config/cronotab.rb +++ b/config/cronotab.rb @@ -14,6 +14,6 @@ # Crono.perform(TestJob).every 2.days, at: '15:30' # -Crono.perform(FetchConferenceDataJob, '38c3').every 5.minutes -Crono.perform(FetchConferenceDataJob, '38c3-more').every 5.minutes -#Crono.perform(TelegramNotifyUpcomingJob, { offset: 15.minutes.to_i, interval: 1.minute.to_i }).every 1.minute +Crono.perform(FetchConferenceDataJob, "38c3").every 5.minutes +Crono.perform(FetchConferenceDataJob, "38c3-more").every 5.minutes +# Crono.perform(TelegramNotifyUpcomingJob, { offset: 15.minutes.to_i, interval: 1.minute.to_i }).every 1.minute diff --git a/config/environments/development.rb b/config/environments/development.rb index 7b58374f042dbe338dfce8873ca6e9839345e1dd..29d5eb505925938002993dd5ebac1c0683d7d778 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -77,5 +77,5 @@ Rails.application.configure do config.telegram_default_target = ENV["TELEGRAM_DEFAULT_TARGET"] || "2192297" end -Rails.application.routes.default_url_options[:host] = '127.0.0.1' -Rails.application.routes.default_url_options[:protocol] = 'http' +Rails.application.routes.default_url_options[:host] = "127.0.0.1" +Rails.application.routes.default_url_options[:protocol] = "http" diff --git a/config/environments/production.rb b/config/environments/production.rb index bcfd762da6e4ce44c3fce420d0624eed205015b9..855066df786d4efa3c25b1f475e1c860203a3eab 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -25,8 +25,8 @@ Rails.application.configure do # Set cache headers for static files config.public_file_server.headers = { - 'Cache-Control' => 'public, max-age=31536000', - 'Expires' => 1.year.from_now.to_formatted_s(:rfc822) + "Cache-Control" => "public, max-age=31536000", + "Expires" => 1.year.from_now.to_formatted_s(:rfc822) } # Compress CSS using a preprocessor. @@ -105,5 +105,5 @@ Rails.application.configure do end # Rails.application.routes.default_url_options.merge({ host: 'rescheduled.c3lingo.org', protocol: 'https' }) -Rails.application.routes.default_url_options[:host] = 'rescheduled.c3lingo.org' -Rails.application.routes.default_url_options[:protocol] = 'https' +Rails.application.routes.default_url_options[:host] = "rescheduled.c3lingo.org" +Rails.application.routes.default_url_options[:protocol] = "https" diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 64ed76ca7672b14a1810ea55141ee02bc8836811..47a60b6e238f2d56194a32ebaa48994c2fe740ba 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -24,7 +24,7 @@ Devise.setup do |config| # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. - config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' + config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com" # Configure the class responsible to send e-mails. # config.mailer = 'Devise::Mailer' @@ -36,7 +36,7 @@ Devise.setup do |config| # Load and configure the ORM. Supports :active_record (default) and # :mongoid (bson_ext recommended) by default. Other ORMs may be # available as additional gems. - require 'devise/orm/active_record' + require "devise/orm/active_record" # ==> Configuration for any authentication mechanism # Configure which keys are used when authenticating a user. The default is @@ -46,7 +46,7 @@ Devise.setup do |config| # session. If you need permissions, you should implement that in a before filter. # You can also supply a hash where the value is a boolean determining whether # or not authentication should be aborted when the value is not present. - config.authentication_keys = [:name] + config.authentication_keys = [ :name ] # Configure parameters from the request object used for authentication. Each entry # given should be a request method and it will automatically be passed to the @@ -58,12 +58,12 @@ Devise.setup do |config| # Configure which authentication keys should be case-insensitive. # These keys will be downcased upon creating or modifying a user and when used # to authenticate or find a user. Default is :email. - config.case_insensitive_keys = [:email] + config.case_insensitive_keys = [ :email ] # Configure which authentication keys should have whitespace stripped. # These keys will have whitespace before and after removed upon creating or # modifying a user and when used to authenticate or find a user. Default is :email. - config.strip_whitespace_keys = [:email, :name] + config.strip_whitespace_keys = [ :email, :name ] # Tell if authentication through request.params is enabled. True by default. # It can be set to an array that will enable params authentication only for the @@ -97,7 +97,7 @@ Devise.setup do |config| # Notice that if you are skipping storage for all authentication paths, you # may want to disable generating routes to Devise's sessions controller by # passing skip: :sessions to `devise_for` in your config/routes.rb - config.skip_session_storage = [:http_auth] + config.skip_session_storage = [ :http_auth ] # By default, Devise cleans up the CSRF token on authentication to # avoid CSRF token fixation attacks. This means that, when using AJAX diff --git a/config/routes.rb b/config/routes.rb index a2c4b3993e8283c6abca2c9b63e955e615dd6e76..d01a22bc5762f6b07f3f6054d63ac9e429f00fa2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,10 +1,10 @@ Rails.application.routes.draw do devise_for :users - mount Crono::Engine, at: '/crono' - mount ActionCable.server => '/cable' + mount Crono::Engine, at: "/crono" + mount ActionCable.server => "/cable" - get 'speakers/show' - get 'users/leaderboard' + get "speakers/show" + get "users/leaderboard" # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. # Can be used by load balancers and uptime monitors to verify that the app is live. @@ -15,27 +15,27 @@ Rails.application.routes.draw do root "conferences#index" resources :conferences, param: :slug do - get 'stats', on: :member - get ':date', action: :show, on: :member, as: :date, date: /\d{4}-\d{2}-\d{2}/ + get "stats", on: :member + get ":date", action: :show, on: :member, as: :date, date: /\d{4}-\d{2}-\d{2}/ resources :sessions, param: :ref_id do member do patch :update_notes end - resources :assignments, only: [:create, :destroy] - resources :candidates, only: [:create, :destroy] - delete 'candidates', to: 'candidates#destroy_self' + resources :assignments, only: [ :create, :destroy ] + resources :candidates, only: [ :create, :destroy ] + delete "candidates", to: "candidates#destroy_self" end resources :speakers, param: :ref_id end - resources :assignments, only: [:index] do - get 'for/:user_id', action: 'by_user', on: :collection, as: :user + resources :assignments, only: [ :index ] do + get "for/:user_id", action: "by_user", on: :collection, as: :user end resources :sessions, param: :ref_id resources :filedrop_files, only: [] do member do - get 'download', to: 'filedrop_files#download' + get "download", to: "filedrop_files#download" end end diff --git a/db/migrate/20240403123228_add_ref_id_to_speakers.rb b/db/migrate/20240403123228_add_ref_id_to_speakers.rb index 14586e23f360477f5be6d52a96e7297300601d62..a680c1269a9b1d24dd641964b1585eeee8d93987 100644 --- a/db/migrate/20240403123228_add_ref_id_to_speakers.rb +++ b/db/migrate/20240403123228_add_ref_id_to_speakers.rb @@ -1,6 +1,6 @@ class AddRefIdToSpeakers < ActiveRecord::Migration[7.1] def change add_column :speakers, :ref_id, :string - add_index :speakers, [:ref_id, :conference_id], unique: true + add_index :speakers, [ :ref_id, :conference_id ], unique: true end end diff --git a/db/migrate/20240403123231_add_ref_id_to_sessions.rb b/db/migrate/20240403123231_add_ref_id_to_sessions.rb index 4b74db297c335b52db1d4fdc017a2f0daac4c75b..54f1d9db35d41f9295724574c59d69c5f4fd2e67 100644 --- a/db/migrate/20240403123231_add_ref_id_to_sessions.rb +++ b/db/migrate/20240403123231_add_ref_id_to_sessions.rb @@ -1,6 +1,6 @@ class AddRefIdToSessions < ActiveRecord::Migration[7.1] def change add_column :sessions, :ref_id, :string - add_index :sessions, [:ref_id, :conference_id], unique: true + add_index :sessions, [ :ref_id, :conference_id ], unique: true end end diff --git a/db/migrate/20240403123242_add_ref_id_to_stages.rb b/db/migrate/20240403123242_add_ref_id_to_stages.rb index dc9c138cc4980762ca9381f14ce1bdbe35740c36..049f654030333a8ec75feb3a6a6874501793a45e 100644 --- a/db/migrate/20240403123242_add_ref_id_to_stages.rb +++ b/db/migrate/20240403123242_add_ref_id_to_stages.rb @@ -1,6 +1,6 @@ class AddRefIdToStages < ActiveRecord::Migration[7.1] def change add_column :stages, :ref_id, :string - add_index :stages, [:ref_id, :conference_id], unique: true + add_index :stages, [ :ref_id, :conference_id ], unique: true end end diff --git a/db/migrate/20240526151339_create_crono_jobs.rb b/db/migrate/20240526151339_create_crono_jobs.rb index e0ed09e8b332465f5ceafa7e28a9d336d21ea900..8bc281b4a43c21f5c08e28c72bbc69d21b5ad04e 100644 --- a/db/migrate/20240526151339_create_crono_jobs.rb +++ b/db/migrate/20240526151339_create_crono_jobs.rb @@ -7,6 +7,6 @@ class CreateCronoJobs < ActiveRecord::Migration[6.1] t.boolean :healthy t.timestamps null: false end - add_index :crono_jobs, [:job_id], unique: true + add_index :crono_jobs, [ :job_id ], unique: true end end diff --git a/db/migrate/20240527191332_create_relevant_stages.rb b/db/migrate/20240527191332_create_relevant_stages.rb index fba4b217bf12cf918f8639f4e57c89708dcea03f..409228cf2a92a95f77121335eb69a942d864b28f 100644 --- a/db/migrate/20240527191332_create_relevant_stages.rb +++ b/db/migrate/20240527191332_create_relevant_stages.rb @@ -7,6 +7,6 @@ class CreateRelevantStages < ActiveRecord::Migration[7.1] t.timestamps end - add_index :relevant_stages, [:conference_id, :stage_id], unique: true + add_index :relevant_stages, [ :conference_id, :stage_id ], unique: true end end diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index d19212abd5ced9378de164299b0eab073b16bd7e..d7e6bba8af7ba6613e07ae3381b548e7272c58a7 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -1,5 +1,5 @@ require "test_helper" class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - driven_by :selenium, using: :chrome, screen_size: [1400, 1400] + driven_by :selenium, using: :chrome, screen_size: [ 1400, 1400 ] end