Merge remote-tracking branch 'origin/standalone_develop' into standalone_develop

This commit is contained in:
xxq250 2025-05-30 09:32:37 +08:00
commit fadb729647
6 changed files with 28 additions and 9 deletions

View File

@ -3,7 +3,7 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController
def personal
@enterprise_identifier = params[:enterprise_identifier] || ''
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: ['authored', 'assigned']})
@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
@this_week_all_issues = @this_week_all_issues.order('created_on desc')
@ -65,7 +65,7 @@ class Api::Pm::WeeklyIssuesController < Api::Pm::BaseController
def personal_issues
@enterprise_identifier = params[:enterprise_identifier] || ''
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: ['authored', 'assigned']})
@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
@this_week_all_issues = @this_week_all_issues.order('created_on desc')

View File

@ -17,6 +17,7 @@ class Api::V1::SonarqubesController < Api::V1::BaseController
def insert_file
checkout_url = 'https://gitlink.org.cn/KingChan/checkout@v4'
scanner_url = 'https://gitlink.org.cn/KingChan/sonarqube-scan-action@master'
doxygen_url = "https://gitlink.gitlink.net"
begin
config = Rails.application.config_for(:configuration)
sonarqube_config = config.dig('sonarqube')
@ -27,7 +28,9 @@ class Api::V1::SonarqubesController < Api::V1::BaseController
if sonarqube_config.present? && sonarqube_config['scanner'].present?
scanner_url = sonarqube_config['scanner']
end
if sonarqube_config.present? && sonarqube_config['doxygen'].present?
doxygen_url = sonarqube_config['doxygen']
end
raise 'sonar config missing' if sonarqube_config.blank?
rescue => ex
raise ex if Rails.env.production?
@ -61,6 +64,9 @@ class Api::V1::SonarqubesController < Api::V1::BaseController
with:
# Disabling shallow clones is recommended for improving the relevancy of reporting
fetch-depth: 0
- name: curl doxygen
run: |
curl -X GET #{doxygen_url}/generate?repo=#{@project.repository.url}
- name: SonarQube Scan
uses: #{scanner_url}
env:
@ -87,7 +93,7 @@ class Api::V1::SonarqubesController < Api::V1::BaseController
filepath: 'sonar-project.properties',
branch: params[:branch],
new_branch: nil,
"content": "sonar.projectKey=#{params[:owner]}-#{@project.id}\nsonar.sources=.\nsonar.java.binaries=.",
"content": "sonar.projectKey=#{params[:owner]}-#{@project.id}\nsonar.projectVersion=1.0\nsonar.sourceEncoding=UTF-8\nsonar.sources=.\nsonar.java.binaries=target/classes,build/classes\nsonar.javascript.lcov.reportPaths=coverage/lcov.info\nsonar.python.coverage.reportPaths=coverage.xml\nsonar.cxx.file.suffixes=.h,.cpp",
"message": 'Add sonar-project.properties',
committer: {
email: @owner.mail,
@ -148,6 +154,14 @@ class Api::V1::SonarqubesController < Api::V1::BaseController
render_ok data
end
def doxygen_url
config = Rails.application.config_for(:configuration)
sonarqube_config = config.dig('sonarqube')
doxygen_url = sonarqube_config['doxygen']
data = {doxygen_url: "#{doxygen_url}/files/#{@project.owner.login}/#{@project.identifier}/html/"}
render_ok data
end
def measures_search_history
params_data = {
from: params[:form],

View File

@ -60,7 +60,7 @@ class Api::Pm::Issues::CreateService < ApplicationService
if @root_subject.present? && [4, 5].include?(@pm_issue_type.to_i)
@root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: [4,5], pm_project_id: @pm_project_id,enterprise_identifier: @enterprise_identifier)
unless @root_issue.present?
@root_issue = Issue.create(subject: @root_subject, pm_issue_type: [4,5], pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id)
@root_issue = Issue.create(subject: @root_subject, pm_issue_type: @pm_issue_type.to_i, pm_project_id: @pm_project_id, enterprise_identifier: @enterprise_identifier, status_id: 1, priority_id: 1, tracker_id: Tracker.first.id, project_id: @project.id, author_id: current_user.id)
end
@created_issue.root_id = @root_issue.id
else

View File

@ -97,7 +97,7 @@ class Api::V1::Issues::ListService < ApplicationService
end
end
issues = issues.where(enterprise_identifier: enterprise_identifier) if enterprise_identifier.present? && [4,5].include?(pm_issue_type.to_i)
issues = issues.where(enterprise_identifier: enterprise_identifier) if enterprise_identifier.present? && ([4,5].include?(pm_issue_type.to_i) || pm_issue_types.present?)
#pm相关
# root_id# -1 查一级目录
@ -151,7 +151,7 @@ class Api::V1::Issues::ListService < ApplicationService
end
if update_begin_date&.present? || update_end_date&.present?
issues = issues.where('issues.updated_on between ? and ?', update_begin_date&.present? ? update_begin_date.to_time : Time.now.beginning_of_day, update_end_date&.present? ? update_end_date.to_time.end_of_day : Time.now.end_of_day)
issues = issues.where('issues.updated_on between ? and ?', update_begin_date&.present? ? update_begin_date.to_time.beginning_of_week : Time.now.beginning_of_week, update_end_date&.present? ? update_end_date.to_time.end_of_week : Time.now.end_of_week)
end
# keyword

View File

@ -30,7 +30,11 @@ json.pm_issue_type issue.pm_issue_type
json.pm_sprint_id issue.pm_sprint_id
json.pm_project_id issue.pm_project_id
json.time_scale issue.time_scale
json.child_count issue.child_count
if params[:pm_issue_types].present?
json.child_count issue.children_issues.where(pm_issue_type: 4).count
else
json.child_count issue.child_count
end
json.author do
json.partial! "api/v1/users/simple_user", locals: {user: issue.user}

View File

@ -118,6 +118,7 @@ defaults format: :json do
post :sonar_initialize
post :insert_file
get :doxygen_url
end
end