首页的技能标签
This commit is contained in:
parent
559178c791
commit
583eef8086
|
|
@ -295,7 +295,11 @@ class GamesController < ApplicationController
|
|||
had_done = @game.had_done
|
||||
shixun = @myshixun.shixun
|
||||
if shixun.status > 1 && !@game.answer_open
|
||||
User.current.update_attributes(:grade => (User.current.grade + @game.challenge.score), :experience => (User.current.experience + @game.challenge.score)) if correct
|
||||
if correct
|
||||
#User.current.update_attributes(:grade => (User.current.grade + @game.challenge.score), :experience => (User.current.experience + @game.challenge.score))
|
||||
reward_grade(@game.user, @game.id, @game.class, game_challenge.score)
|
||||
reward_experience(@game.user, @game.id, @game.class, game_challenge.score)
|
||||
end
|
||||
end
|
||||
if @game.outputs.blank?
|
||||
Output.create(:game_id => @game.id, :actual_output => user_answer, :result => correct)
|
||||
|
|
|
|||
|
|
@ -2277,7 +2277,6 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
def user_show_course_list
|
||||
@courses = @user.courses.not_deleted_not_end.order("updated_at desc")
|
||||
@courses_count = @courses.count
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ class User < Principal
|
|||
has_many :shixuns, :through => :shixun_members
|
||||
has_many :shixun_members, :dependent => :destroy
|
||||
has_many :challenges, :dependent => :destroy
|
||||
has_many :games, :dependent => :destroy
|
||||
|
||||
has_many :subjects
|
||||
|
||||
|
|
@ -310,6 +311,13 @@ class User < Principal
|
|||
end
|
||||
end
|
||||
}
|
||||
def challenge_tags
|
||||
shixuns = Shixun.where(:id => Myshixun.where(:user_id => self.id).map(&:shixun_id), :status => [2,3])
|
||||
myshixuns = Myshixun.where(:user_id => self.id, :shixun_id => shixuns.map(&:id))
|
||||
games = self.games.where(:myshixun_id => myshixuns.map(&:id), :status => 2)
|
||||
challenge_tags = ChallengeTag.where(:challenge_id => games.map(&:challenge_id))
|
||||
end
|
||||
|
||||
def self.search(query)
|
||||
__elasticsearch__.search(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@
|
|||
<% if new_message_count > 0 %>
|
||||
<a href="<%= feedback_path(User.current) %>" class="fl mr10 link-color-grey">新留言<span style="margin-top: 5px;" class="user_filtrate_span2 user_filtrate_span2_bg ml10"><%= new_message_count %></span></a>
|
||||
<% end %>
|
||||
<!--<span class="fl mr10 color-grey-6">技能勋章<span class="ml5 user_filtrate_span1_bg"><%#= @user.experience %></span></span>-->
|
||||
<%= %>
|
||||
<span class="fl mr10 color-grey-6">技能标签<span class="ml5 user_filtrate_span1_bg"><%= @user.challenge_tags.count %></span></span>
|
||||
<span class="fl mr10 color-grey-6">经验值<span class="ml5 user_filtrate_span1_bg"><%= @user.experience %></span></span>
|
||||
<span class="fl color-grey-6">金币<span class="ml5 user_filtrate_span1_bg"><%= @user.grade %></span></span>
|
||||
</p>
|
||||
|
|
|
|||
Loading…
Reference in New Issue