This commit is contained in:
Seth Call 2016-07-06 20:22:43 -05:00
parent 690da99dd6
commit 43fa113a5d
16 changed files with 48 additions and 60 deletions

View File

@ -472,7 +472,7 @@ module JamRuby
def has_count_in?
has_count_in = false
if jmep_json
jmep = JSON.parse(jmep_json)
jmep = jmep_json
if jmep["Events"]
events = jmep["Events"]

View File

@ -1949,7 +1949,7 @@ module JamRuby
end
def can_buy_test_drive?
lesson_purchases.where('lesson_package_type_id in (?)', LessonPackageType.test_drive_package_ids).where('created_at > ?', APP_CONFIG.test_drive_wait_period_year.years.ago).count == 0
lesson_purchases.where('lesson_package_type_id in (?)', LessonPackageType.test_drive_package_ids).where('created_at > ?', Rails.application.config.test_drive_wait_period_year.years.ago).count == 0
end
def lessons_with_teacher(teacher)
@ -2219,7 +2219,7 @@ module JamRuby
end
def recent_test_drive_teachers
User.select('distinct on (users.id) users.*').joins(taught_lessons: :music_session).where('lesson_sessions.lesson_type = ?', LessonSession::LESSON_TYPE_TEST_DRIVE).where('music_sessions.user_id = ?', id).where('lesson_sessions.created_at > ?', APP_CONFIG.test_drive_wait_period_year.years.ago)
User.select('distinct on (users.id) users.*').joins(taught_lessons: :music_session).where('lesson_sessions.lesson_type = ?', LessonSession::LESSON_TYPE_TEST_DRIVE).where('music_sessions.user_id = ?', id).where('lesson_sessions.created_at > ?', Rails.application.config.test_drive_wait_period_year.years.ago)
end
def mark_session_ready

View File

@ -55,7 +55,7 @@ module JamRuby
end
@mixdown = @mixdown_package.jam_track_mixdown
@settings = JSON.parse(@mixdown.settings)
@settings = @mixdown.settings
process_jmep
@ -119,9 +119,6 @@ module JamRuby
log.info("speed factor #{@speed_factor}")
jmep = @mixdown.jam_track.jmep_json
if jmep
jmep = JSON.parse(jmep)
end
if jmep.nil?
log.debug("no jmep")
@ -763,6 +760,7 @@ module JamRuby
end
@mixdown_package.finish_errored(@error_reason, @error_detail)
log.error "mixdown package failed. reason=#{@error_reason}\n#detail=#{@error_detail}"
rescue Exception => e
log.error "unable to post back to the database the error #{e}"
end

View File

@ -10,57 +10,48 @@ teacherActions = window.JK.Actions.Teacher
@setCheckboxState()
@enableICheck()
setSingleCheckbox: (checkbox) ->
selector = checkbox.selector
if checkbox.stateKey?
choice = @state[checkbox.stateKey]
else
choice = @props[checkbox.propsKey]
$candidate = @root.find(selector)
@iCheckIgnore = true
if $candidate.attr('type') == 'radio'
if choice?
$found = @root.find(selector + '[value="' + choice + '"]')
$found.iCheck('check').attr('checked', true)
else
$candidate.iCheck('uncheck').attr('checked', false)
else
if choice
$candidate.iCheck('check').attr('checked', true);
else
$candidate.iCheck('uncheck').attr('checked', false);
@iCheckIgnore = false
setCheckboxState: () ->
for checkbox in this.checkboxes
@setSingleCheckbox(checkbox)
return
for checkbox in @checkboxes
selector = checkbox.selector
enableSingle: (checkbox) ->
selector = checkbox.selector
if checkbox.stateKey?
choice = @state[checkbox.stateKey]
else
choice = @props[checkbox.propsKey]
checkBoxes = @root.find(selector + '[type="checkbox"]')
if checkBoxes.length > 0
context.JK.checkbox(checkBoxes)
checkBoxes.on('ifChanged', (e) => @checkIfCanFire(e))
radioBoxes = @root.find(selector + '[type="radio"]')
if radioBoxes.length > 0
context.JK.checkbox(radioBoxes)
radioBoxes.on('ifChanged', (e) => @checkIfCanFire(e))
$candidate = @root.find(selector)
@iCheckIgnore = true
if $candidate.attr('type') == 'radio'
if choice?
$found = @root.find(selector + '[value="' + choice + '"]')
$found.iCheck('check').attr('checked', true)
else
$candidate.iCheck('uncheck').attr('checked', false)
else
if choice
$candidate.iCheck('check').attr('checked', true);
else
$candidate.iCheck('uncheck').attr('checked', false);
@iCheckIgnore = false
enableICheck: (e) ->
if !@root?
return
for checkbox in this.checkboxes
@enableSingle(checkbox)
return
for checkbox in @checkboxes
selector = checkbox.selector
checkBoxes = @root.find(selector + '[type="checkbox"]')
if checkBoxes.length > 0
context.JK.checkbox(checkBoxes)
checkBoxes.on('ifChanged', (e) => @checkIfCanFire(e))
radioBoxes = @root.find(selector + '[type="radio"]')
if radioBoxes.length > 0
context.JK.checkbox(radioBoxes)
radioBoxes.on('ifChanged', (e) => @checkIfCanFire(e))
true

View File

@ -25,7 +25,7 @@ div[layout="header"] h1 {
overflow: hidden;
text-align: left;
text-transform: capitalize;
background-image: url("header/logo.png");
background-image: image-url("header/logo.png");
background-repeat: no-repeat;
background-position: 50% 50%;
float:left;

View File

@ -1,6 +1,6 @@
require 'bugsnag'
class ApplicationController < ActionController::Base
protect_from_forgery
#protect_from_forgery #XXX turn back on; but client needs to send X-CRSF-TOKEN intsead of COOKIE
include ApplicationHelper
include SessionsHelper
include ClientHelper

View File

@ -66,6 +66,7 @@ module SessionsHelper
end
def current_user
puts "COOKIES! #{cookies.inspect}"
@current_user ||= User.find_by_remember_token(cookies[:remember_token])
end

View File

@ -142,7 +142,6 @@ if defined?(Bundler)
config.websocket_gateway_uri_ssl = "wss://#{config.external_hostname}:#{config.websocket_gateway_port_ssl}/websocket"
config.websocket_gateway_trusted_uri_ssl = "wss://#{config.external_hostname}:#{config.websocket_gateway_port_ssl + 1}/websocket"
config.storage_type = :fog
# config.storage_type = :file # or :fog, if using AWS

View File

@ -630,7 +630,7 @@ Rails.application.routes.draw do
get '/versioncheck' => 'artifacts#versioncheck'
# discover websocket gateway info
get '/config' => 'api_configs#index'
get '/config' => 'api_configs#index'
# no-op method to see if server is running
get '/healthcheck' => 'artifacts#healthcheck'

View File

@ -1,5 +1,5 @@
require 'spec_helper'
describe ApiJamblastersController do
describe ApiJamblastersController, type: :controller do
render_views
let(:user) { FactoryGirl.create(:user) }

View File

@ -1,6 +1,6 @@
require 'spec_helper'
describe ApiReviewsController do
describe ApiReviewsController, type: :controller do
render_views
before(:all) do
@logged_in_user = FactoryGirl.create(:user)

View File

@ -1,6 +1,6 @@
require 'spec_helper'
describe ApiSchoolInvitationsController do
describe ApiSchoolInvitationsController, type: :controller do
render_views
let (:owner) {FactoryGirl.create(:user)}

View File

@ -1,6 +1,6 @@
require 'spec_helper'
describe ApiSchoolsController do
describe ApiSchoolsController, type: :controller do
render_views
let (:owner) {FactoryGirl.create(:user)}

View File

@ -1,6 +1,6 @@
require 'spec_helper'
describe ApiTeachersController do
describe ApiTeachersController, type: :controller do
render_views
BIO = "Once a man learned a guitar."

View File

@ -872,7 +872,6 @@ FactoryGirl.define do
association :user, factory: :user
sequence(:serial_no ) { |n| "serial_no#{n}" }
sequence(:vtoken ) { |n| "vtoken#{n}" }
sequence(:client_id ) { |n| "client_id#{n}" }
end

View File

@ -1,7 +1,7 @@
require 'spec_helper'
describe UsersController, :type => :request do
render_views
#render_views
let(:user) { FactoryGirl.create(:user) }
let(:utm_valid_url) { '/?utm_source=abcya&utm_medium=browsers&utm_campaign=dog' }