Merge branch 'dev_shixun_project' of https://git.trustie.net/jacknudt/trustieforge into dev_shixun_project
This commit is contained in:
commit
b054510fb7
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddStatusToMyshixuns < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :myshixuns, :status, :integer, :default => 0
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue