From 8faaf7ac3a66f98e6fcc8846c2bf75480e4bb95a Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Sat, 9 May 2020 15:29:47 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8=E9=A1=B5?= =?UTF-8?q?=E7=9A=84=E6=90=9C=E7=B4=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issue_times_controller.rb | 12 +++--------- app/controllers/projects_controller.rb | 6 +++++- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/app/controllers/issue_times_controller.rb b/app/controllers/issue_times_controller.rb index 7b6dadfe7..1ddc66d9e 100644 --- a/app/controllers/issue_times_controller.rb +++ b/app/controllers/issue_times_controller.rb @@ -22,16 +22,10 @@ class IssueTimesController < ApplicationController end_type = params[:end_type].to_i end_work_time = end_type == 0 ? "" : Time.now last_work_time = @issue.issue_times.where(user_id: current_user.id, end_time: nil) - Rails.logger.info("######________last_work_time&.last.try(:id)_____###########{last_work_time&.first.try(:id)}") - if last_work_time.update_all(end_time: end_work_time) - if end_type == 0 - message = "取消时间跟踪" - @issue.custom_journal_detail("cancel_time",last_work_time&.first.try(:id), "取消时间跟踪", current_user&.id) - else - message = "停止工作" - @issue.custom_journal_detail("end_time",last_work_time&.first.try(:id), "停止工作", current_user&.id) - end + message = end_type == 0 ? "取消时间跟踪" : "停止工作" + journal_time = end_type == 0 ? "cancel_time" : "end_time" + @issue.custom_journal_detail(journal_time,last_work_time&.first.try(:id), message, current_user&.id) normal_status(0, message) else normal_status(0, "操作失败") diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 879efcaaf..a1e1e4b09 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -7,9 +7,13 @@ class ProjectsController < ApplicationController def index scope = Projects::ListQuery.call(params) + Rails.logger.info("#######_____scope__ids_____######{scope.pluck(:id)}") @total_count = scope.size - @projects = paginate(scope) + Rails.logger.info("#######______total_count______######{@total_count}") + page = params[:page] || 1 + limit = params[:limit] || 15 + @projects = scope.page(page).per(limit) end def create