VRFS-1812 added latency indicators to the session info page
This commit is contained in:
parent
5694e19eff
commit
287faa765c
|
|
@ -334,6 +334,7 @@ module JamRuby
|
|||
# same, sorted by score. date seems irrelevant as these are active sessions. ams_init must be called
|
||||
# first.
|
||||
def self.ams_query(current_user, options = {})
|
||||
session_id = options[:session_id]
|
||||
client_id = options[:client_id]
|
||||
genre = options[:genre]
|
||||
lang = options[:lang]
|
||||
|
|
@ -392,6 +393,7 @@ module JamRuby
|
|||
query = query.limit(limit)
|
||||
query = query.where("music_sessions.genre_id = ?", genre) unless genre.blank?
|
||||
query = query.where('music_sessions.language = ?', lang) unless lang.blank?
|
||||
query = query.where('music_sessions.id = ?', session_id) unless session_id.blank?
|
||||
query = query.where("(description_tsv @@ to_tsquery('jamenglish', ?))", keyword + ':*') unless keyword.blank?
|
||||
|
||||
if !day.blank? && !timezone_offset.blank?
|
||||
|
|
|
|||
|
|
@ -586,6 +586,7 @@ module JamRuby
|
|||
# same, sorted by score. date seems irrelevant as these are active sessions. sms_init must be called
|
||||
# first.
|
||||
def self.sms_query(current_user, options = {})
|
||||
session_id = options[:session_id]
|
||||
client_id = options[:client_id]
|
||||
genre = options[:genre]
|
||||
lang = options[:lang]
|
||||
|
|
@ -644,6 +645,7 @@ module JamRuby
|
|||
query = query.limit(limit)
|
||||
query = query.where("music_sessions.genre_id = ?", genre) unless genre.blank?
|
||||
query = query.where('music_sessions.language = ?', lang) unless lang.blank?
|
||||
query = query.where('music_sessions.id = ?', session_id) unless session_id.blank?
|
||||
query = query.where("(description_tsv @@ to_tsquery('jamenglish', ?))", keyword + ':*') unless keyword.blank?
|
||||
|
||||
if !day.blank? && !timezone_offset.blank?
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@
|
|||
var showRsvpLink = true;
|
||||
|
||||
var LATENCY = {
|
||||
GOOD : {description: "GOOD", style: "latency-green", min: 0.0, max: 20.0},
|
||||
MEDIUM : {description: "MEDIUM", style: "latency-yellow", min: 20.0, max: 40.0},
|
||||
POOR : {description: "POOR", style: "latency-red", min: 40.0, max: 10000000000.0},
|
||||
UNREACHABLE: {description: "UNREACHABLE", style: "latency-grey", min: -1, max: -1},
|
||||
UNKNOWN: {description: "UNKNOWN", style: "latency-grey", min: -2, max: -2}
|
||||
GOOD : {description: "GOOD", style: "latency-green", min: 0.0, max: 20.0},
|
||||
MEDIUM : {description: "MEDIUM", style: "latency-yellow", min: 20.0, max: 40.0},
|
||||
POOR : {description: "POOR", style: "latency-red", min: 40.0, max: 10000000000.0},
|
||||
UNREACHABLE: {description: "UNREACHABLE", style: "latency-grey", min: -1, max: -1},
|
||||
UNKNOWN: {description: "UNKNOWN", style: "latency-grey", min: -2, max: -2}
|
||||
};
|
||||
|
||||
var instrument_logo_map = context.JK.getInstrumentIconMap24();
|
||||
|
|
|
|||
|
|
@ -10,8 +10,15 @@
|
|||
var ui = new context.JK.UIHelper(app);
|
||||
var $btnAction = $("#btn-action");
|
||||
|
||||
var LATENCY = {
|
||||
GOOD : {description: "GOOD", style: "latency-green", min: 0.0, max: 20.0},
|
||||
MEDIUM : {description: "MEDIUM", style: "latency-yellow", min: 20.0, max: 40.0},
|
||||
POOR : {description: "POOR", style: "latency-red", min: 40.0, max: 10000000000.0},
|
||||
UNREACHABLE: {description: "UNREACHABLE", style: "latency-grey", min: -1, max: -1},
|
||||
UNKNOWN: {description: "UNKNOWN", style: "latency-grey", min: -2, max: -2}
|
||||
};
|
||||
|
||||
function addComment(musicSessionId) {
|
||||
console.log("here");
|
||||
var comment = $("#txtSessionInfoComment").val();
|
||||
if ($.trim(comment).length > 0) {
|
||||
rest.addSessionInfoComment(musicSessionId, comment)
|
||||
|
|
|
|||
|
|
@ -1,23 +1,54 @@
|
|||
/*.session-controls {
|
||||
background-color:#471f18;
|
||||
}
|
||||
|
||||
.session-controls.inprogress {
|
||||
background-color:#4C742E;
|
||||
}
|
||||
|
||||
.session-status-ended, .session-status {
|
||||
float:left;
|
||||
font-size:18px;
|
||||
}
|
||||
|
||||
.session-status-inprogress {
|
||||
float:left;
|
||||
font-size:15px;
|
||||
color:#cccc00;
|
||||
margin-left:20px;
|
||||
}*/
|
||||
|
||||
#btnPlayPause {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
table.musicians {
|
||||
margin-top:-3px;
|
||||
}
|
||||
|
||||
table.musicians td {
|
||||
border-right:none;
|
||||
border-top:none;
|
||||
padding:2px;
|
||||
vertical-align:middle !important;
|
||||
}
|
||||
|
||||
.latency-grey {
|
||||
width: 50px;
|
||||
height: 10px;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
font-weight:200;
|
||||
font-size:11px;
|
||||
background-color:#868686;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.latency-green {
|
||||
width: 50px;
|
||||
height: 10px;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
font-weight:200;
|
||||
font-size:11px;
|
||||
background-color:#71a43b;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.latency-yellow {
|
||||
width: 50px;
|
||||
height: 10px;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
font-weight:200;
|
||||
font-size:11px;
|
||||
background-color:#cc9900;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.latency-red {
|
||||
width: 40px;
|
||||
height: 10px;
|
||||
font-family:Arial, Helvetica, sans-serif;
|
||||
font-weight:200;
|
||||
font-size:11px;
|
||||
background-color:#980006;
|
||||
text-align:center;
|
||||
}
|
||||
|
|
@ -82,7 +82,6 @@ class ApiMusicSessionsController < ApiController
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
def scheduled
|
||||
@music_sessions = MusicSession.scheduled(current_user)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -47,9 +47,15 @@ class MusicSessionsController < ApplicationController
|
|||
|
||||
# run these 3 queries only if the user has access to the page
|
||||
if @can_view
|
||||
@approved_rsvps = @music_session.approved_rsvps
|
||||
@open_slots = @music_session.open_slots
|
||||
@pending_invitations = @music_session.pending_invitations
|
||||
ActiveRecord::Base.transaction do
|
||||
@music_sessions, @user_scores = MusicSession.sms_index(current_user, {:session_id => params[:id], :client_id => cookies[:client_id]})
|
||||
unless @music_sessions.blank?
|
||||
ms = @music_sessions[0]
|
||||
@approved_rsvps = ms.approved_rsvps
|
||||
@open_slots = ms.open_slots
|
||||
@pending_invitations = ms.pending_invitations
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
render :layout => "web"
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@ else
|
|||
[item.genre.description] # XXX: need to return single genre; not array
|
||||
end
|
||||
|
||||
|
||||
|
||||
child(:music_notations => :music_notations) {
|
||||
attributes :id, :file_name
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
%strong Notation Files:
|
||||
.right.w75.ib.mb10.notations
|
||||
- @music_session.music_notations.each do |n|
|
||||
%a.gold{:href => n.file_url}= n.file_name
|
||||
%a.gold{:href => n.file_url, :target => "_blank"}= n.file_name
|
||||
.clearall.left.w20.ib.mb10
|
||||
%strong Language:
|
||||
.right.w75.ib.mb10.language
|
||||
|
|
@ -61,7 +61,7 @@
|
|||
%a.gold{:href => "#{@music_session.legal_policy_url}", :target => "_blank"} View full legal details
|
||||
)
|
||||
|
||||
%br{clear:'all'}
|
||||
%br{clear:'all'}/
|
||||
|
||||
.landing-sidebar
|
||||
%br/
|
||||
|
|
@ -69,11 +69,11 @@
|
|||
%br/
|
||||
.left.w65.ib
|
||||
%strong RSVPs
|
||||
.right.w30.ib.f11.center Your latency
|
||||
.right.w30.ib.f11 Your latency
|
||||
- if @approved_rsvps.blank?
|
||||
None
|
||||
- @approved_rsvps.each_with_index do |rsvp, index|
|
||||
.clearall.left.w65.h20.ib.mb10.rsvp-details
|
||||
.clearall.left.w100.h20.ib.mb10.rsvp-details
|
||||
.avatar-tiny{'hoveraction' => "musician", 'user-id' => rsvp.id}
|
||||
- if rsvp.photo_url.nil?
|
||||
= image_tag 'shared/avatar_generic.png', :alt => ""
|
||||
|
|
@ -84,13 +84,35 @@
|
|||
.left.ml10
|
||||
- rsvp.instrument_list.each do |i|
|
||||
%img.instrument-icon{'instrument-id' => i[:id], height:24, width:24}
|
||||
|
||||
.right.w30.ib.f11.center
|
||||
- if current_user.id == rsvp.id
|
||||
%table.musicians{:cellpadding => 0, :cellspacing => 0}
|
||||
%tr.mb15
|
||||
%td.latency-green GOOD
|
||||
- elsif !@user_scores[rsvp.id]
|
||||
%table.musicians{:cellpadding => 0, :cellspacing => 0}
|
||||
%tr.mb15
|
||||
%td.latency-grey UNKNOWN
|
||||
- else
|
||||
- if @user_scores[rsvp.id] >= 0 && @user_scores[rsvp.id] <= 20.0
|
||||
%table.musicians{:cellpadding => 0, :cellspacing => 0}
|
||||
%tr.mb15
|
||||
%td.latency-green GOOD
|
||||
- if @user_scores[rsvp.id] > 20.0 && @user_scores[rsvp.id] <= 40.0
|
||||
%table.musicians{:cellpadding => 0, :cellspacing => 0}
|
||||
%tr.mb15
|
||||
%td.latency-yellow MEDIUM
|
||||
- if @user_scores[rsvp.id] > 40.0
|
||||
%table.musicians{:cellpadding => 0, :cellspacing => 0}
|
||||
%tr.mb15
|
||||
%td.latency-red POOR
|
||||
|
||||
%br{:clear => "all"}/
|
||||
%br/
|
||||
.left.w65.ib.still-needed
|
||||
%strong Still Needed
|
||||
- if @open_slots.blank?
|
||||
.clearall.left.w65.h20.ib.mb10
|
||||
.clearall.left.w100.h20.ib.mb10
|
||||
All slots are taken
|
||||
- else
|
||||
- @open_slots.each do |slot|
|
||||
|
|
@ -141,4 +163,3 @@
|
|||
var ss = new window.JK.ShowSessionInfo(JK.app);
|
||||
ss.initialize("#{@music_session.id}");
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue