diff --git a/app/controllers/api/pm/base_controller.rb b/app/controllers/api/pm/base_controller.rb index f9754f33d..e0ebd1aca 100644 --- a/app/controllers/api/pm/base_controller.rb +++ b/app/controllers/api/pm/base_controller.rb @@ -30,8 +30,8 @@ class Api::Pm::BaseController < ApplicationController end def load_issue - return render_parameter_missing if params[:pm_project_id].blank? - @issue = Issue.issue_issue.where(pm_project_id: params[:pm_project_id]).find_by_id(params[:issue_id]) + # return render_parameter_missing if params[:pm_project_id].blank? + @issue = Issue.issue_issue.find_by_id(params[:issue_id]) render_not_found('疑修不存在!') if @issue.blank? end # 具有对仓库的管理权限 diff --git a/app/controllers/api/pm/issues_controller.rb b/app/controllers/api/pm/issues_controller.rb index 49cb5295c..eef8015e0 100644 --- a/app/controllers/api/pm/issues_controller.rb +++ b/app/controllers/api/pm/issues_controller.rb @@ -284,11 +284,18 @@ class Api::Pm::IssuesController < Api::Pm::BaseController end def load_issue - return render_parameter_missing if params[:pm_project_id].blank? - @issue = Issue.issue_issue.where(pm_project_id: params[:pm_project_id]).find_by_id(params[:id]) + # return render_parameter_missing if params[:pm_project_id].blank? + @issue = Issue.issue_issue.find_by_id(params[:id]) render_not_found('疑修不存在!') if @issue.blank? end + # def load_issue_by_index + # return render_parameter_missing if params[:pm_project_id].blank? || params[:pm_issue_type].blank? || params[:enterprise_identifier].blank? + # @issue = Issue.find_issues_by_pm(params[:enterprise_identifier], params[:pm_issue_type]) + # .find_by(pm_issue_type_index3: params[:index]) + # render_not_found('疑修不存在!') if @issue.blank? + # end + def load_issues return render_error('请输入正确的ID数组!') unless params[:ids].is_a?(Array) params[:ids].each do |id| @@ -315,7 +322,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController :update_begin_date, :update_end_date, :sort_by, :sort_direction, :root_id, :issue_tag_ids, :pm_project_id, :pm_sprint_id, :pm_issue_type, :pm_project_ids, - :status_ids, :ids, :exclude_ids, :pm_issue_types, :participator_id + :status_ids, :ids, :exclude_ids, :pm_issue_types, :participator_id, :enterprise_identifier ) end @@ -327,6 +334,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController :branch_name, :start_date, :due_date, :time_scale, :subject, :description, :blockchain_token_num, :root_subject, :pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id, :link_able_id, :project_id, + :status_msg, :enterprise_identifier, issue_tag_ids: [], assigner_ids: [], attachment_ids: [], diff --git a/app/controllers/api/pm/weekly_issues_controller.rb b/app/controllers/api/pm/weekly_issues_controller.rb new file mode 100644 index 000000000..dac4d65d3 --- /dev/null +++ b/app/controllers/api/pm/weekly_issues_controller.rb @@ -0,0 +1,82 @@ +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: ['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') + @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 = @next_week_all_issues.order('created_on desc') + @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) + @this_week_bug_issues = @this_week_all_issues.where(pm_issue_type: 3) + @close_requirement_issues = @this_week_requirement_issues.where(status_id: [3,5]) + @close_task_issues = @this_week_task_issues.where(status_id: [3,5]) + @close_bug_issues = @this_week_bug_issues.where(status_id: [3,5]) + this_week_page = params[:this_week_page] || 1 + this_week_limit = params[:this_week_limit] || 15 + @this_week_all_issues = @this_week_all_issues.page(this_week_page).per(this_week_limit) + next_week_page = params[:next_week_page] || 1 + next_week_limit = params[:next_week_limit] || 15 + @next_week_all_issues = @next_week_all_issues.page(next_week_page).per(next_week_limit) + end + + def group + @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) + @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| + this_project_id_requirements = @this_week_all_issues.where(pm_project_id: pm_project_id, pm_issue_type: 1) + this_project_id_tasks = @this_week_all_issues.where(pm_project_id: pm_project_id, pm_issue_type: 2) + this_project_id_bugs = @this_week_all_issues.where(pm_project_id: pm_project_id, pm_issue_type: 3) + this_project_id_close_requirements = this_project_id_requirements.where(status_id: [3,5]) + this_project_id_close_tasks = this_project_id_tasks.where(status_id: [3,5]) + this_project_id_close_bugs = this_project_id_bugs.where(status_id: [3,5]) + data[pm_project_id] = { + this_week_requirement_issues_count: this_project_id_requirements.count, + this_week_task_issues_count: this_project_id_tasks.count, + this_week_bug_issues_count: this_project_id_bugs.count, + close_requirement_issues_count: this_project_id_close_requirements.count, + close_task_issues_count: this_project_id_close_tasks.count, + close_bug_issues_count: this_project_id_close_bugs.count, + this_week_task_issues: this_project_id_tasks + } + + + end + + render :json => data + end + + def group_issues + @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? + @all_issues = @all_issues.where(pm_issue_type: params[:pm_issue_type].to_i) if params[:pm_issue_type].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) + @this_week_all_issues = @this_week_all_issues.order('created_on desc') + @this_week_all_issues = kaminari_paginate(@this_week_all_issues) + end + 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: ['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') + @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 = @next_week_all_issues.order('created_on desc') + this_week_page = params[:this_week_page] || 1 + this_week_limit = params[:this_week_limit] || 15 + @this_week_all_issues = @this_week_all_issues.page(this_week_page).per(this_week_limit) + next_week_page = params[:next_week_page] || 1 + next_week_limit = params[:next_week_limit] || 15 + @next_week_all_issues = @next_week_all_issues.page(next_week_page).per(next_week_limit) + end +end + diff --git a/app/controllers/concerns/laboratory_helper.rb b/app/controllers/concerns/laboratory_helper.rb index ccdc4df14..542c0744d 100644 --- a/app/controllers/concerns/laboratory_helper.rb +++ b/app/controllers/concerns/laboratory_helper.rb @@ -35,7 +35,6 @@ module LaboratoryHelper end def default_course_links - { # new_syllabuses: "https://www.trustie.net/syllabuses/new", # new_course: "https://www.trustie.net/courses/new", diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index 3a2463a46..154f4c75b 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -1,6 +1,5 @@ class SettingsController < ApplicationController def show - @old_projects_url = nil get_navbar #site_page_deploy_domain get_add_menu @@ -8,7 +7,7 @@ class SettingsController < ApplicationController #get_sub_competitions get_other_setting get_personal_menu - get_third_party + # get_third_party get_third_party_new get_professional_fields get_top_system_notification diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 5797e68e9..b3d1bda5d 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -161,6 +161,7 @@ module RepositoriesHelper s_content = s_content.starts_with?("/") ? s_content[1..-1] : s_content[0..-1] s_content = File.expand_path(s_content, file_path) s_content = s_content.split("#{Rails.root}/")[1] + next if s_content.blank? # content = content.gsub(s[0], "/#{s_content}") join_xxx = s_content.include?("?") ? "&" : "?" s_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw/#{s_content}#{join_xxx}ref=#{ref}"].join @@ -190,6 +191,7 @@ module RepositoriesHelper path = [owner&.login, repo&.identifier, 'tree', ref, file_path].join("/") s_content = File.expand_path(s_content, path) s_content = s_content.split("#{Rails.root}")[1] + next if s_content.blank? case k.to_s when 'ss_src' content = content.gsub("src=\"#{s[0]}\"", "src=\"/#{s_content}\"") @@ -201,8 +203,8 @@ module RepositoriesHelper content = content.gsub("href=\"#{s[0]}\"", "href=\"#{s_content}\"") when 'ss_href_1' content = content.gsub("href=\'#{s[0]}\'", "href=\'#{s_content}\'") - else - content = content.gsub("(#{s[0]})", "(/#{s_content})") + else + content = content.gsub("(#{s[0]})", "(#{s_content})") end end rescue diff --git a/app/models/commit_log.rb b/app/models/commit_log.rb index d351e6f48..5f9b6c3f8 100644 --- a/app/models/commit_log.rb +++ b/app/models/commit_log.rb @@ -24,7 +24,7 @@ class CommitLog < ApplicationRecord belongs_to :user belongs_to :project - belongs_to :repository + # belongs_to :repository has_many :project_trends, as: :trend, dependent: :destroy diff --git a/app/models/issue.rb b/app/models/issue.rb index 4c8859865..06a7e8091 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -299,6 +299,38 @@ class Issue < ApplicationRecord self.project.decrement!(:closed_issues_count) if self.status_id == 5 && self.project.present? end + # def self.find_issues_by_pm(enterprise_identifier, pm_issue_type) + # case pm_issue_type.to_i + # when 1 + # Issue.issue_issue.where(enterprise_identifier: enterprise_identifier) + # .where(pm_issue_type: pm_issue_type) + # .where(pm_issue_type_index1: index) + # when 2 + # Issue.issue_issue.where(enterprise_identifier: enterprise_identifier) + # .where(pm_issue_type: pm_issue_type) + # .where(pm_issue_type_index2: index) + # when 3 + # Issue.issue_issue.where(enterprise_identifier: enterprise_identifier) + # .where(pm_issue_type: pm_issue_type) + # .where(pm_issue_type_index3: index) + # end + # end + # + # def self.build_pm_index(enterprise_identifier, pm_issue_type) + # last_issue = Issue.find_issues_by_pm(enterprise_identifier, pm_issue_type).order("pm_issue_type_index#{pm_issue_type.to_i} asc").last + # deleted_issue_count = ($redis_cache.hget("pm_issue_cache_delete_count", enterprise_identifier) || 0).to_i + # + # last_issue.send("pm_issue_type_index#{pm_issue_type.to_i}").present? ? last_issue.send("pm_issue_type_index#{pm_issue_type.to_i}") + deleted_issue_count : 0 + # end + # + # def incre_pm_issue_cache_delete_count(count=1) + # $redis_cache.hincrby("pm_issue_cache_delete_count", self.enterprise_identifier, count) + # end + # + # def del_pm_issue_cache_delete_count + # $redis_cache.hdel("pm_issue_cache_delete_count", self.enterprise_identifier) + # end + def send_update_message_to_notice_system SendTemplateMessageJob.perform_later('IssueExpire', self.id) if Site.has_notice_menu? && self.due_date == Date.today + 1.days end diff --git a/app/services/api/pm/issues/create_service.rb b/app/services/api/pm/issues/create_service.rb index 5412fe17d..3003869ea 100644 --- a/app/services/api/pm/issues/create_service.rb +++ b/app/services/api/pm/issues/create_service.rb @@ -5,7 +5,7 @@ class Api::Pm::Issues::CreateService < ApplicationService attr_reader :project, :current_user attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num, :root_subject - attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login + attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login, :enterprise_identifier, :pm_issue_type attr_accessor :created_issue validates :subject, presence: true @@ -36,6 +36,7 @@ class Api::Pm::Issues::CreateService < ApplicationService @time_scale = params[:time_scale] @linkable_id = params[:link_able_id] @root_subject = params[:root_subject] + @enterprise_identifier = params[:enterprise_identifier] end def call @@ -56,10 +57,10 @@ class Api::Pm::Issues::CreateService < ApplicationService try_lock("Api::Pm::Issues::CreateService:#{project.id}") # 开始写数据,加锁 @created_issue = Issue.new(issue_attributes) @created_issue.pm_issue_type = @pm_issue_type - if @root_subject.present? && @pm_issue_type.to_i == 4 - @root_issue = Issue.find_by(subject: @root_subject, pm_issue_type: 4, pm_project_id: @pm_project_id) + 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, pm_project_id: @pm_project_id, 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 @@ -74,6 +75,7 @@ class Api::Pm::Issues::CreateService < ApplicationService @created_issue.attachments = @attachments unless attachment_ids.blank? @created_issue.issue_tags = @issue_tags unless issue_tag_ids.blank? @created_issue.pm_project_id = @pm_project_id + @created_issue.enterprise_identifier = @enterprise_identifier @created_issue.pm_sprint_id = @pm_sprint_id @created_issue.time_scale = @time_scale @created_issue.issue_tags_value = @issue_tags.order('id asc').pluck(:id).join(',') unless issue_tag_ids.blank? diff --git a/app/services/api/pm/issues/update_service.rb b/app/services/api/pm/issues/update_service.rb index 2f1816446..a678cc788 100644 --- a/app/services/api/pm/issues/update_service.rb +++ b/app/services/api/pm/issues/update_service.rb @@ -4,7 +4,7 @@ class Api::Pm::Issues::UpdateService < ApplicationService include Api::V1::Issues::Concerns::Loadable attr_reader :project, :issue, :current_user, :operate_by - attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num + attr_reader :status_id, :priority_id, :milestone_id, :branch_name, :start_date, :due_date, :subject, :description, :blockchain_token_num,:status_msg attr_reader :target_pm_project_id, :pm_sprint_id, :pm_issue_type, :root_id, :time_scale attr_reader :issue_tag_ids, :assigner_ids, :attachment_ids, :receivers_login, :before_issue_tag_ids, :before_assigner_ids, :project_id attr_accessor :add_assigner_ids, :previous_issue_changes, :updated_issue, :atme_receivers @@ -18,6 +18,7 @@ class Api::Pm::Issues::UpdateService < ApplicationService @current_user = current_user @operate_by = operate_by @status_id = params[:status_id] + @status_msg = params[:status_msg] @priority_id = params[:priority_id] @milestone_id = params[:milestone_id] @branch_name = params[:branch_name] @@ -201,7 +202,12 @@ class Api::Pm::Issues::UpdateService < ApplicationService # 修改状态 if @updated_issue.previous_changes["status_id"].present? journal = @updated_issue.journals.create!({user_id: current_user.id, operate_by: @operate_by}) - journal.journal_details.create!({property: @updated_issue.pm_issue_type_string, prop_key: "status_id", old_value: @updated_issue.previous_changes["status_id"][0], value: @updated_issue.previous_changes["status_id"][1]}) + journal.journal_details.create!({property: @updated_issue.pm_issue_type_string, + prop_key: "status_id", + status_msg: @status_msg, + old_value: @updated_issue.previous_changes["status_id"][0], + value: @updated_issue.previous_changes["status_id"][1]} + ) end # 修改优先级 diff --git a/app/services/api/v1/issues/list_service.rb b/app/services/api/v1/issues/list_service.rb index a86b6d875..0ceac0ee4 100644 --- a/app/services/api/v1/issues/list_service.rb +++ b/app/services/api/v1/issues/list_service.rb @@ -3,7 +3,7 @@ class Api::V1::Issues::ListService < ApplicationService attr_reader :project, :only_name, :category, :participant_category, :keyword, :author_id, :issue_tag_ids attr_reader :begin_date, :end_date, :update_begin_date, :update_end_date - attr_reader :milestone_id, :assigner_id, :status_id, :priority_id, :sort_by, :sort_direction, :current_user + attr_reader :milestone_id, :assigner_id, :status_id, :priority_id, :sort_by, :sort_direction, :current_user, :enterprise_identifier attr_reader :pm_project_id, :pm_project_ids, :pm_sprint_id, :root_id, :pm_issue_type, :status_ids, :ids, :exclude_ids, :pm_issue_types attr_accessor :queried_issues, :total_issues_count, :closed_issues_count, :opened_issues_count, :complete_issues_count, :participator @@ -30,6 +30,7 @@ class Api::V1::Issues::ListService < ApplicationService @update_begin_date = params[:update_begin_date] @update_end_date = params[:update_end_date] @sort_by = params[:sort_by].present? ? params[:sort_by] : 'issues.updated_on' + @enterprise_identifier = params[:enterprise_identifier] @pm_project_id = params[:pm_project_id] @pm_project_ids = params[:pm_project_ids] @pm_sprint_id = params[:pm_sprint_id] @@ -96,6 +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) || pm_issue_types.present?) + #pm相关 # root_id# -1 查一级目录 issues = if root_id.to_i == -1 @@ -148,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/services/api/v1/issues/update_service.rb b/app/services/api/v1/issues/update_service.rb index d92513ec5..dbdebf932 100644 --- a/app/services/api/v1/issues/update_service.rb +++ b/app/services/api/v1/issues/update_service.rb @@ -92,7 +92,7 @@ class Api::V1::Issues::UpdateService < ApplicationService @updated_issue.project_id = @project_id unless @project_id.nil? @updated_issue.updated_on = Time.now @updated_issue.changer_id = @current_user.id - @updated_issue.due_date = Time.now if @due_date.blank? + @updated_issue.due_date = Time.now if @updated_issue.status_id == 5 && @due_date.blank? @updated_issue.save! build_after_issue_journal_details if @updated_issue.previous_changes.present? # 操作记录 diff --git a/app/services/api/v1/users/delete_user_service.rb b/app/services/api/v1/users/delete_user_service.rb index 12775eac3..9f6cb4a7f 100644 --- a/app/services/api/v1/users/delete_user_service.rb +++ b/app/services/api/v1/users/delete_user_service.rb @@ -23,8 +23,8 @@ class Api::V1::Users::DeleteUserService < ApplicationService end @user.destroy! del_user_data_by_sql(@user.id) - Gitea::User::DeleteService.call(@user.login, true) end + Gitea::User::DeleteService.call(@user.login, true) return true rescue raise Error, "服务器错误,请联系系统管理员!" @@ -32,7 +32,11 @@ class Api::V1::Users::DeleteUserService < ApplicationService end def del_user_data_by_sql(user_id) - sql1 = "delete from memos where author_id=#{user_id}" - ActiveRecord::Base.connection.execute(sql1) + if ActiveRecord::Base.connection.table_exists?("memos") + sql1 = "delete from memos where author_id=#{user_id}" + ActiveRecord::Base.connection.execute(sql1) + else + Rails.logger.info "memos table does not exist" + end end end \ No newline at end of file diff --git a/app/views/api/pm/issues/journals/_detail.json.jbuilder b/app/views/api/pm/issues/journals/_detail.json.jbuilder index fdf4bc716..876a1a921 100644 --- a/app/views/api/pm/issues/journals/_detail.json.jbuilder +++ b/app/views/api/pm/issues/journals/_detail.json.jbuilder @@ -13,6 +13,7 @@ if journal.is_journal_detail? detail = journal.journal_details.take json.operate_category journal.pm_operate_category json.operate_content journal.is_journal_detail? ? journal.pm_operate_content : nil + json.status_msg detail.status_msg else json.notes journal.notes json.comments_count journal.comments_count diff --git a/app/views/api/pm/weekly_issues/group_issues.json.jbuilder b/app/views/api/pm/weekly_issues/group_issues.json.jbuilder new file mode 100644 index 000000000..b6c2a55b9 --- /dev/null +++ b/app/views/api/pm/weekly_issues/group_issues.json.jbuilder @@ -0,0 +1,4 @@ +json.total_count @this_week_all_issues.total_count +json.issues @this_week_all_issues.each do |issue| + json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} +end \ No newline at end of file diff --git a/app/views/api/pm/weekly_issues/personal.json.jbuilder b/app/views/api/pm/weekly_issues/personal.json.jbuilder new file mode 100644 index 000000000..f468445e0 --- /dev/null +++ b/app/views/api/pm/weekly_issues/personal.json.jbuilder @@ -0,0 +1,18 @@ +json.this_week_all_issues @this_week_all_issues.each do |issue| + json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} +end +json.this_week_total_count @this_week_all_issues.total_count +json.next_week_all_issues @next_week_all_issues.each do |issue| + json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} +end +json.next_week_total_count @next_week_all_issues.total_count +json.this_week_requirement_issues_count @this_week_requirement_issues.count +json.this_week_task_issues_count @this_week_task_issues.count +json.this_week_bug_issues_count @this_week_bug_issues.count +json.close_requirement_issues_count @close_requirement_issues.count +json.close_task_issues_count @close_task_issues.count +json.close_bug_issues_count @close_bug_issues.count +json.unclose_count @this_week_all_issues.count - @close_requirement_issues.count - @close_task_issues.count - @close_bug_issues.count +json.close_task_issues @close_task_issues.each do |issue| + json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} +end \ No newline at end of file diff --git a/app/views/api/pm/weekly_issues/personal_issues.json.jbuilder b/app/views/api/pm/weekly_issues/personal_issues.json.jbuilder new file mode 100644 index 000000000..0e0006226 --- /dev/null +++ b/app/views/api/pm/weekly_issues/personal_issues.json.jbuilder @@ -0,0 +1,8 @@ +json.this_week_all_issues @this_week_all_issues.each do |issue| + json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} +end +json.this_week_total_count @this_week_all_issues.total_count +json.next_week_all_issues @next_week_all_issues.each do |issue| + json.partial! "api/v1/issues/simple_detail", locals: {issue: issue} +end +json.next_week_total_count @next_week_all_issues.total_count \ No newline at end of file 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/app/views/settings/show.json.jbuilder b/app/views/settings/show.json.jbuilder index 799d21aba..5c80428e9 100644 --- a/app/views/settings/show.json.jbuilder +++ b/app/views/settings/show.json.jbuilder @@ -11,11 +11,11 @@ json.setting do json.site_page_deploy_domain @deploy_domain json.subject_banner_url default_setting.subject_banner_url&.[](1..-1) - json.course_banner_url default_setting.course_banner_url&.[](1..-1) + # json.course_banner_url default_setting.course_banner_url&.[](1..-1) json.competition_banner_url EduSetting.get("competition_banner_url").to_s json.competition_banner_href EduSetting.get("competition_banner_href").to_s - json.moop_cases_banner_url default_setting.moop_cases_banner_url&.[](1..-1) - json.oj_banner_url default_setting.oj_banner_url&.[](1..-1) + # json.moop_cases_banner_url default_setting.moop_cases_banner_url&.[](1..-1) + # json.oj_banner_url default_setting.oj_banner_url&.[](1..-1) json.navbar nav_bar diff --git a/config/routes/api.rb b/config/routes/api.rb index 778462ce1..e603ff9a5 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -6,6 +6,21 @@ defaults format: :json do get :todo get :my_issues get :my_pm_projects + end + end + resources :weekly_issues, only: [:index] do + collection do + get :personal + get :group + get :group_issues + get :personal_issues + end + end + resources :dashboards,only: [:index] do + collection do + get :todo + get :my_issues + get :my_pm_projects get :my_projects get :my_operate_journals end diff --git a/db/migrate/202505152345541_add_journal_detail_msg.rb b/db/migrate/202505152345541_add_journal_detail_msg.rb new file mode 100644 index 000000000..69172aec9 --- /dev/null +++ b/db/migrate/202505152345541_add_journal_detail_msg.rb @@ -0,0 +1,5 @@ +class AddJournalDetailMsg < ActiveRecord::Migration[5.2] + def change + add_column :journal_details, :status_msg, :string + end +end diff --git a/db/migrate/202505216348545_add_issue_enterprise.rb b/db/migrate/202505216348545_add_issue_enterprise.rb new file mode 100644 index 000000000..f3de9635f --- /dev/null +++ b/db/migrate/202505216348545_add_issue_enterprise.rb @@ -0,0 +1,7 @@ +class AddIssueEnterprise < ActiveRecord::Migration[5.2] + def change + add_column :issues, :enterprise_identifier, :string + add_index :issues, :enterprise_identifier + end + +end