Merge branch 'dev_shixun_project' of https://git.trustie.net/jacknudt/trustieforge into dev_shixun_project

This commit is contained in:
daiao 2017-03-20 15:42:19 +08:00
commit b054510fb7
4 changed files with 34 additions and 3 deletions

View File

@ -33,6 +33,33 @@ module ApplicationHelper
extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
# 定义实训相关方法
# myshixun 最高分
def top_score shixun
end
# 正在进行中任务
def shixun_running shixun
Myshixun.where(:parent_id => shixun, :status => 0).count
end
# 已完成任务
def shixun_done shixun
Myshixun.where(:parent_id => shixun, :status => 1).count
end
# 测评次数
def shixun_exec_count shixun
Game.find_by_sql("SELECT count(*) FROM `outputs` op, `games` g, `myshixuns` m where op.game_id = g.id and m.parent_id = '#{shixun.id}';")
end
# 实训平均分
def shixun_avg
end
# def user_blogs_path(resource,parameters={})
# super
# end

View File

@ -3,7 +3,6 @@ class Game < ActiveRecord::Base
attr_accessible :description, :myshixun_id, :stage, :subject, :user_id, :status, :ready_knowledge, :task_pass, :answer, :score
belongs_to :myshixun,:touch=> true
belongs_to :user
has_many :game_comments, :dependent => :destroy
has_many :outputs, :dependent => :destroy
has_many :test_sets, :dependent => :destroy
has_many :challenge_samples, :dependent => :destroy

View File

@ -22,8 +22,8 @@
</p>
<div class="cl"></div>
<p class="ml15 mt15 color-grey">
<span class=" mr10">正在挑战:129</span>
<span class=" mr10">完成挑战:1.6万</span>
<span class=" mr10">正在挑战:<%= shixun_running @shixun %></span>
<span class=" mr10">完成挑战:<%= shixun_done @shixun %></span>
<span class=" mr10">最佳表现98分</span>
<span class=" mr10">测评次数3次</span>
<span class=" mr10">平均表现80分 </span>

View File

@ -0,0 +1,5 @@
class AddStatusToMyshixuns < ActiveRecord::Migration
def change
add_column :myshixuns, :status, :integer, :default => 0
end
end