forked from Gitlink/forgeplus
Merge branch 'pre_trustie_server' into trustie_server
This commit is contained in:
commit
e1eed52793
|
@ -5,9 +5,11 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController
|
|||
return render_error('请输入正确的用户ID.') if params[:user_id].blank?
|
||||
@all_issues = Issue.joins(:issue_participants).where(issue_participants: {participant_id: params[:user_id], participant_type: ['assigned']})
|
||||
@all_issues = @all_issues.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3])
|
||||
@this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", Date.today.beginning_of_week.to_s, Date.today.end_of_week.to_s).distinct
|
||||
@weekly_begin_date = params[:weekly_begin_date].to_time || Date.today.beginning_of_week rescue Date.today.beginning_of_week
|
||||
@weekly_end_date = params[:weekly_end_date].to_time || Date.today.end_of_week rescue Date.today.end_of_week
|
||||
@this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", @weekly_begin_date.to_s, @weekly_end_date.to_s).distinct
|
||||
@this_week_all_issues = @this_week_all_issues.order('created_on desc').pm_includes
|
||||
@next_week_all_issues = @all_issues.where("due_date >= ? and start_date <=?", (Date.today.beginning_of_week+1.week).to_s, (Date.today.end_of_week+1.week).to_s).distinct
|
||||
@next_week_all_issues = @all_issues.where("due_date >= ? and start_date <=?", (@weekly_begin_date+1.week).to_s, (@weekly_end_date+1.week).to_s).distinct
|
||||
@next_week_all_issues = @next_week_all_issues.order('created_on desc').pm_includes
|
||||
@this_week_requirement_issues = @this_week_all_issues.where(pm_issue_type: 1)
|
||||
@this_week_task_issues = @this_week_all_issues.where(pm_issue_type: 2)
|
||||
|
@ -27,7 +29,9 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController
|
|||
@enterprise_identifier = params[:enterprise_identifier] || ''
|
||||
@all_issues = Issue.where(enterprise_identifier: @enterprise_identifier, pm_issue_type: [1,2,3])
|
||||
@all_issues = @all_issues.where(pm_project_id: params[:pm_project_ids].split(",")) if params[:pm_project_ids].present?
|
||||
@this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", Date.today.beginning_of_week.to_s, Date.today.end_of_week.to_s)
|
||||
@weekly_begin_date = params[:weekly_begin_date] || Date.today.beginning_of_week.to_s
|
||||
@weekly_end_date = params[:weekly_end_date] || Date.today.end_of_week.to_s
|
||||
@this_week_all_issues = @all_issues.where("due_date >= ? and start_date <= ?", @weekly_begin_date, @weekly_end_date)
|
||||
@this_week_all_issues_group_count = @this_week_all_issues.group(:pm_project_id).count
|
||||
data = {}
|
||||
@this_week_all_issues_group_count.keys.each do |pm_project_id|
|
||||
|
|
|
@ -105,6 +105,23 @@ class Issue < ApplicationRecord
|
|||
scope :pm_includes, -> {includes(:project, :show_issue_tags, :issue_status, :priority, :version, :user, :show_assigners, :comment_journals, :operate_journals)}
|
||||
scope :closed, ->{where(status_id: 5)}
|
||||
scope :opened, ->{where.not(status_id: 5)}
|
||||
scope :with_assigner_info, -> {
|
||||
joins("LEFT JOIN (
|
||||
SELECT ia.issue_id, ia.assigner_id
|
||||
FROM issue_assigners ia
|
||||
JOIN (
|
||||
SELECT issue_id, MIN(id) AS min_assigner_id
|
||||
FROM issue_assigners
|
||||
GROUP BY issue_id
|
||||
) tmp ON ia.issue_id = tmp.issue_id AND ia.id = tmp.min_assigner_id
|
||||
) assigner ON issues.id = assigner.issue_id
|
||||
LEFT JOIN users u ON assigner.assigner_id = u.id")
|
||||
}
|
||||
|
||||
scope :ordered_by_assigner, -> (sort_direction) {
|
||||
order("CASE WHEN u.id IS NULL THEN 1 ELSE 0 END #{sort_direction}")
|
||||
.order("COALESCE(u.nickname, u.login) DESC")
|
||||
}
|
||||
after_create :incre_project_common, :incre_user_statistic, :incre_platform_statistic
|
||||
before_save :check_pm_and_update_due_date
|
||||
after_save :incre_or_decre_closed_issues_count, :change_versions_count, :send_update_message_to_notice_system, :associate_attachment_container, :generate_uuid
|
||||
|
|
|
@ -9,7 +9,7 @@ class Api::V1::Issues::ListService < ApplicationService
|
|||
|
||||
validates :category, inclusion: { in: %w[all opened closed], message: '请输入正确的Category'}
|
||||
validates :participant_category, inclusion: { in: %w[all aboutme authoredme assignedme atme], message: '请输入正确的ParticipantCategory'}
|
||||
validates :sort_by, inclusion: { in: %w[issues.created_on issues.updated_on issues.blockchain_token_num issue_priorities.position issues.start_date issues.due_date issues.status_id] , message: '请输入正确的SortBy'}, allow_blank: true
|
||||
validates :sort_by, inclusion: { in: %w[issues.created_on issues.updated_on issues.blockchain_token_num issue_priorities.position issues.start_date issues.due_date issues.status_id, assigners] , message: '请输入正确的SortBy'}, allow_blank: true
|
||||
validates :sort_direction, inclusion: { in: %w[asc desc], message: '请输入正确的SortDirection'}, allow_blank: true
|
||||
validates :current_user, presence: true
|
||||
|
||||
|
@ -175,6 +175,8 @@ class Api::V1::Issues::ListService < ApplicationService
|
|||
scope = issues.includes(:priority, :issue_status, :user, :show_assigners, :show_issue_tags, :version, :comment_journals)
|
||||
scope = if sort_by == 'issue_priorities.position'
|
||||
scope.reorder("issue_priorities.position #{sort_direction}, issues.updated_on DESC").distinct
|
||||
elsif sort_by == 'assigners'
|
||||
scope.with_assigner_info.ordered_by_assigner(sort_direction)
|
||||
else
|
||||
scope.reorder("#{sort_by} #{sort_direction}").distinct
|
||||
end
|
||||
|
|
|
@ -25,7 +25,9 @@ class Api::V1::Projects::Commits::RecentService < ApplicationService
|
|||
param = {
|
||||
access_token: token,
|
||||
page: page,
|
||||
limit: limit
|
||||
limit: limit,
|
||||
stats: false,
|
||||
files: false
|
||||
}
|
||||
param.merge!(keyword: keyword) if keyword.present?
|
||||
|
||||
|
|
Loading…
Reference in New Issue