VRFS-1577 VRFS-736
This commit is contained in:
parent
5e27268fa4
commit
b1be072c6c
|
|
@ -19,6 +19,11 @@
|
|||
join : "Join"
|
||||
};
|
||||
|
||||
var sessionQualityTypes = {
|
||||
good : "Good",
|
||||
poor : "Poor"
|
||||
};
|
||||
|
||||
var invitationTypes = {
|
||||
email : "Email",
|
||||
facebook : "Facebook",
|
||||
|
|
@ -83,6 +88,7 @@
|
|||
audioTest : "AudioTest",
|
||||
sessionCount : "SessionCount",
|
||||
sessionMusicians : "SessionMusicians",
|
||||
sessionQuality : "SessionQuality",
|
||||
invite : "Invite",
|
||||
findSession : "FindSession",
|
||||
friendConnect : "Connect",
|
||||
|
|
@ -174,6 +180,11 @@
|
|||
context.ga('send', 'event', categories.sessionMusicians, joinOrCreate);
|
||||
}
|
||||
|
||||
function trackSessionQuality(goodOrPoor) {
|
||||
assertOneOf(goodOrPoor, sessionQualityTypes);
|
||||
context.ga('send', 'event', categories.sessionQuality, goodOrPoor);
|
||||
}
|
||||
|
||||
function trackServiceInvitations(invitationType, numInvited) {
|
||||
assertOneOf(invitationType, invitationTypes);
|
||||
assertNumber(numInvited);
|
||||
|
|
@ -271,6 +282,7 @@
|
|||
var GA = {};
|
||||
GA.Categories = categories;
|
||||
GA.SessionCreationTypes = sessionCreationTypes;
|
||||
GA.SessionQualityTypes = sessionQualityTypes;
|
||||
GA.InvitationTypes = invitationTypes;
|
||||
GA.FriendConnectTypes = friendConnectTypes;
|
||||
GA.RecordingActions = recordingActions;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,21 @@
|
|||
var dialogId = 'rate-session-dialog';
|
||||
var $scopeSelector = "[layout-id='rate-session-dialog']";
|
||||
|
||||
function reset() {
|
||||
$('#btn-rate-session-up', $scopeSelector).removeClass('selected');
|
||||
$('#btn-rate-session-down', $scopeSelector).removeClass('selected');
|
||||
$('#txt-rate-session-comment',"[layout-id='rate-session-dialog']").val('');
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
|
@ -49,6 +62,7 @@
|
|||
if ($('#btn-rate-session-down').hasClass('selected')) {
|
||||
$('#btn-rate-session-down').removeClass('selected')
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$('#btn-rate-session-down', $scopeSelector).click(function(evt) {
|
||||
if ($(this).hasClass('selected')) {
|
||||
|
|
@ -59,16 +73,29 @@
|
|||
if ($('#btn-rate-session-up').hasClass('selected')) {
|
||||
$('#btn-rate-session-up').removeClass('selected')
|
||||
}
|
||||
return false;
|
||||
});
|
||||
$('#btn-rate-session-send', $scopeSelector).click(function(evt) {
|
||||
var rr = getRating(), cc = getComment();
|
||||
if (0 == rr && 0 == cc.length) {
|
||||
closeDialog();
|
||||
return false;
|
||||
}
|
||||
var url = "/api/participant_histories/"+context.JK.JamServer.clientID+"/rating";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: { rating: getRating(), comment: getComment() }
|
||||
}).done(function (response) {
|
||||
var qq = getRating();
|
||||
if (0 < qq) {
|
||||
context.JK.GA.trackSessionQuality(context.JK.GA.SessionQualityTypes.good);
|
||||
} else if (0 > qq){
|
||||
context.JK.GA.trackSessionQuality(context.JK.GA.SessionQualityTypes.poor);
|
||||
}
|
||||
closeDialog();
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
var playbackControls = null;
|
||||
var promptLeave = false;
|
||||
var backendMixerAlertThrottleTimer = null;
|
||||
var rateSessionDialog = null;
|
||||
|
||||
var rest = context.JK.Rest();
|
||||
|
||||
|
|
@ -1317,9 +1318,11 @@
|
|||
}
|
||||
|
||||
function rateSession() {
|
||||
var dialog = new context.JK.RateSessionDialog(context.JK.app, bailOut);
|
||||
dialog.initialize();
|
||||
if (dialog.showDialog() === false) {
|
||||
if (rateSessionDialog === null) {
|
||||
rateSessionDialog = new context.JK.RateSessionDialog(context.JK.app, bailOut);
|
||||
rateSessionDialog.initialize();
|
||||
}
|
||||
if (rateSessionDialog.showDialog() === false) {
|
||||
bailOut();
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -152,14 +152,24 @@ class ApiMusicSessionsController < ApiController
|
|||
|
||||
def participant_rating
|
||||
if @history = MusicSessionUserHistory.find_by_client_id(params[:client_id])
|
||||
@history.add_rating(params[:rating], params[:comment])
|
||||
@history.save
|
||||
if request.post?
|
||||
@history.add_rating(params[:rating], params[:comment])
|
||||
@history.save
|
||||
|
||||
if @history.errors.any?
|
||||
response.status = :unprocessable_entity
|
||||
respond_with @history
|
||||
else
|
||||
render :json => {}, :status => :ok
|
||||
if @history.errors.any?
|
||||
response.status = :unprocessable_entity
|
||||
respond_with @history
|
||||
else
|
||||
uu = @history.user
|
||||
if (uu.first_good_music_session_at.nil?)
|
||||
uu.first_good_music_session_at = Time.now
|
||||
uu.save
|
||||
end if uu
|
||||
render :json => {}, :status => :ok
|
||||
|
||||
elsif request.get?
|
||||
render :json => { :should_rate_session => @history.should_rate_session? }, :status => :ok
|
||||
end
|
||||
end
|
||||
else
|
||||
render :json => { :message => ValidationMessages::SESSION_NOT_FOUND }, :status => 404
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
<div class="dialog" layout="dialog" layout-id="rate-session-dialog" id="rate-session-dialog">
|
||||
<div class="dialog-overlay-sm">
|
||||
<!-- dialog header -->
|
||||
<div class="content-head">
|
||||
<img src="images/shared/icon_session.png" width="19" height="19" class="content-icon"><h1>please rate your session</h1>
|
||||
</div>
|
||||
<div class="dialog-inner">
|
||||
<div class="center">
|
||||
<a id="btn-rate-session-up" class="rate-thumbsup" href="javascript:void(0)"></a> <a id="btn-rate-session-down" href="javascript:void(0)" class="rate-thumbsdown"></a>
|
||||
<br clear="left"><br>
|
||||
<textarea id="txt-rate-session-comment" class="w80" rows="3" placeholder="Tell us more about what you liked or didn't like..."></textarea>
|
||||
<br><br>
|
||||
<a id="btn-rate-session-send" href="#" class="button-orange">SEND FEEDBACK</a> <a id="btn-rate-session-cancel" href="#" class="button-grey">NOT NOW, THANKS</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end inner -->
|
||||
<div class="dialog-overlay-sm" layout="dialog" layout-id="rate-session-dialog" id="rate-session-dialog">
|
||||
<!-- dialog header -->
|
||||
<div class="content-head">
|
||||
<%= image_tag "shared/icon_session.png", {:height => 19, :width => 19, :class => "content-icon"} %>
|
||||
<h1>please rate your session</h1>
|
||||
</div>
|
||||
<div class="dialog-inner">
|
||||
<div class="center">
|
||||
<a id="btn-rate-session-up" class="rate-thumbsup" href="#"></a> <a id="btn-rate-session-down" href="#" class="rate-thumbsdown"></a>
|
||||
<br clear="left"><br>
|
||||
<textarea id="txt-rate-session-comment" class="w80" rows="3" placeholder="Tell us more about what you liked or didn't like..."></textarea>
|
||||
<br><br>
|
||||
<a id="btn-rate-session-send" href="#" class="button-orange">SEND FEEDBACK</a> <a id="btn-rate-session-cancel" href="#" class="button-grey">NOT NOW, THANKS</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end inner -->
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ SampleApp::Application.routes.draw do
|
|||
match '/sessions/:id/claimed_recording/:claimed_recording_id/stop' => 'api_music_sessions#claimed_recording_stop', :via => :post
|
||||
|
||||
match '/participant_histories/:client_id/rating' => 'api_music_sessions#participant_rating', :via => :post
|
||||
match '/participant_histories/:client_id' => 'api_music_sessions#participant_rating', :via => :get
|
||||
|
||||
# genres
|
||||
match '/genres' => 'api_genres#index', :via => :get
|
||||
|
|
|
|||
Loading…
Reference in New Issue