Link to filtered exercise list
This commit is contained in:
@ -7,12 +7,14 @@ $(function() {
|
|||||||
|
|
||||||
var buildTagContainer = function(tag) {
|
var buildTagContainer = function(tag) {
|
||||||
return '\
|
return '\
|
||||||
|
<a href="' + location.href +'/statistics?tag=' + tag.id + '">\
|
||||||
<div class="tag">\
|
<div class="tag">\
|
||||||
<div class="name">' + tag.key + '</div>\
|
<div class="name">' + tag.key + '</div>\
|
||||||
<div class="progress">\
|
<div class="progress">\
|
||||||
<div class="progress-bar" role="progressbar" style="width:' + tag.value + '%">' + tag.value + '%</div>\
|
<div class="progress-bar" role="progressbar" style="width:' + tag.value + '%">' + tag.value + '%</div>\
|
||||||
</div>\
|
</div>\
|
||||||
</div>';
|
</div>\
|
||||||
|
</a>';
|
||||||
};
|
};
|
||||||
|
|
||||||
var jqxhr = $.ajax(window.location.href + '/tag_statistics', {
|
var jqxhr = $.ajax(window.location.href + '/tag_statistics', {
|
||||||
|
@ -72,8 +72,8 @@ class ExternalUsersController < ApplicationController
|
|||||||
|
|
||||||
statistics = []
|
statistics = []
|
||||||
tags = ProxyExercise.new().get_user_knowledge_and_max_knowledge(@user, @user.participations.uniq.compact)
|
tags = ProxyExercise.new().get_user_knowledge_and_max_knowledge(@user, @user.participations.uniq.compact)
|
||||||
tags[:user_topic_knowledge].each_pair do |key, value|
|
tags[:user_topic_knowledge].each_pair do |tag, value|
|
||||||
statistics.append({:key => key.name.to_s, :value => (100.0 / tags[:max_topic_knowledge][key] * value).round})
|
statistics.append({key: tag.name.to_s, value: (100.0 / tags[:max_topic_knowledge][tag] * value).round, id: tag.id})
|
||||||
end
|
end
|
||||||
statistics.sort_by! {|item| -item[:value]}
|
statistics.sort_by! {|item| -item[:value]}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user