diff --git a/Gemfile b/Gemfile
index 7a37b7c44..ad254d436 100644
--- a/Gemfile
+++ b/Gemfile
@@ -48,7 +48,6 @@ gem 'rqrcode_png'
gem 'acts-as-taggable-on', '~> 6.0'
group :development, :test do
- gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'rspec-rails', '~> 3.8'
end
diff --git a/app/controllers/admins/laboratories_controller.rb b/app/controllers/admins/laboratories_controller.rb
index 716275468..dcfdc443b 100644
--- a/app/controllers/admins/laboratories_controller.rb
+++ b/app/controllers/admins/laboratories_controller.rb
@@ -50,6 +50,13 @@ class Admins::LaboratoriesController < Admins::BaseController
@subjects = paginate(subjects.includes(:user))
end
+ def synchronize_user
+ school = current_laboratory.school
+ users = User.joins(:user_extension).where(user_extensions: {school_id: school.id})
+ users.update_all(laboratory_id: current_laboratory.id)
+ end
+
+
private
def current_laboratory
diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb
index 1457cafcc..d4275b600 100644
--- a/app/controllers/games_controller.rb
+++ b/app/controllers/games_controller.rb
@@ -767,8 +767,9 @@ class GamesController < ApplicationController
# 记录实训花费的时间
# REDO:需要添加详细的说明
def cost_time
- cost_time = params[:time].to_i
- @game.update_attribute(:cost_time, cost_time)
+ return if @game.status >= 2
+ cost_time = Time.now.to_i - @game.close_browse_time.to_i
+ @game.update_attributes(close_browse_time: Time.now, cost_time: cost_time)
end
# 同步challenge的更新时间
@@ -938,6 +939,7 @@ class GamesController < ApplicationController
game.update_attributes(status: 0, open_time: Time.now) if game.open_time.blank? || game.status == 3
# 开启实训更新myshixuns的时间,方便跟踪用于的学习进度。
game.myshixun.update_column(:updated_at, Time.now)
+ @game.update_attribute(:close_browse_time, Time.now) if game.status < 2 && @game.close_browse_time.nil?
end
# vnc连接
diff --git a/app/views/admins/laboratories/shared/_laboratory_item.html.erb b/app/views/admins/laboratories/shared/_laboratory_item.html.erb
index abfcda349..539e7d09f 100644
--- a/app/views/admins/laboratories/shared/_laboratory_item.html.erb
+++ b/app/views/admins/laboratories/shared/_laboratory_item.html.erb
@@ -34,7 +34,8 @@
<% if school.present? && laboratory.id != 1 %>
<%= javascript_void_link '添加管理员', class: 'action', data: { laboratory_id: laboratory.id, toggle: 'modal', target: '.admin-add-laboratory-user-modal' } %>
- <% end %>
+ <%= link_to '同步用户', synchronize_user_admins_laboratory_path(laboratory), remote: true, data: { confirm: '确认同步该单位下的所有用户到云上实验室吗?' }, class: 'action' %>
+<% end %>
<%= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
diff --git a/app/views/admins/laboratories/synchronize_user.js.erb b/app/views/admins/laboratories/synchronize_user.js.erb
new file mode 100644
index 000000000..d2a365007
--- /dev/null
+++ b/app/views/admins/laboratories/synchronize_user.js.erb
@@ -0,0 +1 @@
+alert("同步成功");
\ No newline at end of file
diff --git a/app/views/games/cost_time.json.jbuilder b/app/views/games/cost_time.json.jbuilder
deleted file mode 100644
index efe6fc949..000000000
--- a/app/views/games/cost_time.json.jbuilder
+++ /dev/null
@@ -1 +0,0 @@
-json.game @game
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 4094463f8..2c9199ccd 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1074,6 +1074,7 @@ Rails.application.routes.draw do
member do
get :shixuns_for_select
get :subjects_for_select
+ get :synchronize_user
end
resource :laboratory_setting, only: [:show, :update]
diff --git a/db/migrate/20191119021843_add_close_browser_time_for_games.rb b/db/migrate/20191119021843_add_close_browser_time_for_games.rb
new file mode 100644
index 000000000..3bd40b679
--- /dev/null
+++ b/db/migrate/20191119021843_add_close_browser_time_for_games.rb
@@ -0,0 +1,5 @@
+class AddCloseBrowserTimeForGames < ActiveRecord::Migration[5.2]
+ def change
+ add_column :games, :close_browse_time, :timestamp
+ end
+end
diff --git a/public/images/educoder/courses/courses.jpg b/public/images/educoder/courses/courses.jpg
new file mode 100644
index 000000000..9447b74be
Binary files /dev/null and b/public/images/educoder/courses/courses.jpg differ
diff --git a/public/react/src/modules/courses/coursesHome/CoursesHome.js b/public/react/src/modules/courses/coursesHome/CoursesHome.js
index 56de3ba7f..c02c49ee9 100644
--- a/public/react/src/modules/courses/coursesHome/CoursesHome.js
+++ b/public/react/src/modules/courses/coursesHome/CoursesHome.js
@@ -119,7 +119,7 @@ class CoursesHome extends Component{
.courses-head{
width: 100%;
height: 300px;
- background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.course_banner_url === null ?`images/educoder/competitions/courses.jpg`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.course_banner_url)});
+ background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.course_banner_url === null ?`images/educoder/courses/courses.jpg`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.course_banner_url)});
background-color: #081C4B;
background-position: center;
background-repeat: no-repeat;
diff --git a/public/react/src/modules/login/LoginDialog.js b/public/react/src/modules/login/LoginDialog.js
index 1a5802782..a4e9c0c4f 100644
--- a/public/react/src/modules/login/LoginDialog.js
+++ b/public/react/src/modules/login/LoginDialog.js
@@ -590,7 +590,7 @@ class LoginDialog extends Component {
if (isRender === undefined) {
isRender = false
}
- // console.log(this.props)
+
return (