* mark user as teacher better
This commit is contained in:
parent
1652aa4bd3
commit
e446c3ff44
|
|
@ -332,3 +332,4 @@ chat_channel.sql
|
||||||
jamblaster.sql
|
jamblaster.sql
|
||||||
test_drive_lessons.sql
|
test_drive_lessons.sql
|
||||||
whitelist.sql
|
whitelist.sql
|
||||||
|
teacher_student_flags.sql
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE users ADD COLUMN is_a_student BOOLEAN NOT NULL DEFAULT FALSE;
|
||||||
|
ALTER TABLE users ADD COLUMN is_a_teacher BOOLEAN NOT NULL DEFAULT FALSE;
|
||||||
|
|
@ -216,6 +216,8 @@ module JamRuby
|
||||||
validates :subscribe_email, :inclusion => {:in => [nil, true, false]}
|
validates :subscribe_email, :inclusion => {:in => [nil, true, false]}
|
||||||
validates :musician, :inclusion => {:in => [true, false]}
|
validates :musician, :inclusion => {:in => [true, false]}
|
||||||
validates :show_whats_next, :inclusion => {:in => [nil, true, false]}
|
validates :show_whats_next, :inclusion => {:in => [nil, true, false]}
|
||||||
|
validates :is_a_student, :inclusion => {:in => [true, false]}
|
||||||
|
validates :is_a_teacher, :inclusion => {:in => [true, false]}
|
||||||
validates :mods, json: true
|
validates :mods, json: true
|
||||||
validates_numericality_of :last_jam_audio_latency, greater_than: MINIMUM_AUDIO_LATENCY, less_than: MAXIMUM_AUDIO_LATENCY, :allow_nil => true
|
validates_numericality_of :last_jam_audio_latency, greater_than: MINIMUM_AUDIO_LATENCY, less_than: MAXIMUM_AUDIO_LATENCY, :allow_nil => true
|
||||||
validates :last_jam_updated_reason, :inclusion => {:in => [nil, JAM_REASON_REGISTRATION, JAM_REASON_NETWORK_TEST, JAM_REASON_FTUE, JAM_REASON_JOIN, JAM_REASON_IMPORT, JAM_REASON_LOGIN]}
|
validates :last_jam_updated_reason, :inclusion => {:in => [nil, JAM_REASON_REGISTRATION, JAM_REASON_NETWORK_TEST, JAM_REASON_FTUE, JAM_REASON_JOIN, JAM_REASON_IMPORT, JAM_REASON_LOGIN]}
|
||||||
|
|
@ -1066,6 +1068,8 @@ module JamRuby
|
||||||
signup_hint = options[:signup_hint]
|
signup_hint = options[:signup_hint]
|
||||||
affiliate_partner = options[:affiliate_partner]
|
affiliate_partner = options[:affiliate_partner]
|
||||||
gift_card = options[:gift_card]
|
gift_card = options[:gift_card]
|
||||||
|
student = options[:student]
|
||||||
|
teacher = options[:teacher]
|
||||||
|
|
||||||
user = User.new
|
user = User.new
|
||||||
user.validate_instruments = true
|
user.validate_instruments = true
|
||||||
|
|
@ -1075,10 +1079,15 @@ module JamRuby
|
||||||
user.email = email
|
user.email = email
|
||||||
user.subscribe_email = true
|
user.subscribe_email = true
|
||||||
user.terms_of_service = terms_of_service
|
user.terms_of_service = terms_of_service
|
||||||
user.musician = musician
|
|
||||||
user.reuse_card unless reuse_card.nil?
|
user.reuse_card unless reuse_card.nil?
|
||||||
user.gifted_jamtracks = 0
|
user.gifted_jamtracks = 0
|
||||||
user.has_redeemable_jamtrack = true
|
user.has_redeemable_jamtrack = true
|
||||||
|
user.is_a_student = !!student
|
||||||
|
user.is_a_teacher = !!teacher
|
||||||
|
if user.is_a_student || user.is_a_teacher
|
||||||
|
musician = true
|
||||||
|
end
|
||||||
|
user.musician = !!musician
|
||||||
|
|
||||||
|
|
||||||
# FIXME: Setting random password for social network logins. This
|
# FIXME: Setting random password for social network logins. This
|
||||||
|
|
|
||||||
|
|
@ -108,15 +108,15 @@ rest = context.JK.Rest()
|
||||||
@setState({processing:true})
|
@setState({processing:true})
|
||||||
|
|
||||||
markTeacher: () ->
|
markTeacher: () ->
|
||||||
#rest.updateUser({teacher: true})
|
rest.updateUser({teacher: true})
|
||||||
#.done((response) =>
|
.done((response) =>
|
||||||
# this.setState({done: true})
|
this.setState({done: true})
|
||||||
context.location = '/client#/teachers/setup/introduction'
|
context.location = '/client#/teachers/setup/introduction'
|
||||||
#)
|
)
|
||||||
#.fail((jqXHR) =>
|
.fail((jqXHR) =>
|
||||||
# this.setState({processing: false})
|
this.setState({processing: false})
|
||||||
# context.JK.app.notifyServerError(jqXHR, "Unable to Mark As Teacher")
|
context.JK.app.notifyServerError(jqXHR, "Unable to Mark As Teacher")
|
||||||
#)
|
)
|
||||||
|
|
||||||
createUser: () ->
|
createUser: () ->
|
||||||
$form = $('.jamtrack-signup-form')
|
$form = $('.jamtrack-signup-form')
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,8 @@ ApiUsersController < ApiController
|
||||||
location: {:country => nil, :state => nil, :city => nil},
|
location: {:country => nil, :state => nil, :city => nil},
|
||||||
signup_hint: signup_hint,
|
signup_hint: signup_hint,
|
||||||
gift_card: params[:gift_card],
|
gift_card: params[:gift_card],
|
||||||
|
student: params[:student],
|
||||||
|
teacher: params[:teacher],
|
||||||
affiliate_referral_id: cookies[:affiliate_visitor]
|
affiliate_referral_id: cookies[:affiliate_visitor]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -169,6 +171,8 @@ ApiUsersController < ApiController
|
||||||
@user.update_online_presences(params[:online_presences]) if params.has_key?(:online_presences)
|
@user.update_online_presences(params[:online_presences]) if params.has_key?(:online_presences)
|
||||||
@user.update_performance_samples(params[:performance_samples]) if params.has_key?(:performance_samples)
|
@user.update_performance_samples(params[:performance_samples]) if params.has_key?(:performance_samples)
|
||||||
@user.update_calendars(params[:calendars]) if params.has_key?(:calendars)
|
@user.update_calendars(params[:calendars]) if params.has_key?(:calendars)
|
||||||
|
@user.is_a_student = params[:student] if params.has_key?(:student)
|
||||||
|
@user.is_a_teacher = params[:teacher] if params.has_key?(:teacher)
|
||||||
@user.save
|
@user.save
|
||||||
|
|
||||||
if @user.errors.any?
|
if @user.errors.any?
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ class UserManager < BaseManager
|
||||||
signup_hint = options[:signup_hint]
|
signup_hint = options[:signup_hint]
|
||||||
affiliate_partner = options[:affiliate_partner]
|
affiliate_partner = options[:affiliate_partner]
|
||||||
gift_card = options[:gift_card]
|
gift_card = options[:gift_card]
|
||||||
|
student = options[:student]
|
||||||
|
teacher = options[:teacher]
|
||||||
|
|
||||||
recaptcha_failed = false
|
recaptcha_failed = false
|
||||||
unless options[:skip_recaptcha] # allow callers to opt-of recaptcha
|
unless options[:skip_recaptcha] # allow callers to opt-of recaptcha
|
||||||
|
|
@ -74,7 +76,9 @@ class UserManager < BaseManager
|
||||||
any_user: any_user,
|
any_user: any_user,
|
||||||
signup_hint: signup_hint,
|
signup_hint: signup_hint,
|
||||||
affiliate_partner: affiliate_partner,
|
affiliate_partner: affiliate_partner,
|
||||||
gift_card: gift_card)
|
gift_card: gift_card,
|
||||||
|
student: student,
|
||||||
|
teacher: teacher)
|
||||||
user
|
user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue