VRFS-1577

This commit is contained in:
Jonathan Kolyer 2014-05-01 06:35:16 +00:00
parent b1be072c6c
commit affb1cd875
5 changed files with 28 additions and 28 deletions

View File

@ -111,8 +111,9 @@ module JamRuby
end
def should_rate_session?
2 <= music_session_history.unique_users.count &&
60 < (Time.now - music_session_history.created_at).seconds
(2 <= music_session_history.unique_users.all.count &&
60 < (Time.now - music_session_history.created_at).seconds) ||
Rails.env.development?
end
end

View File

@ -293,6 +293,7 @@
GA.trackFTUECompletion = trackFTUECompletion;
GA.trackSessionCount = trackSessionCount;
GA.trackSessionMusicians = trackSessionMusicians;
GA.trackSessionQuality = trackSessionQuality;
GA.trackServiceInvitations = trackServiceInvitations;
GA.trackFindSessions = trackFindSessions;
GA.virtualPageView = virtualPageView;

View File

@ -3,7 +3,7 @@
"use strict";
context.JK = context.JK || {};
context.JK.RateSessionDialog = function(app, finishedCallback) {
context.JK.RateSessionDialog = function(app) {
var logger = context.JK.logger;
var dialogId = 'rate-session-dialog';
var $scopeSelector = "[layout-id='rate-session-dialog']";
@ -16,24 +16,24 @@
function showDialog() {
if (context.JK.JamServer.clientID) {
// $.ajax({
// type: "/api/participant_histories/"+context.JK.JamServer.clientID,
// url: url,
// data: { rating: getRating(), comment: getComment() }
// }).done(function (response) {
// });
reset();
app.layout.showDialog(dialogId);
return true; // false if should not show dialog
$.ajax({
type: "GET",
url: "/api/participant_histories/"+context.JK.JamServer.clientID
}).done(function (response) {
if (response &&
response.hasOwnProperty('should_rate_session') &&
true==response['should_rate_session']) {
reset();
app.layout.showDialog(dialogId);
}
});
return true;
}
return false;
}
function closeDialog() {
app.layout.closeDialog(dialogId);
if (finishedCallback) {
setTimeout(finishedCallback, 10);
}
}
function getRating() {

View File

@ -1306,25 +1306,24 @@
}
}
function sessionLeave(evt) {
evt.preventDefault();
rateSession();
return false;
}
function bailOut() {
promptLeave = false;
context.window.location = '/client#/home';
}
function sessionLeave(evt) {
evt.preventDefault();
rateSession();
bailOut();
return false;
}
function rateSession() {
if (rateSessionDialog === null) {
rateSessionDialog = new context.JK.RateSessionDialog(context.JK.app, bailOut);
rateSessionDialog = new context.JK.RateSessionDialog(context.JK.app);
rateSessionDialog.initialize();
}
if (rateSessionDialog.showDialog() === false) {
bailOut();
}
rateSessionDialog.showDialog();
return true;
}

View File

@ -166,10 +166,9 @@ class ApiMusicSessionsController < ApiController
uu.save
end if uu
render :json => {}, :status => :ok
elsif request.get?
render :json => { :should_rate_session => @history.should_rate_session? }, :status => :ok
end
elsif request.get?
render :json => { :should_rate_session => @history.should_rate_session? }, :status => :ok
end
else
render :json => { :message => ValidationMessages::SESSION_NOT_FOUND }, :status => 404