timezone feature
This commit is contained in:
parent
91da29088f
commit
19a9e9aa8b
|
|
@ -16,6 +16,13 @@ ActiveAdmin.register JamRuby::User, :as => 'Users' do
|
|||
|
||||
form :partial => "form"
|
||||
|
||||
member_action :delete_forever, :method => :get do
|
||||
resource.permanently_delete
|
||||
redirect_to :back, {notice: 'User email and login credentials have been permanently changed'}
|
||||
end
|
||||
|
||||
|
||||
|
||||
show do |user|
|
||||
panel "Common" do
|
||||
attributes_table do
|
||||
|
|
@ -60,6 +67,11 @@ ActiveAdmin.register JamRuby::User, :as => 'Users' do
|
|||
end
|
||||
end
|
||||
end
|
||||
row "Delete Forever" do |user|
|
||||
span do
|
||||
link_to("delete forever", delete_forever_admin_user_path(user.id), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
end
|
||||
|
||||
row :jamclass_credits
|
||||
row :via_amazon
|
||||
|
|
@ -243,6 +255,7 @@ ActiveAdmin.register JamRuby::User, :as => 'Users' do
|
|||
@user.email = params[:jam_ruby_user][:email]
|
||||
@user.admin = params[:jam_ruby_user][:admin]
|
||||
@user.is_onboarder = params[:jam_ruby_user][:is_onboarder]
|
||||
@user.subscribe_email = params[:jam_ruby_user][:subscribe_email]
|
||||
@user.musician = params[:jam_ruby_user][:musician]
|
||||
@user.first_name = params[:jam_ruby_user][:first_name]
|
||||
@user.last_name = params[:jam_ruby_user][:last_name]
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
= f.input :email, label: 'Email'
|
||||
= f.input :admin
|
||||
= f.input :is_onboarder, label: 'Is Support Consultant'
|
||||
= f.input :subscribe_email, label: 'Subscribed to Emails?'
|
||||
= f.input :first_name
|
||||
= f.input :last_name
|
||||
= f.input :city
|
||||
|
|
|
|||
|
|
@ -383,4 +383,5 @@ age_out_sessions.sql
|
|||
alter_crash_dumps.sql
|
||||
onboarding.sql
|
||||
better_lesson_notices.sql
|
||||
teacher_search_control.sql
|
||||
teacher_search_control.sql
|
||||
user_timezone.sql
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE users ADD COLUMN timezone VARCHAR;
|
||||
ALTER TABLE users ADD COLUMN deleted BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
|
|
@ -52,6 +52,15 @@ module JamRuby
|
|||
subject: options[:subject])
|
||||
end
|
||||
|
||||
def ugly(options)
|
||||
mail(to: options[:to],
|
||||
cc: options[:cc],
|
||||
from: APP_CONFIG.email_generic_from,
|
||||
body: options[:body],
|
||||
content_type: "text/plain",
|
||||
subject: options[:subject])
|
||||
end
|
||||
|
||||
def recurly_alerts(user, options)
|
||||
|
||||
body = options[:body]
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ module JamRuby
|
|||
0
|
||||
end
|
||||
|
||||
def timezone
|
||||
@cookies[:'browser.timezone']
|
||||
end
|
||||
|
||||
def free_jamtracks
|
||||
if has_redeemable_jamtrack
|
||||
1
|
||||
|
|
|
|||
|
|
@ -962,6 +962,7 @@ module JamRuby
|
|||
if lesson_booking.same_school
|
||||
lesson_booking.same_school_free = false # !user.school.education # non-education schools (music schools) are 'free' when school-on-school
|
||||
end
|
||||
user.update_timezone(lesson_booking_slots[0].timezone) if lesson_booking_slots.length > 0
|
||||
else
|
||||
lesson_booking.same_school = false
|
||||
lesson_booking.same_school_free = false
|
||||
|
|
@ -975,7 +976,7 @@ module JamRuby
|
|||
end if lesson_booking_slots
|
||||
|
||||
if lesson_booking.save
|
||||
description = '' if description.nil?
|
||||
description = '' if description.nil?
|
||||
msg = ChatMessage.create(user, lesson_booking.lesson_sessions[0], description, ChatMessage::CHANNEL_LESSON, nil, teacher, lesson_booking.lesson_sessions[0], 'Lesson Requested')
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -166,12 +166,14 @@ module JamRuby
|
|||
found ||= lesson_session.lesson_booking
|
||||
end
|
||||
|
||||
def pretty_scheduled_start(with_timezone = true)
|
||||
def pretty_scheduled_start(with_timezone = true, user_tz = nil)
|
||||
|
||||
start_time = scheduled_time(0)
|
||||
|
||||
tz_identifier = user_tz || self.timezone
|
||||
|
||||
begin
|
||||
tz = TZInfo::Timezone.get(timezone)
|
||||
tz = TZInfo::Timezone.get(tz_identifier)
|
||||
rescue Exception => e
|
||||
@@log.error("unable to find timezone=#{tz_identifier}, e=#{e}")
|
||||
end
|
||||
|
|
@ -205,12 +207,14 @@ module JamRuby
|
|||
end
|
||||
end
|
||||
|
||||
def pretty_start_time(with_timezone = true)
|
||||
def pretty_start_time(with_timezone = true, user_tz = nil)
|
||||
|
||||
start_time = scheduled_time(0)
|
||||
|
||||
tz_identifier = user_tz || self.timezone
|
||||
|
||||
begin
|
||||
tz = TZInfo::Timezone.get(timezone)
|
||||
tz = TZInfo::Timezone.get(tz_identifier)
|
||||
rescue Exception => e
|
||||
@@log.error("unable to find timezone=#{tz_identifier}, e=#{e}")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -984,6 +984,8 @@ module JamRuby
|
|||
|
||||
#end
|
||||
if self.save
|
||||
proposer.update_timezone(slot.timezone) if proposer
|
||||
|
||||
#if update_all && !lesson_booking.counter(self, proposer, slot)
|
||||
if !lesson_booking.counter(self, proposer, slot)
|
||||
response = lesson_booking
|
||||
|
|
|
|||
|
|
@ -1215,7 +1215,7 @@ SQL
|
|||
duration
|
||||
end
|
||||
|
||||
def pretty_scheduled_start(with_timezone = true, shorter = false)
|
||||
def pretty_scheduled_start(with_timezone = true, shorter = false, user_tz = nil)
|
||||
|
||||
if scheduled_start && scheduled_duration
|
||||
start_time = scheduled_start
|
||||
|
|
@ -1224,6 +1224,9 @@ SQL
|
|||
tz_identifier, tz_display = MusicSession.split_timezone(timezone)
|
||||
short_tz = 'GMT'
|
||||
|
||||
if user_tz
|
||||
tz_identifier = user_tz
|
||||
end
|
||||
begin
|
||||
tz = TZInfo::Timezone.get(tz_identifier)
|
||||
rescue Exception => e
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ module JamRuby
|
|||
|
||||
# notifications
|
||||
has_many :notifications, :class_name => "JamRuby::Notification", :foreign_key => "target_user_id"
|
||||
|
||||
|
||||
# chats
|
||||
has_many :chats, :class_name => "JamRuby::ChatMessage", :foreign_key => "user_id"
|
||||
|
||||
|
|
@ -350,6 +350,18 @@ module JamRuby
|
|||
end
|
||||
end
|
||||
|
||||
def update_timezone(timezone)
|
||||
if timezone.nil?
|
||||
return
|
||||
|
||||
end
|
||||
begin
|
||||
TZInfo::Timezone.get(timezone)
|
||||
User.where(id: self.id).update_all(timezone: timezone)
|
||||
rescue Exception => e
|
||||
@@log.error("unable to find timezone=#{timezone}, e=#{e}")
|
||||
end
|
||||
end
|
||||
def has_any_free_jamtracks
|
||||
has_redeemable_jamtrack || gifted_jamtracks > 0
|
||||
end
|
||||
|
|
@ -1211,6 +1223,7 @@ module JamRuby
|
|||
origin = options[:origin]
|
||||
test_drive_package_details = options[:test_drive_package]
|
||||
under_13 = options[:under_13]
|
||||
timezone = options[:timezone]
|
||||
|
||||
test_drive_package = TestDrivePackage.find_by_name(test_drive_package_details[:name]) if test_drive_package_details
|
||||
|
||||
|
|
@ -1540,6 +1553,8 @@ module JamRuby
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
user.update_timezone(timezone)
|
||||
user.reload if user.id # gift card adding gifted_jamtracks doesn't reflect here until reload
|
||||
user
|
||||
end
|
||||
|
|
@ -1661,6 +1676,14 @@ module JamRuby
|
|||
"#{dir}/#{ERB::Util.url_encode(file)}"
|
||||
end
|
||||
|
||||
def permanently_delete
|
||||
original_email = self.email
|
||||
|
||||
AdminMailer.ugly({to: original_email, cc: 'support@jamkazam.com', subject:'Your account has been deleted!', body: "This will be the last email you receive from JamKazam.\n\nRegards,\nTeam JamKazam"}).deliver_now
|
||||
|
||||
User.where(id: self.id).update_all(encrypted_password: SecureRandom.uuid, email: "deleted+#{SecureRandom.uuid}@jamkazam.com", subscribe_email: false, remember_token: SecureRandom.uuid, deleted: true)
|
||||
end
|
||||
|
||||
def update_avatar(original_fpfile, cropped_fpfile, cropped_large_fpfile, crop_selection, aws_bucket)
|
||||
self.updating_avatar = true
|
||||
|
||||
|
|
|
|||
|
|
@ -271,19 +271,6 @@ describe LessonSession do
|
|||
slow[1].should eql lesson_session1
|
||||
end
|
||||
end
|
||||
describe "least_time_left" do
|
||||
it "sorts correctly" do
|
||||
lesson_session1 = normal_lesson(user, teacher, {counter: true, counterer: user})
|
||||
lesson_session2 = normal_lesson(user, teacher, {counter: true, counterer: teacher}) # this shouldn't show up
|
||||
Timecop.travel(Date.today - 5)
|
||||
lesson_session3 = normal_lesson(user, teacher, {})
|
||||
|
||||
slow = LessonSession.unscoped.least_time_left
|
||||
slow.count.should eql 2
|
||||
slow[0].should eql lesson_session1
|
||||
slow[1].should eql lesson_session3
|
||||
end
|
||||
end
|
||||
|
||||
describe "remind_counters" do
|
||||
it "finds old requested and pokes teacher" do
|
||||
|
|
@ -472,9 +459,9 @@ describe LessonSession do
|
|||
first_lesson.is_canceled?.should be true
|
||||
second_lesson.is_canceled?.should be true
|
||||
booking.is_canceled?.should be true
|
||||
first_lesson.student_short_canceled.should be true
|
||||
first_lesson.student_canceled.should be true
|
||||
first_lesson.teacher_canceled.should be false
|
||||
first_lesson.student_short_canceled.should be true
|
||||
second_lesson.student_short_canceled.should be false
|
||||
second_lesson.student_canceled.should be true
|
||||
second_lesson.teacher_canceled.should be false
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
//= require jquery.monkeypatch
|
||||
//= require jquery_ujs
|
||||
//= require jquery.cookie
|
||||
//= require jstz
|
||||
//= require AAC_underscore
|
||||
//= require AAA_Log
|
||||
//= require globals
|
||||
|
|
|
|||
|
|
@ -45,8 +45,13 @@
|
|||
|
||||
trackScreenChanges();
|
||||
|
||||
setTimezone()
|
||||
})
|
||||
|
||||
function setTimezone() {
|
||||
$.cookie("browser.timezone", window.jstz.determine().name(), { expires: 365, path: '/' });
|
||||
}
|
||||
|
||||
$(document).on('JAMKAZAM_READY', function() {
|
||||
// this event is fired when context.app is initialized
|
||||
|
||||
|
|
@ -99,6 +104,10 @@
|
|||
|
||||
function initializeDialogs(app) {
|
||||
|
||||
if(!JK.Banner) {
|
||||
// we don't use dialogs everywhere (yes, ugly)
|
||||
return
|
||||
}
|
||||
var backendAlerts = new JK.BackendAlerts(app);
|
||||
backendAlerts.initialize();
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
//= require jquery.manageVsts
|
||||
//= require jquery.lessonSessionActions
|
||||
//= require jquery.jamblasterOptions
|
||||
//= require jstz
|
||||
//= require ResizeSensor
|
||||
//= require AAA_Log
|
||||
//= require AAC_underscore
|
||||
|
|
|
|||
|
|
@ -464,6 +464,10 @@ UserStore = context.UserStore
|
|||
isSuspended: () ->
|
||||
@state.booking?.status == 'suspended'
|
||||
|
||||
isUnconfirmed: () ->
|
||||
@state.booking?.status == 'unconfirmed'
|
||||
|
||||
|
||||
isStudentCountered: () ->
|
||||
@counteredSlot()?['is_student_created?']
|
||||
|
||||
|
|
@ -774,6 +778,11 @@ UserStore = context.UserStore
|
|||
header = 'This lesson has been suspended'
|
||||
content = @renderTeacherSuspended()
|
||||
|
||||
else if @isUnconfirmed()
|
||||
|
||||
header = 'This lesson has been automatically canceled'
|
||||
content = @renderTeacherUnconfirmed()
|
||||
|
||||
return `<div className="content-body-scroller">
|
||||
<Nav/>
|
||||
|
||||
|
|
@ -814,6 +823,10 @@ UserStore = context.UserStore
|
|||
|
||||
content = @renderStudentCanceled()
|
||||
|
||||
else if @isUnconfirmed()
|
||||
header = 'this lesson has been automatically canceled'
|
||||
content = @renderStudentUnconfirmed()
|
||||
|
||||
else if @isSuspended()
|
||||
|
||||
header = 'this lesson has been suspended'
|
||||
|
|
@ -961,6 +974,11 @@ UserStore = context.UserStore
|
|||
|
||||
# <p className="description">Message from {this.other().first_name}:</p>
|
||||
# <div className="message"></div>
|
||||
|
||||
renderStudentUnconfirmed: () ->
|
||||
@renderUnconfirmed()
|
||||
|
||||
|
||||
renderStudentCountered: () ->
|
||||
@renderCountered()
|
||||
|
||||
|
|
@ -1049,9 +1067,15 @@ UserStore = context.UserStore
|
|||
|
||||
renderTeacherSuspended: () ->
|
||||
|
||||
renderTeacherUnconfirmed: () ->
|
||||
@renderUnconfirmed()
|
||||
|
||||
renderTeacherCountered: () ->
|
||||
@renderCountered()
|
||||
|
||||
renderUnconfirmed: () ->
|
||||
action = `<p>The JamKazam system has canceled this request because it was never acknowledged after too long of a time.</p>`
|
||||
|
||||
renderCanceled: () ->
|
||||
canceler = @canceler()
|
||||
myself = @myself()
|
||||
|
|
@ -1071,6 +1095,7 @@ UserStore = context.UserStore
|
|||
else
|
||||
action = `<p>You declined this lesson request.</p>`
|
||||
|
||||
|
||||
if @studentViewing()
|
||||
|
||||
if @adminCanceled() || @studentCanceled()
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
//= require jquery.scrollTo
|
||||
//= require jquery.pulse
|
||||
//= require howler.core.js
|
||||
//= require jstz
|
||||
//= require ResizeSensor
|
||||
//= require AAA_Log
|
||||
//= require AAC_underscore
|
||||
|
|
|
|||
|
|
@ -35,6 +35,34 @@
|
|||
transition: .4s;
|
||||
}
|
||||
|
||||
.slider .off-label {
|
||||
color:white;
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
top: 4px;
|
||||
font-weight: bold;
|
||||
display:inline;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
}
|
||||
.slider .on-label{
|
||||
position: absolute;
|
||||
left: 3px;
|
||||
top: 4px;
|
||||
display:none;
|
||||
-webkit-transition: .4s;
|
||||
transition: .4s;
|
||||
color:white;
|
||||
font-weight: bold;
|
||||
}
|
||||
input:checked + .slider .on-label {
|
||||
display:inline;
|
||||
}
|
||||
input:checked + .slider .off-label {
|
||||
display:none;
|
||||
}
|
||||
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: $ColorScreenPrimary;
|
||||
}
|
||||
|
|
@ -49,6 +77,12 @@ input:checked + .slider:before {
|
|||
transform: translateX(26px);
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
-webkit-transform: translateX(26px);
|
||||
-ms-transform: translateX(26px);
|
||||
transform: translateX(26px);
|
||||
}
|
||||
|
||||
/* Rounded sliders */
|
||||
.slider.round {
|
||||
border-radius: 34px;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ class ApiRecurlyController < ApiController
|
|||
location: {:country => billing_info[:country], :state => billing_info[:state], :city => billing_info[:city]},
|
||||
reuse_card: reuse_card_next_time,
|
||||
affiliate_referral_id: cookies[:affiliate_visitor],
|
||||
origin: origin_cookie
|
||||
origin: origin_cookie,
|
||||
timezone: current_timezone
|
||||
}
|
||||
|
||||
options = User.musician_defaults(request.remote_ip, ApplicationHelper.base_uri(request) + "/confirm", any_user, options)
|
||||
|
|
|
|||
|
|
@ -124,7 +124,8 @@ class ApiUsersController < ApiController
|
|||
education_interest: params[:education_interest],
|
||||
affiliate_referral_id: cookies[:affiliate_visitor],
|
||||
origin: origin_cookie,
|
||||
test_drive_package: params[:test_drive_package]
|
||||
test_drive_package: params[:test_drive_package],
|
||||
timezone: current_timezone
|
||||
}
|
||||
|
||||
options = User.musician_defaults(request.remote_ip, ApplicationHelper.base_uri(request) + "/confirm", any_user, options)
|
||||
|
|
|
|||
|
|
@ -567,6 +567,7 @@ class LandingsController < ApplicationController
|
|||
render 'amazon_lessons_promo_2', layout: 'basic'
|
||||
else
|
||||
|
||||
@current_user.update_timezone(current_timezone)
|
||||
body = "Name: #{@current_user.name}\n"
|
||||
body << "Email: #{@current_user.email}\n"
|
||||
body << "Admin: #{@current_user.admin_onboarding_url}\n"
|
||||
|
|
@ -588,7 +589,6 @@ class LandingsController < ApplicationController
|
|||
@terms = terms_of_service ? "checked" : nil
|
||||
@under13 = under_13 ? "checked" : nil
|
||||
|
||||
|
||||
# try to signup now
|
||||
@user = UserManager.new.signup(remote_ip: request.remote_ip,
|
||||
email: params[:email],
|
||||
|
|
@ -599,6 +599,7 @@ class LandingsController < ApplicationController
|
|||
under_13: under_13,
|
||||
skip_recaptcha: true,
|
||||
musician: true,
|
||||
timezone: current_timezone,
|
||||
instruments: [{:instrument_id => 'other', :proficiency_level => 1, :priority => 1}])
|
||||
if @user.errors.any?
|
||||
first = @user.errors.first
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ class SessionsController < ApplicationController
|
|||
first_name: auth_hash[:info][:first_name],
|
||||
last_name: auth_hash[:info][:last_name],
|
||||
email: auth_hash[:info][:email],
|
||||
timezone: current_timezone,
|
||||
affiliate_referral_id: cookies[:affiliate_visitor])
|
||||
|
||||
# Users who sign up using oauth are presumed to have valid email adddresses.
|
||||
|
|
@ -180,7 +181,8 @@ class SessionsController < ApplicationController
|
|||
terms_of_service: true,
|
||||
location: {:country => nil, :state => nil, :city => nil},
|
||||
affiliate_referral_id: cookies[:affiliate_visitor],
|
||||
origin: origin_cookie
|
||||
origin: origin_cookie,
|
||||
timezone: current_timezone
|
||||
}
|
||||
|
||||
options = User.musician_defaults(request.remote_ip, ApplicationHelper.base_uri(request) + "/confirm", any_user, options)
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ class UsersController < ApplicationController
|
|||
signup_confirm_url: ApplicationHelper.base_uri(request) + "/confirm",
|
||||
affiliate_referral_id: cookies[:affiliate_visitor],
|
||||
affiliate_partner: @affiliate_partner,
|
||||
timezone: current_timezone,
|
||||
origin: origin_cookie)
|
||||
|
||||
# check for errors
|
||||
|
|
|
|||
|
|
@ -71,11 +71,11 @@ module MusicSessionHelper
|
|||
end
|
||||
|
||||
def pretty_scheduled_start(music_session, with_timezone, shorter = false)
|
||||
music_session.pretty_scheduled_start(with_timezone, shorter)
|
||||
music_session.pretty_scheduled_start(with_timezone, shorter, current_timezone)
|
||||
end
|
||||
|
||||
def pretty_scheduled_start_slot(slot, with_timezone)
|
||||
slot.pretty_scheduled_start(with_timezone)
|
||||
slot.pretty_scheduled_start(with_timezone, current_timezone)
|
||||
end
|
||||
|
||||
def timezone_options
|
||||
|
|
|
|||
|
|
@ -69,6 +69,10 @@ module SessionsHelper
|
|||
@current_user ||= User.find_by_remember_token(cookies[:remember_token])
|
||||
end
|
||||
|
||||
def current_timezone
|
||||
@current_timezone ||= cookies[:'browser.timezone'] || any_user.timezone
|
||||
end
|
||||
|
||||
def anonymous_user=(anonymous_user)
|
||||
@anonymous_user = anonymous_user
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,22 +3,48 @@ object @lesson_booking
|
|||
attributes :id, :status, :lesson_type, :payment_style, :recurring, :teacher_id, :description, :lesson_length, :created_at, :user_id, :active, :accepter_id, :canceler_id, :cancel_message, :booked_price, :card_presumed_ok, :no_slots, :posa_card_id, :posa_card_purchased, :remaining_roll_forward_amount_in_cents, :canceled_by_admin
|
||||
|
||||
child(:lesson_booking_slots => :slots) {
|
||||
attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :pretty_scheduled_start, :message, :pretty_start_time, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package
|
||||
attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :message, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package
|
||||
|
||||
node :pretty_start_time do |slot|
|
||||
slot.pretty_start_time(true, current_timezone)
|
||||
end
|
||||
|
||||
node :pretty_scheduled_start do |slot|
|
||||
slot.pretty_scheduled_start(true, current_timezone)
|
||||
end
|
||||
}
|
||||
|
||||
child(:default_slot => :default_slot) {
|
||||
attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :pretty_scheduled_start, :message, :pretty_start_time, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package
|
||||
attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :message, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package
|
||||
node :pretty_start_time do |slot|
|
||||
slot.pretty_start_time(true, current_timezone)
|
||||
end
|
||||
node :pretty_scheduled_start do |slot|
|
||||
slot.pretty_scheduled_start(true, current_timezone)
|
||||
end
|
||||
}
|
||||
|
||||
child(:alt_slot => :alt_slot) {
|
||||
attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :pretty_scheduled_start, :message, :pretty_start_time, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package
|
||||
attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :message, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package
|
||||
node :pretty_start_time do |slot|
|
||||
slot.pretty_start_time(true, current_timezone)
|
||||
end
|
||||
node :pretty_scheduled_start do |slot|
|
||||
slot.pretty_scheduled_start(true, current_timezone)
|
||||
end
|
||||
}
|
||||
|
||||
child(:counter_slot => :counter_slot) {
|
||||
attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :pretty_scheduled_start, :message, :pretty_start_time, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package, :is_recurring?
|
||||
attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :message, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package, :is_recurring?
|
||||
node :pretty_scheduled_start_with_timezone do |slot|
|
||||
pretty_scheduled_start_slot(slot, true)
|
||||
end
|
||||
pretty_scheduled_start_slot(slot, true)
|
||||
end
|
||||
node :pretty_start_time do |slot|
|
||||
slot.pretty_start_time(true, current_timezone)
|
||||
end
|
||||
node :pretty_scheduled_start do |slot|
|
||||
slot.pretty_scheduled_start(true, current_timezone)
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,16 @@ child(:lesson_booking => :lesson_booking) {
|
|||
|
||||
|
||||
child(:counter_slot => :counter_slot) {
|
||||
attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :pretty_scheduled_start, :message, :pretty_start_time, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package, :is_recurring?
|
||||
attributes :id, :preferred_day, :day_of_week, :hour, :minute, :slot_type, :message, :proposer_id, :is_student_created?, :is_teacher_created?, :timezone, :pretty_timezone, :from_package, :is_recurring?
|
||||
node :pretty_scheduled_start_with_timezone do |slot|
|
||||
pretty_scheduled_start_slot(slot, true)
|
||||
end
|
||||
node :pretty_start_time do |slot|
|
||||
slot.pretty_start_time(true, current_timezone)
|
||||
end
|
||||
node :pretty_scheduled_start do |slot|
|
||||
slot.pretty_scheduled_start(true, current_timezone)
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
object @user
|
||||
|
||||
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :online, :photo_url, :musician, :gender, :birth_date, :internet_service_provider, :friend_count, :liker_count, :like_count, :follower_count, :following_count,
|
||||
:recording_count, :session_count, :biography, :favorite_count, :audio_latency, :upcoming_session_count, :age, :website, :skill_level, :reuse_card, :email_needs_verification, :is_a_teacher, :is_a_student, :is_onboarder
|
||||
:recording_count, :session_count, :biography, :favorite_count, :audio_latency, :upcoming_session_count, :age, :website, :skill_level, :reuse_card, :email_needs_verification, :is_a_teacher, :is_a_student, :is_onboarder, :timezone
|
||||
|
||||
node :location do |user|
|
||||
if user.musician?
|
||||
|
|
|
|||
|
|
@ -73,7 +73,10 @@
|
|||
<span class="list-search-label">Let new students find me by search:</span>
|
||||
<label class="switch">
|
||||
<input type="checkbox">
|
||||
<span class="slider"></span>
|
||||
<span class="slider">
|
||||
<span class="on-label">YES</span>
|
||||
<span class="off-label">NO</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<br clear="all" />
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ class UserManager < BaseManager
|
|||
origin = options[:origin]
|
||||
test_drive_package = options[:test_drive_package]
|
||||
under_13 = options[:under_13]
|
||||
timezone = options[:timezone]
|
||||
|
||||
recaptcha_failed = false
|
||||
unless options[:skip_recaptcha] # allow callers to opt-of recaptcha
|
||||
|
|
@ -102,7 +103,8 @@ class UserManager < BaseManager
|
|||
education_interest: education_interest,
|
||||
origin: origin,
|
||||
test_drive_package: test_drive_package,
|
||||
under_13: under_13)
|
||||
under_13: under_13,
|
||||
timezone: timezone)
|
||||
user
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -20,19 +20,20 @@ describe "Activate Account Card", :js => true, :type => :feature, :capybara_feat
|
|||
|
||||
amazon_2_free_card.credits.should eql 2
|
||||
|
||||
find('h2', text: 'Activate Account')
|
||||
find('.instructions', text: 'Paste or enter your promotional code so we can validate it and credit you with 2 free lessons.')
|
||||
fill_in "code", with: amazon_2_free_card.code
|
||||
find('a.amazon-a-button-text', text: 'Submit Code').trigger(:click)
|
||||
|
||||
find('.success-msg wbr', 'Your code has been validated!')
|
||||
fill_in "email", with: "amzposa1@jamkazam.com"
|
||||
fill_in "password", with: "jam123"
|
||||
find('.redeem-container ins', visible: false).trigger(:click)
|
||||
find('.checkbox-input input').trigger(:click)
|
||||
|
||||
find('button.redeem-giftcard', text: 'ACTIVATE ACCOUNT').trigger(:click)
|
||||
find('a.amazon-a-button-text', text: 'Create Account').trigger(:click)
|
||||
|
||||
find('.jam-class.all-done span.amount-gifted', text: amazon_2_free_card.credits)
|
||||
find('.done-action a.go-browse').trigger(:click)
|
||||
|
||||
find('h2', text: 'search teachers')
|
||||
find('.success-msg', "You're all set!")
|
||||
|
||||
sleep 3
|
||||
user = User.find_by_email("amzposa1@jamkazam.com")
|
||||
amazon_2_free_card.reload
|
||||
amazon_2_free_card.user.should eq(user)
|
||||
|
|
@ -40,29 +41,31 @@ describe "Activate Account Card", :js => true, :type => :feature, :capybara_feat
|
|||
amazon_2_free_card.purchased.should be true
|
||||
user.reload
|
||||
user.jamclass_credits.should eq(amazon_2_free_card.credits)
|
||||
user.timezone.should_not be_nil
|
||||
end
|
||||
|
||||
it "validates correctly" do
|
||||
visit '/account/activate/code'
|
||||
|
||||
find('h2', text: 'Activate Account')
|
||||
amazon_2_free_card.credits.should eql 2
|
||||
|
||||
find('button.redeem-giftcard', text: 'ACTIVATE ACCOUNT').trigger(:click)
|
||||
|
||||
find('.errors.active', text: "Email can't be blank")
|
||||
|
||||
find('h2', text: 'Activate Account')
|
||||
find('.instructions', text: 'Paste or enter your promotional code so we can validate it and credit you with 2 free lessons.')
|
||||
fill_in "code", with: amazon_2_free_card.code
|
||||
find('a.amazon-a-button-text', text: 'Submit Code').trigger(:click)
|
||||
|
||||
find('.success-msg wbr', 'Your code has been validated!')
|
||||
find('a.amazon-a-button-text', text: 'Create Account').trigger(:click)
|
||||
find('.error', text: "Email can't be blank")
|
||||
|
||||
fill_in "email", with: "amzpos2@jamkazam.com"
|
||||
fill_in "password", with: "jam123"
|
||||
find('.redeem-container ins', visible: false).trigger(:click)
|
||||
find('.checkbox-input input').trigger(:click)
|
||||
|
||||
find('button.redeem-giftcard', text: 'ACTIVATE ACCOUNT').trigger(:click)
|
||||
find('a.amazon-a-button-text', text: 'Create Account').trigger(:click)
|
||||
|
||||
find('.done-action a.go-browse').trigger(:click)
|
||||
|
||||
find('h2', text: 'search teachers')
|
||||
find('.success-msg', "You're all set!")
|
||||
|
||||
sleep 3
|
||||
user = User.find_by_email("amzpos2@jamkazam.com")
|
||||
amazon_2_free_card.reload
|
||||
amazon_2_free_card.user.should eq(user)
|
||||
|
|
@ -79,14 +82,15 @@ describe "Activate Account Card", :js => true, :type => :feature, :capybara_feat
|
|||
it "succeeds" do
|
||||
fast_signin(user1, '/account/activate/code')
|
||||
|
||||
find('h2', text: 'Activate Account')
|
||||
find('.instructions', text: 'Paste or enter your promotional code so we can validate it and credit you with 2 free lessons.')
|
||||
|
||||
fill_in "code", with: amazon_2_free_card.code
|
||||
|
||||
find('button.redeem-giftcard', text: 'ACTIVATE COUPON CODE').trigger(:click)
|
||||
find('a.amazon-a-button-text', text: 'Submit Code').trigger(:click)
|
||||
|
||||
find('.done-action a.go-browse').trigger(:click)
|
||||
find('a.amazon-a-button-text', text: 'Apply Credits').trigger(:click)
|
||||
|
||||
find('h2', text: 'search teachers')
|
||||
find('.success-msg', text: "You're all set!")
|
||||
|
||||
user1.reload
|
||||
amazon_2_free_card.reload
|
||||
|
|
@ -101,19 +105,19 @@ describe "Activate Account Card", :js => true, :type => :feature, :capybara_feat
|
|||
it "validates" do
|
||||
fast_signin(user1, '/account/activate/code')
|
||||
|
||||
find('h2', text: 'Activate Account')
|
||||
find('.instructions', text: 'Paste or enter your promotional code so we can validate it and credit you with 2 free lessons.')
|
||||
|
||||
find('button.redeem-giftcard').trigger(:click)
|
||||
find('.amazon-a-button-text', text: 'Submit Code').trigger(:click)
|
||||
|
||||
find('.errors.active', text: "This is not a valid code. Please carefully re-enter the code and try again. If it still does not work, please email us at support@jamkazam.com to report this problem.")
|
||||
find('.error', text: "Code not valid")
|
||||
|
||||
fill_in "code", with: amazon_2_free_card.code
|
||||
|
||||
find('button.redeem-giftcard').trigger(:click)
|
||||
find('a.amazon-a-button-text', text: 'Submit Code').trigger(:click)
|
||||
|
||||
find('.done-action a.go-browse').trigger(:click)
|
||||
find('a.amazon-a-button-text', text: 'Apply Credits').trigger(:click)
|
||||
|
||||
find('h2', text: 'search teachers')
|
||||
find('.success-msg', text: "You're all set!")
|
||||
|
||||
user1.reload
|
||||
amazon_2_free_card.reload
|
||||
|
|
@ -121,6 +125,7 @@ describe "Activate Account Card", :js => true, :type => :feature, :capybara_feat
|
|||
amazon_2_free_card.requires_purchase.should be false
|
||||
amazon_2_free_card.purchased.should be true
|
||||
user1.jamclass_credits.should eq(amazon_2_free_card.credits)
|
||||
user1.timezone.should_not be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ describe "Active Music Session API ", :type => :api do
|
|||
|
||||
it "successful" do
|
||||
put "/api/sessions/#{music_session.id}.json", {:description => "you!", :musician_access => false, :fan_chat => false, :fan_access => false, :approval_required => true}.to_json, "CONTENT_TYPE" => 'application/json'
|
||||
last_response.status.should eql(204)
|
||||
last_response.status.should eql(200)
|
||||
get "/api/sessions/#{music_session.id}.json", "CONTENT_TYPE" => 'application/json'
|
||||
updated_session = JSON.parse(last_response.body)
|
||||
updated_session["description"].should == "you!"
|
||||
|
|
@ -170,7 +170,7 @@ describe "Active Music Session API ", :type => :api do
|
|||
|
||||
it "string boolean value" do
|
||||
put "/api/sessions/#{music_session.id}.json", {:musician_access => "false"}.to_json, "CONTENT_TYPE" => 'application/json'
|
||||
last_response.status.should eql(204)
|
||||
last_response.status.should eql(200)
|
||||
get "/api/sessions/#{music_session.id}.json", "CONTENT_TYPE" => 'application/json'
|
||||
updated_session = JSON.parse(last_response.body)
|
||||
updated_session["musician_access"].should be false
|
||||
|
|
@ -184,7 +184,7 @@ describe "Active Music Session API ", :type => :api do
|
|||
|
||||
it "updated genres" do
|
||||
put "/api/sessions/#{music_session.id}.json", {:genre => "jazz"}.to_json, "CONTENT_TYPE" => 'application/json'
|
||||
last_response.status.should eql(204)
|
||||
last_response.status.should eql(200)
|
||||
get "/api/sessions/#{music_session.id}.json", "CONTENT_TYPE" => 'application/json'
|
||||
updated_session = JSON.parse(last_response.body)
|
||||
updated_session["genres"].should == ["Jazz"]
|
||||
|
|
@ -523,8 +523,6 @@ describe "Active Music Session API ", :type => :api do
|
|||
|
||||
join_request = JSON.parse(last_response.body)
|
||||
|
||||
puts "join_request #{join_request}"
|
||||
|
||||
# now join_requests should still be empty, because we don't share join_requests to people outside the session
|
||||
login(user2)
|
||||
get '/api/sessions.json'
|
||||
|
|
|
|||
Loading…
Reference in New Issue