diff --git a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/scheduled_session_daily.html.erb b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/scheduled_session_daily.html.erb
index a7f70124b..441e031d8 100644
--- a/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/scheduled_session_daily.html.erb
+++ b/ruby/lib/jam_ruby/app/views/jam_ruby/user_mailer/scheduled_session_daily.html.erb
@@ -74,7 +74,7 @@
<%= (sess.latency / 2).round %> ms
- <% if sess.latency <= (APP_CONFIG.max_good_full_score * 2) %>
+ <% if sess.latency <= (APP_CONFIG.max_good_full_score) %>
<%= image_tag("http://www.jamkazam.com/assets/content/icon_green_score.png", alt: 'good score icon') %>
<% else %>
<%= image_tag("http://www.jamkazam.com/assets/content/icon_yellow_score.png", alt: 'fair score icon') %>
diff --git a/ruby/lib/jam_ruby/models/search.rb b/ruby/lib/jam_ruby/models/search.rb
index cdfd3e1fb..311341e23 100644
--- a/ruby/lib/jam_ruby/models/search.rb
+++ b/ruby/lib/jam_ruby/models/search.rb
@@ -225,8 +225,8 @@ module JamRuby
rel = rel.where(['current_scores.full_score > ?', score_min]) unless score_min.nil?
rel = rel.where(['current_scores.full_score <= ?', score_max]) unless score_max.nil?
- rel = rel.select('current_scores.full_score, current_scores.score, round(current_scores.a_audio_latency) as audio_latency, regions.regionname')
- rel = rel.group('current_scores.full_score, current_scores.score, current_scores.a_audio_latency, regions.regionname')
+ rel = rel.select('current_scores.full_score, current_scores.score, regions.regionname')
+ rel = rel.group('current_scores.full_score, current_scores.score, regions.regionname')
end
ordering = self.order_param(params)
diff --git a/ruby/spec/support/utilities.rb b/ruby/spec/support/utilities.rb
index b9db7f8ac..a16514c77 100644
--- a/ruby/spec/support/utilities.rb
+++ b/ruby/spec/support/utilities.rb
@@ -111,15 +111,15 @@ def app_config
end
def max_good_full_score
- 20
+ 40
end
def max_yellow_full_score
- 35
+ 70
end
def max_red_full_score
- 50
+ 100
end
private
diff --git a/web/app/assets/javascripts/accounts_session_detail.js b/web/app/assets/javascripts/accounts_session_detail.js
index e5062eb54..35b79b62b 100644
--- a/web/app/assets/javascripts/accounts_session_detail.js
+++ b/web/app/assets/javascripts/accounts_session_detail.js
@@ -138,14 +138,18 @@
.done(function(rsvpResponse) {
rsvpData = rsvpResponse;
- renderSession();
+
+ app.user()
+ .done(function(userMe) {
+ renderSession(userMe);
+ })
})
.fail(app.ajaxError);
})
.fail(app.ajaxError);
}
- function renderSession() {
+ function renderSession(userMe) {
var hasPending = false;
var isOwner = false;
if (sessionData.user_id == context.JK.currentUserId) {
@@ -211,12 +215,9 @@
var audio_latency = $latencyBadge.attr('data-audio-latency') || null;
var latencyBadgeUserId = $latencyBadge.attr('data-user-id');
var scoreOptions = {offsetParent: $offsetParent};
- app.user()
- .done(function(userMe) {
- helpBubble.scoreBreakdown($latencyBadge, context.JK.currentUserId == latencyBadgeUserId, full_score, userMe.last_jam_audio_latency, audio_latency, internet_score, scoreOptions);
- })
- });
+ helpBubble.scoreBreakdown($latencyBadge, context.JK.currentUserId == latencyBadgeUserId, full_score, userMe.last_jam_audio_latency, audio_latency, internet_score, scoreOptions);
+ });
$sessionDetail.html($template);
diff --git a/web/app/assets/javascripts/findMusician.js b/web/app/assets/javascripts/findMusician.js
index 77b9600b6..79c50d256 100644
--- a/web/app/assets/javascripts/findMusician.js
+++ b/web/app/assets/javascripts/findMusician.js
@@ -14,6 +14,7 @@
var textMessageDialog = null;
var $results = null;
var helpBubble = context.JK.HelpBubbleHelper;
+ var sessionUtils = context.JK.SessionUtils;
function loadMusicians(queryString) {
// squelch nulls and undefines
@@ -86,23 +87,6 @@
return Math.round(score / 2) + " ms";
}
- function score_to_color(score) {
- // these are raw scores as reported by client (round trip times)
- if (score == null) return "purple";
- if (0 < score && score <= 40) return "green";
- if (40 < score && score <= 70) return "yellow";
- if (70 < score && score <= 100) return "red";
- return "blue";
- }
-
- function score_to_color_alt(score) {
- // these are raw scores as reported by client (round trip times)
- if (score == null) return "missing";
- if (0 < score && score <= 40) return "good";
- if (40 < score && score <= 70) return "moderate";
- if (70 < score && score <= 100) return "poor";
- return "unacceptable";
- }
function formatLocation(musician) {
if(musician.city && musician.state) {
@@ -168,6 +152,8 @@
var musician_actions = context.JK.fillTemplate(aTemplate, actionVals);
var full_score = musician['full_score'];
+
+ var scoreInfo = sessionUtils.scoreInfo(full_score, false)
mVals = {
avatar_url: context.JK.resolveAvatarUrl(musician.photo_url),
profile_url: "/client#/profile/" + musician.id,
@@ -183,9 +169,9 @@
musician_follow_template: follows,
musician_action_template: musician_actions,
musician_one_way_score: score_to_text(full_score),
- musician_score_color: score_to_color(full_score),
- musician_score_color_alt: score_to_color_alt(full_score)
-
+ musician_score_color: scoreInfo.icon_name,
+ musician_score_color_alt: scoreInfo.description,
+ latency_style: scoreInfo.latency_style
};
var $rendering = $(context.JK.fillTemplate(mTemplate, mVals))
diff --git a/web/app/assets/javascripts/session_utils.js b/web/app/assets/javascripts/session_utils.js
index d6bd40591..19754a981 100644
--- a/web/app/assets/javascripts/session_utils.js
+++ b/web/app/assets/javascripts/session_utils.js
@@ -12,7 +12,8 @@
var logger = context.JK.logger;
- var LATENCY = {
+
+ var LATENCY = sessionUtils.LATENCY = {
ME : {description: "ME", style: "latency-me", min: -1, max: -1},
GOOD : {description: "GOOD", style: "latency-good", min: 0.0, max: 40.0},
MEDIUM : {description: "FAIR", style: "latency-fair", min: 40.0, max: 70.0},
@@ -62,44 +63,58 @@
}
}
- sessionUtils.createLatency = function(user) {
-
- var latencyStyle;
+ sessionUtils.scoreInfo = function(full_score, isSameUser) {
var latencyDescription;
+ var latencyStyle;
+ var iconName;
+ var description;
- if (user.id === context.JK.currentUserId) {
- latencyStyle = LATENCY.ME.style, latencyDescription = LATENCY.ME.description;
+ if(isSameUser) {
+ latencyDescription = LATENCY.ME.description;
+ latencyStyle = LATENCY.ME.style;
+ iconName = 'purple';
+ description = 'me';
+ }
+ else if (!full_score) {
+ latencyDescription = LATENCY.UNKNOWN.description;
+ latencyStyle = LATENCY.UNKNOWN.style;
+ iconName = 'purple'
+ description = 'missing'
+ }
+ else if (full_score <= LATENCY.GOOD.max) {
+ latencyDescription = LATENCY.GOOD.description;
+ latencyStyle = LATENCY.GOOD.style;
+ iconName = 'green'
+ description = 'good'
+ }
+ else if (full_score <= LATENCY.MEDIUM.max) {
+ latencyDescription = LATENCY.MEDIUM.description;
+ latencyStyle = LATENCY.MEDIUM.style;
+ iconName = 'yellow';
+ description = 'fair'
+ }
+ else if (full_score <= LATENCY.POOR.max) {
+ latencyDescription = LATENCY.POOR.description;
+ latencyStyle = LATENCY.POOR.style;
+ iconName = 'red'
+ description = 'poor'
}
-
else {
- var latency = user.full_score;
-
- if (!latency) {
- latencyDescription = LATENCY.UNKNOWN.description;
- latencyStyle = LATENCY.UNKNOWN.style;
- }
- else if (latency <= LATENCY.GOOD.max) {
- latencyDescription = LATENCY.GOOD.description;
- latencyStyle = LATENCY.GOOD.style;
- }
- else if (latency > LATENCY.MEDIUM.min && latency <= LATENCY.MEDIUM.max) {
- latencyDescription = LATENCY.MEDIUM.description;
- latencyStyle = LATENCY.MEDIUM.style;
- }
- else if (latency > LATENCY.POOR.min && latency <= LATENCY.POOR.max) {
- latencyDescription = LATENCY.POOR.description;
- latencyStyle = LATENCY.POOR.style;
- }
- else {
- latencyStyle = LATENCY.UNACCEPTABLE.style
- latencyDescription = LATENCY.UNACCEPTABLE.description
- }
+ latencyStyle = LATENCY.UNACCEPTABLE.style;
+ latencyDescription = LATENCY.UNACCEPTABLE.description;
+ iconName = 'blue'
+ description = 'unacceptable'
}
return {
latency_style: latencyStyle,
- latency_text: latencyDescription
+ latency_text: latencyDescription,
+ icon_name: iconName,
+ description: description
};
}
+ sessionUtils.createLatency = function(user) {
+ return sessionUtils.scoreInfo(user.full_score, user.id === context.JK.currentUserId)
+ }
})(window, jQuery);
\ No newline at end of file
diff --git a/web/app/assets/stylesheets/client/sessionList.css.scss b/web/app/assets/stylesheets/client/sessionList.css.scss
index 6dbe804df..f6dc3c46d 100644
--- a/web/app/assets/stylesheets/client/sessionList.css.scss
+++ b/web/app/assets/stylesheets/client/sessionList.css.scss
@@ -1,6 +1,71 @@
@import "client/common";
+table.findsession-table, table.local-recordings, #account-session-detail {
+
+
+
+ .latency-unacceptable {
+ width: 50px;
+ height: 10px;
+ font-family:Arial, Helvetica, sans-serif;
+ font-weight:200;
+ font-size:11px;
+ background-color:$latencyBadgeUnacceptable;
+ text-align:center;
+ }
+
+ .latency-unknown {
+ width: 50px;
+ height: 10px;
+ font-family:Arial, Helvetica, sans-serif;
+ font-weight:200;
+ font-size:11px;
+ background-color:$latencyBadgeUnacceptable;
+ text-align:center;
+ }
+
+ .latency-good {
+ width: 50px;
+ height: 10px;
+ font-family:Arial, Helvetica, sans-serif;
+ font-weight:200;
+ font-size:11px;
+ background-color:$latencyBadgeGood;
+ text-align:center;
+ }
+
+ .latency-me {
+ width: 50px;
+ height: 10px;
+ font-family:Arial, Helvetica, sans-serif;
+ font-weight:200;
+ font-size:11px;
+ text-align:center;
+ background-color:$latencyBadgeMe;
+ color:black;
+ }
+
+ .latency-fair {
+ width: 50px;
+ height: 10px;
+ font-family:Arial, Helvetica, sans-serif;
+ font-weight:200;
+ font-size:11px;
+ background-color:$latencyBadgeFair;
+ text-align:center;
+ }
+
+ .latency-poor{
+ width: 40px;
+ height: 10px;
+ font-family:Arial, Helvetica, sans-serif;
+ font-weight:200;
+ font-size:11px;
+ background-color:$latencyBadgePoor;
+ text-align:center;
+ }
+}
table.findsession-table, table.local-recordings {
width:98%;
height:10%;
@@ -81,67 +146,6 @@ table.findsession-table, table.local-recordings {
}
-.latency-unacceptable {
- width: 50px;
- height: 10px;
- font-family:Arial, Helvetica, sans-serif;
- font-weight:200;
- font-size:11px;
- background-color:$latencyBadgeUnacceptable;
- text-align:center;
-}
-
-.latency-unknown {
- width: 50px;
- height: 10px;
- font-family:Arial, Helvetica, sans-serif;
- font-weight:200;
- font-size:11px;
- background-color:$latencyBadgeUnacceptable;
- text-align:center;
-}
-
-.latency-good {
- width: 50px;
- height: 10px;
- font-family:Arial, Helvetica, sans-serif;
- font-weight:200;
- font-size:11px;
- background-color:$latencyBadgeGood;
- text-align:center;
-}
-
-.latency-me {
- width: 50px;
- height: 10px;
- font-family:Arial, Helvetica, sans-serif;
- font-weight:200;
- font-size:11px;
- text-align:center;
- background-color:$latencyBadgeMe;
- color:black;
-}
-
-.latency-fair {
- width: 50px;
- height: 10px;
- font-family:Arial, Helvetica, sans-serif;
- font-weight:200;
- font-size:11px;
- background-color:$latencyBadgeFair;
- text-align:center;
-}
-
-.latency-poor{
- width: 40px;
- height: 10px;
- font-family:Arial, Helvetica, sans-serif;
- font-weight:200;
- font-size:11px;
- background-color:$latencyBadgePoor;
- text-align:center;
-}
-
.avatar-tiny {
float:left;
padding:1px;
diff --git a/web/app/views/api_search/index.rabl b/web/app/views/api_search/index.rabl
index 90fca5c5d..93462e736 100644
--- a/web/app/views/api_search/index.rabl
+++ b/web/app/views/api_search/index.rabl
@@ -47,7 +47,7 @@ if @search.musicians_filter_search?
end
child(:results => :musicians) {
- attributes :id, :first_name, :last_name, :name, :city, :state, :country, :email, :online, :musician, :photo_url, :biography, :regionname, :score, :full_score, :audio_latency
+ attributes :id, :first_name, :last_name, :name, :city, :state, :country, :email, :online, :musician, :photo_url, :biography, :regionname, :score, :full_score
node :is_friend do |musician|
@search.is_friend?(musician)
@@ -79,6 +79,10 @@ if @search.musicians_filter_search?
node :friend_count do |musician| @search.friend_count(musician) end
node :recording_count do |musician| @search.record_count(musician) end
node :session_count do |musician| @search.session_count(musician) end
+
+ node :audio_latency do |musician|
+ last_jam_audio_latency(musician)
+ end
}
end
diff --git a/web/app/views/clients/_help.html.erb b/web/app/views/clients/_help.html.erb
index aabddd9d2..1efb617d6 100644
--- a/web/app/views/clients/_help.html.erb
+++ b/web/app/views/clients/_help.html.erb
@@ -62,9 +62,9 @@
The score shown is the one-way latency (or delay) in milliseconds from you to this user. This score is calculated using the following three values that JamKazam gathers:
- - Your Audio Gear Latency: {{data.my_gear_latency ? data.my_gear_latency + ' ms': '13 ms*'}} {{data.my_gear_latency ? '' : "(you have not qualified any gear, so we picked an average gear latency)"}}
- - Their Audio Gear Latency: {{data.their_gear_latency ? data.their_gear_latency + ' ms': '13 ms*'}} {{data.their_gear_latency ? '' : "(they have not qualified any gear, so we picked an average gear latency)"}}
- - Round-trip Internet Latency: {{data.internet_latency ? data.internet_latency + ' ms': '?'}} {{data.internet_latency ? '' : "(we have not scored you with this user yet)"}}
+ - Your Audio Gear Latency: {{data.my_gear_latency ? data.my_gear_latency + ' ms': '13 ms*'}} {{data.my_gear_latency ? '' : "(you have not qualified any gear, so we picked an average gear latency)"}}
+ - Their Audio Gear Latency: {{data.their_gear_latency ? data.their_gear_latency + ' ms': '13 ms*'}} {{data.their_gear_latency ? '' : "(they have not qualified any gear, so we picked an average gear latency)"}}
+ - Round-trip Internet Latency: {{data.internet_latency ? data.internet_latency + ' ms': '?'}} {{data.internet_latency ? '' : "(we have not scored you with this user yet)"}}
Total One-Way Latency: ( {{data.my_gear_latency ? data.my_gear_latency: '13'}} + {{data.their_gear_latency ? data.their_gear_latency: '13'}} + {{data.internet_latency ? data.internet_latency: '?'}} ) / 2 = {{data.full_score ? data.full_score + ' ms' : "?"}} {{data.full_score ? '' : "(when we don't know internet latency, we don't try to guess your one-way latency)"}}
diff --git a/web/app/views/clients/_musicians.html.erb b/web/app/views/clients/_musicians.html.erb
index 290d8422c..6c2a91919 100644
--- a/web/app/views/clients/_musicians.html.erb
+++ b/web/app/views/clients/_musicians.html.erb
@@ -24,7 +24,7 @@
|