fix type error

This commit is contained in:
Bert Owen 2014-06-09 10:43:07 +08:00
parent 60a004a252
commit f333f110b8
3 changed files with 54 additions and 58 deletions

View File

@ -319,27 +319,40 @@ module JamRuby
end
end
def timezone_description
tz = nil
if timezone.blank?
tz = ActiveSupport::TimeZone["Central Time (US & Canada)"]
self.timezone = tz.name + ',' + tz.tzinfo.name
else
tz = ActiveSupport::TimeZone[self.timezone.split(',')[0]]
end
tz.to_s
end
def musician_access_description
if self.musician_access && self.approval_required
"Musicians may join by approval"
elsif self.musician_access && !self.approval_required
"Musicians may join at will"
elsif !self.musician_access && !self.approval_required
"Only RSVP musicians may join"
end
end
def fan_access_description
if self.fan_access && self.fan_chat
"Fans may listen, chat with the band"
elsif self.fan_access && !self.fan_chat
"Fans may listen, chat with each other"
elsif !self.fan_access && !self.fan_chat
"Fans may not listen to session"
end
end
def access_description
musician_access_desc = ""
fan_access_desc = ""
if self.musician_access
if self.approval_required
musician_access_desc = "Interested musicians may join by approval"
else
musician_access_desc = "Interested musicians may join at will"
end
end
if self.fan_access
fan_access_desc = "Fans may listen"
end
if self.fan_chat
fan_access_desc = "#{fan_access_desc}, chat with each other"
end
return "#{musician_access_desc}. #{fan_access_desc}."
return "#{musician_access_description}. #{fan_access_description}."
end
# next 3 methods are used for the right sidebar on the session info page

View File

@ -221,20 +221,18 @@
var session = scheduledSessions[createSessionSettings.selectedSessionId];
createSessionSettings.startDate = new Date(session.scheduled_start).toDateString();
createSessionSettings.startTime = getFormattedTime(new Date(session.scheduled_start), false);
createSessionSettings.genresValues = ['Pop'];
createSessionSettings.genres = ['pop'];
createSessionSettings.timezone.label = "(GMT-06:00) Central Time (US & Canada)";
createSessionSettings.timezone.value = "Central Time (US & Canada),America/Chicago";
createSessionSettings.name = "Private Test Session";
createSessionSettings.description = "Private session set up just to test things out in the session interface by myself.";
createSessionSettings.notations = [];
createSessionSettings.language.label = 'English';
createSessionSettings.language.value = 'en';
createSessionSettings.session_policy = 'Standard';
createSessionSettings.musician_access.label = "Only RSVP musicians may join";
createSessionSettings.musician_access.value = "only-rsvp";
createSessionSettings.fans_access.label = "Fans may not listen to session";
createSessionSettings.fans_access.value = "no-listen-chat";
createSessionSettings.genresValues = [session.genre.description];
createSessionSettings.genres = [session.genre_id];
createSessionSettings.timezone.label = session.timezone_description;
createSessionSettings.timezone.value = session.timezone;
createSessionSettings.name = session.name;
createSessionSettings.description = session.description;
createSessionSettings.notations = session.music_notations;
createSessionSettings.language.label = session.language_description;
createSessionSettings.language.value = session.language;
createSessionSettings.session_policy = session.legal_policy;
createSessionSettings.musician_access.label = session.musician_access_description;
createSessionSettings.fans_access.label = session.fan_access_description;
}
else if (createSessionSettings.createType == 'quick-start') {
createSessionSettings.genresValues = ['Pop'];
@ -354,7 +352,7 @@
data.name = createSessionSettings.name;
data.description = createSessionSettings.description;
data.genres = createSessionSettings.genres;
if (createSessionSettings.musician_access.value == 'only_rsvp') {
if (createSessionSettings.musician_access.value == 'only-rsvp') {
data.musician_access = false;
data.approval_required = false;
}
@ -400,33 +398,12 @@
}
var joinSession = function(sessionId) {
// var options = {};
// options.client_id = app.clientId;
// options.session_id = sessionId;
// options.as_musician = true;
// options.tracks = tracks;
// rest.joinSession(options)
// .done(function(response) {
var invitationCount = data.invitations.length;
context.location = '/client#/session/' + sessionId;
context.JK.GA.trackSessionCount(data.musician_access, data.fan_access, invitationCount);
context.JK.GA.trackSessionMusicians(context.JK.GA.SessionCreationTypes.create);
// })
// .fail(function(jqXHR) {
// var handled = false;
// if(jqXHR.status = 422) {
// var response = JSON.parse(jqXHR.responseText);
// if(response["errors"] && response["errors"]["tracks"] && response["errors"]["tracks"][0] == "Please select at least one track") {
// app.notifyAlert("No Inputs Configured", $('<span>You will need to reconfigure your audio device.</span>'));
// handled = true;
// }
// }
// if(!handled) {
// app.notifyServerError(jqXHR, "Unable to Create Session");
// }
// })
};
if (createSessionSettings.createType == 'start-scheduled') {

View File

@ -17,7 +17,9 @@ if !current_user
else
attributes :id, :music_session_id, :name, :description, :musician_access, :approval_required, :fan_access, :fan_chat,
:band_id, :user_id, :genre_id, :created_at, :like_count, :comment_count, :scheduled_start, :scheduled_duration, :language, :recurring_mode, :language_description, :scheduled_start_time, :access_description
:band_id, :user_id, :genre_id, :created_at, :like_count, :comment_count, :scheduled_start, :scheduled_duration,
:language, :recurring_mode, :language_description, :scheduled_start_time, :access_description, :timezone, :timezone_description,
:musician_access_description, :fan_access_description
node :share_url do |history|
unless history.share_token.nil?
@ -49,6 +51,10 @@ else
}
}
child(:genre => :genre) {
attributes :description
}
child(:session_info_comments => :session_info_comments) {
attributes :comment, :created_at
@ -60,7 +66,7 @@ else
child(:music_notations => :music_notations) {
node do |music_notation|
attributes :id
# note(:filename) { |music_notation| music_notation.filename }
node(:filename) { |music_notation| music_notation.filename }
end
}