输出结果关联

This commit is contained in:
huang 2017-03-16 10:26:02 +08:00
parent 6f49950caa
commit 61db8041a4
16 changed files with 77 additions and 52 deletions

View File

@ -14,7 +14,7 @@ class GamesController < ApplicationController
def show
@git_url = git_repository_url(@myshixun, "Myshixun")
@entries = @repository.entries(@path, @rev)
@outputs = @game.game_outputses
@outputs = @game.outputs
respond_to do |format|
format.html
format.js

View File

@ -4,5 +4,5 @@ class Game < ActiveRecord::Base
belongs_to :myshixun,:touch=> true
belongs_to :user
has_many :game_comments
has_many :game_outputses, :dependent => :destroy
has_many :outputs
end

View File

@ -1,4 +1,3 @@
class GameOutputs < ActiveRecord::Base
attr_accessible :code, :msg, :out_put, :game_id
belongs_to :game
end

3
app/models/output.rb Normal file
View File

@ -0,0 +1,3 @@
class Output < ActiveRecord::Base
# attr_accessible :title, :body
end

View File

@ -1,4 +1,4 @@
<div class=" col-width-2 fl content-submit ml15 mt15">
<div class=" col-width fl content-submit ml15 mt15">
<div class="panel-header ">
<h3 >操作</h3>
</div>

View File

@ -1,4 +1,4 @@
<div class=" col-width-4 fl content-output ml15 mt15">
<div class=" col-width fl content-output ml15 mt15">
<div class="panel-header ">
<h3 >测试输出</h3>
</div>

View File

@ -1,4 +1,4 @@
<div class=" col-width-5 fl content-history mt15" >
<div class=" col-width fl content-history mt15" >
<div class="panel-header clearfix">
<h3 class="fl">测评历史</h3>
<div class="fr mt5">

View File

@ -1,4 +1,4 @@
<div class="content-editor col-width-5 fl ">
<div class="content-editor col-width fl ">
<div class="panel-header clearfix">
<h3 class="fl">

View File

@ -8,12 +8,12 @@
</ul>
</div>
<div class="content clearfix" >
<div class="alert alert-blue mb15 mr30" >
<div class="alert alert-blue mr15 mt15 ml15" >
<button data-dismiss="alert" class="close fr" type="button">×</button>
完成任务后,请点击“提交评测”按钮,若通过系统评测,将为你解锁下一关,祝你早日通关,加油!
</div>
<div class="content-row mr15">
<div class="content-info col-width-5 fl ">
<div class="content-info col-width fl ">
<div class="panel-header clearfix">
<h3 class="fl">第1关Python的初始化</h3>
<div class="fr mt5">

View File

@ -23,12 +23,15 @@
<div class="task-container">
<div class="leftbar">
<div class="user-info">
<a href="#" class="user-info-img"><img src="images/user/male.jpg" width="100" height="" alt="100"></a>
<%= link_to image_tag(url_to_avatar(@myshixun.owner), :width => "100", :height => "100"), user_path(@myshixun.owner), :alt => "用户头像", :class => "user-info-img" %>
<!--<a href="#" class="user-info-img"><img src="images/user/male.jpg" width="100" height="" alt="100"></a>-->
<a href="#" class="user-info-name">胡莎莎</a>
</div>
<div class="leftnav">
<ul>
<li class="leftnav-box"><a href="#" class="leftnav-box-inner leftnav-active">
<li class="leftnav-box">
<%#= link_to "当前任务" %>
<a href="#" class="leftnav-box-inner leftnav-active">
<i class="fa fa-gamepad font-28"></i><br/><span class="font-16">当前任务</span>
</a></li>
<li class="leftnav-box"><a href="#" class="leftnav-box-inner ">

View File

@ -0,0 +1,12 @@
class CreateOutputs < ActiveRecord::Migration
def change
create_table :outputs do |t|
t.integer :code
t.integer :game_id
t.text :msg
t.text :out_put
t.timestamps
end
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20170314085929) do
ActiveRecord::Schema.define(:version => 20170315103005) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1144,8 +1144,8 @@ ActiveRecord::Schema.define(:version => 20170314085929) do
t.string "name"
t.integer "user_id"
t.text "description"
t.datetime "publish_time"
t.datetime "end_time"
t.date "publish_time"
t.date "end_time"
t.integer "homework_type", :default => 1
t.string "late_penalty"
t.integer "course_id"
@ -1242,19 +1242,6 @@ ActiveRecord::Schema.define(:version => 20170314085929) do
t.datetime "updated_at", :null => false
end
create_table "ii", :force => true do |t|
t.integer "project_id"
t.string "author_login"
t.string "rep_identifier"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "sonar_version", :default => 0
t.string "path"
t.string "branch"
t.string "language"
t.string "sonar_name"
end
create_table "innodb_monitor", :id => false, :force => true do |t|
t.integer "a"
end
@ -1727,6 +1714,15 @@ ActiveRecord::Schema.define(:version => 20170314085929) do
t.integer "allow_teacher", :default => 0
end
create_table "outputs", :force => true do |t|
t.integer "code"
t.integer "game_id"
t.text "msg"
t.text "out_put"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "phone_app_versions", :force => true do |t|
t.string "version"
t.text "description"
@ -2116,17 +2112,21 @@ ActiveRecord::Schema.define(:version => 20170314085929) do
t.string "name"
t.text "description"
t.text "script"
t.boolean "is_public", :default => true
t.boolean "is_public", :default => true
t.integer "parent_id"
t.integer "user_id"
t.integer "gpid"
t.integer "forked_count", :default => 0
t.integer "visits", :default => 0
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "forked_count", :default => 0
t.integer "visits", :default => 0
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "changeset_num"
t.integer "forked_form"
t.integer "status", :default => 0
t.integer "status", :default => 0
t.text "ready_knowledge"
t.text "task_pass"
t.text "answer"
t.integer "score"
end
create_table "softapplications", :force => true do |t|
@ -2421,7 +2421,7 @@ ActiveRecord::Schema.define(:version => 20170314085929) do
t.datetime "updated_at", :null => false
t.integer "author_id"
t.integer "status", :limit => 1, :default => 0
t.integer "position", :limit => 1, :default => 0
t.integer "position", :limit => 1
t.integer "result", :default => 0
end

View File

@ -38,18 +38,10 @@ a.link-color-green{color:#29bd8b;}
.pl5{ padding-left:5px;}.pl10{ padding-left:10px;}.pl15{ padding-left:15px;}.pl20{ padding-left:20px;}
.pr5{ padding-right:5px;}.pr10{ padding-right:10px;}.pr15{ padding-right:15px;}.pr20{ padding-right:20px;}
/*块*/
.col-width-10{ max-width: 100%; background: #fff; border:1px solid #e8e8e8;}
.col-width-9{ max-width: 90%; background: #fff; border:1px solid #e8e8e8;}
.col-width-8{ max-width: 80%; background: #fff; border:1px solid #e8e8e8;}
.col-width-7{ max-width: 70%; background: #fff; border:1px solid #e8e8e8;}
.col-width-6{ max-width: 60%; background: #fff; border:1px solid #e8e8e8;}
.col-width-5{ max-width: 50%; background: #fff; border:1px solid #e8e8e8;}
.col-width-4{ max-width: 40%; background: #fff; border:1px solid #e8e8e8;}
.col-width-3{ max-width: 30%; background: #fff; border:1px solid #e8e8e8;}
.col-width-2{ max-width: 20%; background: #fff; border:1px solid #e8e8e8;}
.col-width-1{ max-width: 10%; background: #fff; border:1px solid #e8e8e8;}
.col-width{background: #fff; border:1px solid #e8e8e8;}
/*按钮*/
a.task-btn{display: inline-block;border:none; padding:0 35px;color: #666;background: #e1e1e1; text-align:center;font-size: 14px; height: 35px;line-height: 35px; border-radius:3px;}
a.task-btn{display: inline-block;border:none; padding:0 32px;color: #666;background: #e1e1e1; text-align:center;font-size: 14px; height: 35px;line-height: 35px; border-radius:3px;}
a:hover.task-btn {background: #c3c3c3; }
a.task-btn-green{background: #29bd8b; color: #fff;}
a:hover.task-btn-green{background: #19b17e;}
@ -94,10 +86,10 @@ a.rightbar-pause{ color:#29bd8b; font-size: 18px; margin-right:245px; margin-top
.rightbar-h2{ color:#fff; margin:12px 0 0 20px; font-weight: normal;}
.rightbar{padding-top: 60px;margin-left: 210px;min-height: 1000px;background:#f5f9fc; color:#333;}
/*右侧内容*/
.content{ width:100%; min-width:1000px; padding:15px;}
.content-row{ }
.content-info{ width:49%; min-width:450px; position: relative; }
.content-editor{ width:49%; min-width:450px;position: relative; margin-left:15px; }
.content{ width:100%; min-width:1000px; }
.content-row{ padding:15px; }
.content-info{ width:49%; min-width:450px; }
.content-editor{ width:49%; min-width:450px; margin-left:15px; }
.panel-header{ border-bottom:1px solid #eee; padding:10px 15px;}
/* tab */
.tab_content{ width: 100%; margin: 0 auto; background:#fff; }
@ -117,9 +109,9 @@ a.rightbar-pause{ color:#29bd8b; font-size: 18px; margin-right:245px; margin-top
.history-fail{ width: 100%; height:40px; line-height: 40px; background:#fdebeb; color:#e53238; }
.icon-fail{ display:inline-block; padding:0 8px; background:#e53238; color:#fff;}
.icon-success{ display:inline-block; padding:0 8px; background:#252e38; color:#fff;}
.content-output{width:33%; min-width:250px;}
.content-submit{width:10%; min-width:160px;}
.content-submitbox{ width:130px; margin: 15px auto; height:135px;}
.content-output{width:37.5%; min-width:350px;}
.content-submit{width:10%; min-width:135px; position: absolute; right:15px;}
.content-submitbox{ width:120px; margin: 15px auto; height:135px;}
.panel-inner{ background:#EFF2F7; margin:15px; padding:15px;}
.panel-inner-title{ font-size: 14px; color: #666;}
/* 弹框 */

View File

@ -0,0 +1,6 @@
FactoryGirl.define do
factory :output do
end
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Output, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Outputs, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end