Skip to content

Instantly share code, notes, and snippets.

View scytacki's full-sized avatar

Scott Cytacki scytacki

  • Concord Consortium
  • Medford, MA
View GitHub Profile
===== LOG STARTED: 09.04.2023 22:42:21=====
=====Version=1.98.0 Build=400980 P=False NoDelayELM327Init=False
====Connection profile=Volkswagen EV MEB: ID.3, ID.4, ID.5, ID.6, ID.Buzz, Enyaq, Q4 E-tron, Cupra Born, etc.
[Connection type: BluetoothLE; DeviceName=WiC_34b472ef7c09]
[Connecting to 00000000-0000-0000-0000-4986fff740c4]
[Connected to 00000000-0000-0000-0000-4986fff740c4]
ATZ
ATE0
WITH activities_1 AS (SELECT *, cardinality(questions) AS num_questions FROM "report-service"."activity_structure" WHERE structure_id = '534002d3-0a86-48ad-8b36-d3c902f08cf0'),
activities_2 AS (SELECT *, cardinality(questions) AS num_questions FROM "report-service"."activity_structure" WHERE structure_id = '43b612a2-db8c-4f50-987c-e2d4f465f2c5'),
activities_3 AS (SELECT *, cardinality(questions) AS num_questions FROM "report-service"."activity_structure" WHERE structure_id = '360fe0a4-df2a-4ff0-911b-b4524cf3928b'),
unique_user_class AS (
SELECT class_id, user_id,
arbitrary(student_id) as student_id,
arbitrary(student_name) as student_name,
@scytacki
scytacki / issue-with-slider.txt
Created August 23, 2022 17:46
Exception when moving around time travel slider
tool-tile.tsx?803e:149 Uncaught TypeError: Cannot read properties of undefined (reading 'type')
at new ToolTileComponent (tool-tile.tsx?803e:149:1)
at constructClassInstance (react-dom.development.js?61bb:12716:1)
at updateClassComponent (react-dom.development.js?61bb:17425:1)
at beginWork (react-dom.development.js?61bb:19073:1)
at HTMLUnknownElement.callCallback (react-dom.development.js?61bb:3945:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js?61bb:3994:1)
at invokeGuardedCallback (react-dom.development.js?61bb:4056:1)
at beginWork$1 (react-dom.development.js?61bb:23964:1)
at performUnitOfWork (react-dom.development.js?61bb:22776:1)
@scytacki
scytacki / list_lara_admins_users.rb
Created August 17, 2022 14:33
List LARA admins users
require('csv')
users = User.where(is_admin: true)
output = CSV.generate { |csv|
users.each{ |user|
csv << [
user.id,
user.email,
user.last_sign_in_at
# First pass off this missed interactives that had no answerPrompt field in their JSON
# this is a revised version of that first pass to pick up these new ones
# Get interactives without answer prompt fields that were not modified after the new interactive
# was released
ManagedInteractive.where(library_interactive_id: 41).where("authored_state not like '%\"answerPrompt\":%'").where("legacy_ref_id is null").where("updated_at < '2022-08-05 14:22'").count
def add_describe_the_drawing
mis_processed = 0
managed_interactives = ManagedInteractive.where(library_interactive_id: 41).where("authored_state not like '%\"answerPrompt\":%'").where("legacy_ref_id is null").where("updated_at < '2022-08-05 14:22'")
mis_to_process = managed_interactives.count
def swap_image_question_prompts
mis_processed = 0
managed_interactives = ManagedInteractive.where(library_interactive_id: 41).where("legacy_ref_id is not null").where("updated_at < '2022-08-04'")
mis_to_process = managed_interactives.count
managed_interactives.find_in_batches(batch_size: 1000) { |batch|
ActiveRecord::Base.transaction {
batch.each { |mi|
authored_state = JSON.parse(mi.authored_state)
prompt = authored_state["prompt"]
answerPrompt = authored_state["answerPrompt"]
@scytacki
scytacki / copy-half-width-setting.rb
Last active August 6, 2022 14:18
copy-half-width-setting.rb
ManagedInteractive.where("legacy_ref_id is not null").where("updated_at < '2022-08-04'").count
Embeddable::OpenResponse.joins(:converted_interactive).where(is_half_width: true).count +
Embeddable::MultipleChoice.joins(:converted_interactive).where(is_half_width: true).count +
Embeddable::ImageQuestion.joins(:converted_interactive).where(is_half_width: true).count +
VideoInteractive.joins(:converted_interactive).where(is_half_width: true).count +
ImageInteractive.joins(:converted_interactive).where(is_half_width: true).count
def author_modified_count
ManagedInteractive.where("legacy_ref_id is not null").where("updated_at > '2022-08-04'").count
ManagedInteractive.where(library_interactive_id: 41).where("authored_state like '%\"answerPrompt\":null%' or authored_state like '%\"answerPrompt\":\"\"%'").where("legacy_ref_id is null").count
def add_describe_the_drawing
mis_processed = 0
managed_interactives = ManagedInteractive.where(library_interactive_id: 41).where("authored_state like '%\"answerPrompt\":null%' or authored_state like '%\"answerPrompt\":\"\"%'").where("legacy_ref_id is null")
mis_to_process = managed_interactives.count
managed_interactives.find_in_batches(batch_size: 100) { |batch|
ActiveRecord::Base.transaction {
batch.each { |mi|
authored_state = JSON.parse(mi.authored_state)
Embeddable::ImageQuestion.joins(:converted_interactive).where("drawing_prompt like '%<img%' or prompt like '%<img%'").count
=> 60
Embeddable::OpenResponse.joins(:converted_interactive).where("prompt like '%<img%'").count
=> 1525
Embeddable::MultipleChoice.joins(:converted_interactive).where("prompt like '%<img%'").count
=> 622
ManagedInteractive.where("legacy_ref_id is not null").where("authored_state like '%\\u003Cimg%'").count
=> 2218
-- This is the log when I exported an activity with a single page and
-- single open resp question
app_1 | Started GET "/api/v1/activities/24/report_structure.json" for 172.22.0.4 at 2022-07-28 01:49:47 +0000
app_1 | Processing by Api::V1::LightweightActivitiesController#report_structure as JSON
app_1 | Parameters: {"id"=>"24"}
app_1 | session before:{"session_id"=>"26ee56a0ca00470ff11786176e766ab6", "warden.user.user.key"=>[[1], "$2a$10$u82W97eO7fS6esmPeMouAO"], "warden.user.user.session"=>{"last_request_at"=>2022-07-28 01:29:55 UTC}, "_csrf_token"=>"RJkLzKqiZrUbQkAPdsEDr32LdjeaqCmwOgFq+arVc4Q="}
app_1 | * Accept-Language: en-US,en;q=0.9,es-419;q=0.8,es;q=0.7
app_1 | * Locale set to 'en'