make it match develop
This commit is contained in:
parent
597efb36e1
commit
0a52de714e
2 changed files with 2 additions and 24 deletions
|
@ -66,28 +66,6 @@ class User < ApplicationRecord
|
||||||
json['rtype'] = 'mapper'
|
json['rtype'] = 'mapper'
|
||||||
json
|
json
|
||||||
end
|
end
|
||||||
|
|
||||||
def recentMetacodes
|
|
||||||
array = []
|
|
||||||
self.topics.sort{|a,b| b.created_at <=> a.created_at }.each do |t|
|
|
||||||
if array.length < 5 and array.index(t.metacode_id) == nil
|
|
||||||
array.push(t.metacode_id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
array
|
|
||||||
end
|
|
||||||
|
|
||||||
def mostUsedMetacodes
|
|
||||||
self.topics.to_a.reduce({}) { |memo, topic|
|
|
||||||
if memo[topic.metacode_id] == nil
|
|
||||||
memo[topic.metacode_id] = 1
|
|
||||||
else
|
|
||||||
memo[topic.metacode_id] = memo[topic.metacode_id] + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
memo
|
|
||||||
}.to_a.sort{ |a, b| b[1] <=> a[1] }.map{|i| i[0]}.slice(0, 5)
|
|
||||||
end
|
|
||||||
|
|
||||||
def as_rdf(opts = {})
|
def as_rdf(opts = {})
|
||||||
base_url = opts[:base_url] || 'https://metamaps.cc'
|
base_url = opts[:base_url] || 'https://metamaps.cc'
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
Metamaps.Create.newSelectedMetacodeNames.push("<%= metacode.name %>");
|
Metamaps.Create.newSelectedMetacodeNames.push("<%= metacode.name %>");
|
||||||
<% end %>
|
<% end %>
|
||||||
Metamaps.Create.newTopic.metacode = <%= user_metacode().id %>
|
Metamaps.Create.newTopic.metacode = <%= user_metacode().id %>
|
||||||
<% current_user.recentMetacodes.each do |id| %>
|
<% current_user.recent_metacodes.each do |id| %>
|
||||||
Metamaps.Create.recentMetacodes.push(<%= id %>);
|
Metamaps.Create.recentMetacodes.push(<%= id %>);
|
||||||
<% end %>
|
<% end %>
|
||||||
<% current_user.mostUsedMetacodes.each do |id| %>
|
<% current_user.most_used_metacodes.each do |id| %>
|
||||||
Metamaps.Create.mostUsedMetacodes.push(<%= id %>);
|
Metamaps.Create.mostUsedMetacodes.push(<%= id %>);
|
||||||
<% end %>
|
<% end %>
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue