Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop
This commit is contained in:
commit
686a0980e6
|
|
@ -102,15 +102,15 @@ module JamRuby
|
|||
errors.add(:music_session, ValidationMessages::CANT_JOIN_RECORDING_SESSION)
|
||||
end
|
||||
|
||||
unless user.admin?
|
||||
num_sessions = Connection.where(:user_id => user_id)
|
||||
.where(["(music_session_id IS NOT NULL) AND (aasm_state != ?)",EXPIRED_STATE.to_s])
|
||||
.count
|
||||
if 0 < num_sessions
|
||||
errors.add(:music_session, ValidationMessages::CANT_JOIN_MULTIPLE_SESSIONS)
|
||||
return false;
|
||||
end
|
||||
end
|
||||
# unless user.admin?
|
||||
# num_sessions = Connection.where(:user_id => user_id)
|
||||
# .where(["(music_session_id IS NOT NULL) AND (aasm_state != ?)",EXPIRED_STATE.to_s])
|
||||
# .count
|
||||
# if 0 < num_sessions
|
||||
# errors.add(:music_session, ValidationMessages::CANT_JOIN_MULTIPLE_SESSIONS)
|
||||
# return false;
|
||||
# end
|
||||
# end
|
||||
|
||||
return true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -34,8 +34,10 @@ class JamRuby::Promotional < ActiveRecord::Base
|
|||
aasm_state
|
||||
end
|
||||
|
||||
def self.active_promotionals
|
||||
self.where(:aasm_state => ACTIVE_STATE).limit(100)
|
||||
def self.active(max_count=100)
|
||||
rel = self.where(:aasm_state => ACTIVE_STATE)
|
||||
rel = rel.limit(mc) if 0 < (mc = max_count.to_i)
|
||||
rel
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -426,6 +426,7 @@ describe ConnectionManager do
|
|||
end
|
||||
|
||||
it "join_music_session fails if user has music_session already active" do
|
||||
pending
|
||||
user_id = create_user("test", "user11", "user11@jamkazam.com")
|
||||
|
||||
user = User.find(user_id)
|
||||
|
|
|
|||
Loading…
Reference in New Issue