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
@scytacki
scytacki / incomplete.js
Last active November 26, 2019 04:53
examples of let like behavior in jest
// For a more complete version of this look at given: https://github.com/tatyshev/given2/
// it supports more options and has more checks, but is also much bigger than this
// 15 line approach.
const c = {};
// Approach #1 add properties to a variable `c`
// these use a getter that gets replaced after being called the first time
// In theory this can be used with the global object, but that means your test would be adding
// properties to the global namespace
@scytacki
scytacki / update-activity-runs.rb
Last active January 7, 2020 21:24
scripts to run in the rails console to update activity runs
def update_seq_platform_info(sequence_run)
sequence_run.runs.each { |r|
r.update_attributes(
class_info_url: sequence_run.class_info_url,
context_id: sequence_run.context_id,
platform_id: sequence_run.platform_id,
platform_user_id: sequence_run.platform_user_id,
resource_link_id: sequence_run.resource_link_id
)
}
@scytacki
scytacki / fix_moved_students_in_lara.rb
Last active January 23, 2020 22:25
Fix moved student in LARA
# get offering and class json api responses from running teacher report
# URL templates:
# https://learn.concord.org/api/v1/classes/[class_id]
# https://learn.concord.org/api/v1/offerings/[offering_id]
# modify offering json by adding class_hash property from the class json
# The following commands are to be run in the LARA rails console
offering_json = <<-EOS
# Paste modified offering json string inside here
@scytacki
scytacki / Instructions.md
Created April 11, 2020 00:15
Test demonstrating broken issue with chromedriver

These are the files used to file a bug with chromedriver: https://bugs.chromium.org/p/chromedriver/issues/detail?id=3422

To run the test:

  1. Download index.html, prototype.js, and test.js
  2. install selenium-webdriver: npm install selenium-webdriver
  3. start chromedriver
  4. run a webserver to serve the index.html page (I used http-server from npm)
  5. run the test: node test.js
@scytacki
scytacki / create-cases.js
Created October 5, 2020 13:03
Google spreadsheet function to 'explode' a range based on a column that has a 'count' in it. Each row is duplicated 'count' times.
function CREATE_CASES(input_range, count_column) {
return input_range.map((row) => {
let rows = [];
for(let i=0; i<row[count_column]; i++){
rows.push(row);
}
return rows
}).flat();
}

Tools have:

  • tool_id
  • url
  • name

Usage of tool_id

API/ReportUsersController

#external_report_query

Admin::Project.where("landing_page_content LIKE '%renderMaterialsCollection(101%'")
@scytacki
scytacki / timesheet-updater.js
Last active October 16, 2023 16:00
Some scripts for updating cells in timesheet.
function updateReactInput(inp, value) {
Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value').set.call(inp, value);
inp.dispatchEvent(new Event('change', { bubbles: true}));
}
function updateReactSelect(inp, value) {
Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype, 'value').set.call(inp, value);
inp.dispatchEvent(new Event('change', { bubbles: true}));
}
{
"background_image": "",
"description": "",
"editor_mode": 0,
"id": 21610,
"layout": 0,
"name": "Test Built in Open Response and TE",
"notes": "",
"related": "",
"runtime": "LARA",
-- 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'