Merge branch 'develop' of bitbucket.org:jamkazam/jam-cloud into develop
This commit is contained in:
commit
6ad844035d
|
|
@ -5,6 +5,8 @@ module JamRuby
|
|||
|
||||
self.primary_key = 'id'
|
||||
|
||||
default_scope order('user_id ASC')
|
||||
|
||||
attr_accessible :max_concurrent_connections, :session_removed_at, :rating
|
||||
validates_inclusion_of :rating, :in => -1..1, :allow_nil => true
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// this is replicated in recording.rb model
|
||||
var t = {};
|
||||
t.instrument_ids = []
|
||||
t.instrument_ids = [];
|
||||
$.each(recordedTracks, function(index, track) {
|
||||
if (index > 0) {
|
||||
if (recordedTracks[index-1].user.id !== recordedTracks[index].user.id) {
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
tracks.push(t);
|
||||
}
|
||||
else {
|
||||
if ($.inArray(track.instrument_id, t.instrument_ids)) {
|
||||
if ($.inArray(track.instrument_id, t.instrument_ids) === -1) {
|
||||
t.instrument_ids.push(track.instrument_id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,35 @@
|
|||
var rest = context.JK.Rest();
|
||||
var hoverSelector = "#session-hover";
|
||||
|
||||
// assumes users are sorted by
|
||||
function deDupUsers(users) {
|
||||
var deDupedUsers = [];
|
||||
|
||||
var u = {};
|
||||
|
||||
$.each(users, function(index, user) {
|
||||
if (index > 0) {
|
||||
// new user
|
||||
if (users[index-1].user_id !== users[index].user_id) {
|
||||
u = {};
|
||||
u.instruments = user.instruments;
|
||||
u.user = user.user;
|
||||
deDupedUsers.push(u);
|
||||
}
|
||||
else {
|
||||
u.instruments += "|" + user.instruments;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u.instruments = user.instruments;
|
||||
u.user = user.user;
|
||||
deDupedUsers.push(u);
|
||||
}
|
||||
});
|
||||
|
||||
return deDupedUsers;
|
||||
}
|
||||
|
||||
this.showBubble = function($hoverElement) {
|
||||
|
||||
return rest.getSessionHistory(sessionId)
|
||||
|
|
@ -16,7 +45,9 @@
|
|||
|
||||
// musicians
|
||||
var musicianHtml = '';
|
||||
$.each(response.users, function(index, val) {
|
||||
var deDupedUsers = deDupUsers(response.users);
|
||||
|
||||
$.each(deDupedUsers, function(index, val) {
|
||||
var instrumentHtml = '';
|
||||
|
||||
musicianHtml += '<tr><td width="50"><a href="#" class="avatar-tiny"><img src="' + context.JK.resolveAvatarUrl(val.user.photo_url) + '" /></a></td>';
|
||||
|
|
@ -24,7 +55,15 @@
|
|||
|
||||
instrumentHtml = '<td><div class="nowrap">';
|
||||
var instruments = val.instruments.split("|");
|
||||
var deDupedInstruments = [];
|
||||
|
||||
$.each(instruments, function(index, instrument) {
|
||||
if ($.inArray(instrument, deDupedInstruments) === -1) {
|
||||
deDupedInstruments.push(instrument);
|
||||
}
|
||||
});
|
||||
|
||||
$.each(deDupedInstruments, function(index, instrument) {
|
||||
instrumentHtml += '<img src="' + context.JK.getInstrumentIcon24(instrument) + '" title="' + context.JK.getInstrumentId(instrument) + '" width="24" height="24" /> ';
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@ else
|
|||
pretty_scheduled_start(session, false)
|
||||
end
|
||||
|
||||
|
||||
|
||||
child(:creator => :creator) {
|
||||
attributes :id, :name, :photo_url
|
||||
}
|
||||
|
|
@ -62,10 +60,10 @@ else
|
|||
}
|
||||
|
||||
child(:music_session_user_histories => :users) {
|
||||
attributes :instruments
|
||||
attributes :instruments, :user_id
|
||||
|
||||
child(:user => :user) {
|
||||
attributes :name, :photo_url
|
||||
attributes :id, :name, :photo_url
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,134 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "RSVP Dialogs", :js => true, :type => :feature, :capybara_feature => true do
|
||||
|
||||
subject { page }
|
||||
|
||||
let (:user) {FactoryGirl.create(:user)}
|
||||
let (:rsvp_requester) {FactoryGirl.create(:user)}
|
||||
let (:session) {FactoryGirl.create(:music_session, :creator => user, :scheduled_start => Time.now + 2.hours)}
|
||||
let (:unstructured_rsvp_session) {FactoryGirl.create(:music_session, :creator => user, :is_unstructured_rsvp => true)}
|
||||
|
||||
def create_slots(slots = [])
|
||||
end
|
||||
|
||||
def create_rsvp_requests(requests = [])
|
||||
end
|
||||
|
||||
# set up users, session, RSVP request data
|
||||
before(:each) do
|
||||
RsvpRequestRsvpSlot.delete_all
|
||||
RsvpRequest.delete_all
|
||||
RsvpSlot.delete_all
|
||||
|
||||
fast_signin(user, Nav.find_session)
|
||||
end
|
||||
|
||||
describe "RSVP submission" do
|
||||
|
||||
it "should show session info" do
|
||||
|
||||
end
|
||||
|
||||
it "should show only open slots for structured RSVP session" do
|
||||
|
||||
end
|
||||
|
||||
it "should show a single Play Any Instrument You Like slot for unstructured RSVP session" do
|
||||
|
||||
end
|
||||
|
||||
it "should allow a comment to be entered" do
|
||||
|
||||
end
|
||||
|
||||
it "should have Help, Cancel, and Submit RSVP buttons" do
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe "RSVP cancellation" do
|
||||
|
||||
it "should show session info" do
|
||||
|
||||
end
|
||||
|
||||
it "should have 2 cancellation options" do
|
||||
|
||||
end
|
||||
|
||||
it "should have Help, Cancel, and Cancel RSVP buttons" do
|
||||
|
||||
end
|
||||
|
||||
it "should show Recurs once... text for recurring session" do
|
||||
|
||||
end
|
||||
|
||||
it "should suppress Recurs once... text for non-recurring session" do
|
||||
|
||||
end
|
||||
|
||||
it "should allow cancellation of just this session" do
|
||||
|
||||
end
|
||||
|
||||
it "should allow cancellation of all future sessions" do
|
||||
|
||||
end
|
||||
|
||||
it "should allow a comment to be entered" do
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
describe "RSVP slot creation" do
|
||||
|
||||
it "should prompt user when no open slots remain for structured RSVP session" do
|
||||
# create 2 slots - acoustic guitar and drums
|
||||
|
||||
# create 2 RSVP to acoustic guitar, create 2 RSVP to drums
|
||||
|
||||
# navigate to Session Details screen and approve 1 RSVP for each slot
|
||||
|
||||
# confirm music_session.open_slots.count == 0
|
||||
|
||||
# attempt to approve
|
||||
|
||||
end
|
||||
|
||||
it "should prompt user when no open slots remain for relevant instrument for structured RSVP session" do
|
||||
|
||||
# create 2 slots - acoustic guitar and drums
|
||||
|
||||
# create 2 RSVPs to acoustic guitar, create 1 RSVP to drums
|
||||
|
||||
# confirm music_session.open_slots.count == 2
|
||||
|
||||
# navigate to Session Details screen and approve first RSVP
|
||||
|
||||
# confirm music_session.open_slots.count == 1
|
||||
|
||||
# attempt to approve second RSVP - confirm dialog pops up
|
||||
|
||||
# click No - confirm dialog closes
|
||||
|
||||
# attempt to approve drums - confirm RSVP is approved without dialog
|
||||
|
||||
# attempt to approve acoustic guitar again - confirm dialog pops
|
||||
|
||||
# click Yes - confirm new slot is created for acoustic guitar, RSVP is tied to new slot and approved, and dialog closes
|
||||
|
||||
# confirm music_session.open_slots.count == 0
|
||||
|
||||
end
|
||||
|
||||
it "should not prompt user to create slot for unstructured RSVP session" do
|
||||
# submit 2 RSVP requests
|
||||
|
||||
# navigate to Session Details screen and approve both RSVPs, confirming the slot dialog does not pop up for either
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Reference in New Issue