diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb index 8f7b0b8b6..dac4d65d3 100644 --- a/app/controllers/api/pm/weekly_issues_controller.rb +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -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') diff --git a/app/controllers/api/v1/sonarqubes_controller.rb b/app/controllers/api/v1/sonarqubes_controller.rb index c6f718de0..95e41b750 100644 --- a/app/controllers/api/v1/sonarqubes_controller.rb +++ b/app/controllers/api/v1/sonarqubes_controller.rb @@ -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], diff --git a/app/services/api/pm/issues/create_service.rb b/app/services/api/pm/issues/create_service.rb index 20c5a1219..3003869ea 100644 --- a/app/services/api/pm/issues/create_service.rb +++ b/app/services/api/pm/issues/create_service.rb @@ -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 diff --git a/app/services/api/v1/issues/list_service.rb b/app/services/api/v1/issues/list_service.rb index 6f9be57c0..0ceac0ee4 100644 --- a/app/services/api/v1/issues/list_service.rb +++ b/app/services/api/v1/issues/list_service.rb @@ -97,8 +97,8 @@ 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 查一级目录 issues = if root_id.to_i == -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 diff --git a/app/views/api/v1/issues/_simple_detail.json.jbuilder b/app/views/api/v1/issues/_simple_detail.json.jbuilder index 2c05acf7f..e361d136b 100644 --- a/app/views/api/v1/issues/_simple_detail.json.jbuilder +++ b/app/views/api/v1/issues/_simple_detail.json.jbuilder @@ -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} diff --git a/config/routes/api.rb b/config/routes/api.rb index 09cc2f065..67ff6c5e0 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -118,6 +118,7 @@ defaults format: :json do post :sonar_initialize post :insert_file + get :doxygen_url end end