Merge pull request 'nps增加明细更新' (#329) from standalone_develop into pre_trustie_server

This commit is contained in:
2025-01-23 10:55:12 +08:00
37 changed files with 2566 additions and 389 deletions

View File

@@ -17,11 +17,15 @@
# created_at :datetime not null
# updated_at :datetime not null
# label :string(255)
# node_type :string(255)
# is_mutil_link :boolean
# link_type :string(255)
#
# Indexes
#
# index_action_nodes_on_action_node_types_id (action_node_types_id)
# index_action_nodes_on_user_id (user_id)
# by_name (name)
# index_action_nodes_on_action_types_id (action_node_types_id)
# index_action_nodes_on_user_id (user_id)
#
class Action::Node < ApplicationRecord
@@ -34,7 +38,7 @@ class Action::Node < ApplicationRecord
belongs_to :user, optional: true
attr_accessor :cust_name, :run_values, :input_values
attr_accessor :cust_name, :run_values, :input_values, :parent_node_id, :sub_nodes, :link_type_array, :node_id
validates :name, presence: { message: "不能为空" }
validates :full_name, length: { maximum: 200, too_long: "不能超过200个字符" }
@@ -42,6 +46,7 @@ class Action::Node < ApplicationRecord
validates :description, length: { maximum: 65535, too_long: "不能超过65535个字符"}
def content_yaml
"foo".to_yaml
<<~YAML

View File

@@ -0,0 +1,25 @@
# == Schema Information
#
# Table name: action_pipeline_results
#
# id :integer not null, primary key
# project_id :integer
# run_id :integer
# step_id :string(255)
# job_name :string(255)
# job_show_type :string(255)
# job_result :text(65535)
# created_at :datetime not null
# updated_at :datetime not null
#
# Indexes
#
# index_action_pipeline_results_on_project_id (project_id)
# index_action_pipeline_results_on_run_id (run_id)
#
class Action::PipelineResult < ApplicationRecord
self.table_name = 'action_pipeline_results'
belongs_to :project
end

View File

@@ -0,0 +1,9 @@
class Gitea::ActionRun < Gitea::Base
self.inheritance_column = nil # FIX The single-table inheritance mechanism failed
# establish_connection :gitea_db
self.table_name = "action_run"
# belongs_to :user, class_name: '::User', primary_key: :gitea_uid, foreign_key: :owner_id, optional: true
end

View File

@@ -102,6 +102,7 @@ class Issue < ApplicationRecord
scope :issue_issue, ->{where(issue_classify: [nil, 'issue'])}
scope :issue_pull_request, ->{where(issue_classify: 'pull_request')}
scope :issue_index_includes, ->{includes(:tracker, :priority, :version, :issue_status, :journals,:issue_tags,user: :user_extension)}
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)}
after_create :incre_project_common, :incre_user_statistic, :incre_platform_statistic

View File

@@ -52,6 +52,7 @@ class Journal < ApplicationRecord
scope :journal_includes, ->{includes(:user, :journal_details, :attachments)}
scope :parent_journals, ->{where(parent_id: nil)}
scope :children_journals, lambda{|journal_id| where(parent_id: journal_id)}
scope :operate_journals, ->{where(notes: nil)}
enum state: {opened: 0, resolved: 1, disabled: 2}
@@ -103,6 +104,21 @@ class Journal < ApplicationRecord
end
end
def pm_dashboard_operate_content
content = self.pm_operate_content
if content.start_with?('创建了')
content += "<b>#{self.issue.subject}</b>"
else
prefix = '将'
prefix += "计划" if self.issue.pm_issue_type == 1
prefix += "任务" if self.issue.pm_issue_type == 2
prefix += "缺陷" if self.issue.pm_issue_type == 3
prefix += "<b>#{self.issue.subject}</b>"
content = prefix + content.sub('将', '的')
end
content
end
def pm_operate_content
content = "#{operate_by_content}"
detail = self.journal_details.take

View File

@@ -692,7 +692,11 @@ class User < Owner
# Returns the user who matches the given autologin +key+ or nil
def self.try_to_autologin(key)
user = Token.find_active_user('autologin', key)
user.update(last_login_on: Time.now) if user
if user
Rails.cache.fetch("user::update::last_login_on::#{user.id}",:expires_in => 5.minutes) do
user.update(last_login_on: Time.now)
end
end
user
end