This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch fix#6830
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/fix#6830 by this push:
new 388041b26 fix: the value of incidents priority is P2, but shown in
'HIGH' in DevLake
388041b26 is described below
commit 388041b261541998e00303210ac127f04d721f41
Author: abeizn <[email protected]>
AuthorDate: Wed Jan 17 18:47:49 2024 +0800
fix: the value of incidents priority is P2, but shown in 'HIGH' in DevLake
---
backend/core/models/domainlayer/ticket/issue.go | 1 +
.../20240117_add_urgency_to_issues.go | 52 ++++++++++++++++++++++
backend/core/models/migrationscripts/register.go | 1 +
.../plugins/pagerduty/tasks/incidents_converter.go | 4 +-
4 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/backend/core/models/domainlayer/ticket/issue.go
b/backend/core/models/domainlayer/ticket/issue.go
index 8c8a9c067..13d2c1b03 100644
--- a/backend/core/models/domainlayer/ticket/issue.go
+++ b/backend/core/models/domainlayer/ticket/issue.go
@@ -50,6 +50,7 @@ type Issue struct {
ParentIssueId string `gorm:"type:varchar(255)"`
Priority string `gorm:"type:varchar(255)"`
Severity string `gorm:"type:varchar(255)"`
+ Urgency string `gorm:"type:varchar(255)"`
Component string `gorm:"type:varchar(255)"`
OriginalProject string `gorm:"type:varchar(255)"`
}
diff --git
a/backend/core/models/migrationscripts/20240117_add_urgency_to_issues.go
b/backend/core/models/migrationscripts/20240117_add_urgency_to_issues.go
new file mode 100644
index 000000000..24af60c2e
--- /dev/null
+++ b/backend/core/models/migrationscripts/20240117_add_urgency_to_issues.go
@@ -0,0 +1,52 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package migrationscripts
+
+import (
+ "github.com/apache/incubator-devlake/core/context"
+ "github.com/apache/incubator-devlake/core/errors"
+ "github.com/apache/incubator-devlake/core/plugin"
+)
+
+var _ plugin.MigrationScript = (*addUrgencyToIssues)(nil)
+
+type issue20240117 struct {
+ Urgency string `gorm:"type:varchar(255)"`
+}
+
+func (issue20240117) TableName() string {
+ return "issues"
+}
+
+type addUrgencyToIssues struct{}
+
+func (u *addUrgencyToIssues) Up(basicRes context.BasicRes) errors.Error {
+ db := basicRes.GetDal()
+ if err := db.AutoMigrate(&issue20240117{}); err != nil {
+ return err
+ }
+ return nil
+}
+
+func (*addUrgencyToIssues) Version() uint64 {
+ return 20240117142100
+}
+
+func (*addUrgencyToIssues) Name() string {
+ return "add urgency to issues table"
+}
diff --git a/backend/core/models/migrationscripts/register.go
b/backend/core/models/migrationscripts/register.go
index 74377d7d0..667f864b0 100644
--- a/backend/core/models/migrationscripts/register.go
+++ b/backend/core/models/migrationscripts/register.go
@@ -105,5 +105,6 @@ func All() []plugin.MigrationScript {
new(addCommitMsgtoPipelineCommit),
new(modfiyFieldsSort),
new(modifyIssueLeadTimeMinutesToUint),
+ new(addUrgencyToIssues),
}
}
diff --git a/backend/plugins/pagerduty/tasks/incidents_converter.go
b/backend/plugins/pagerduty/tasks/incidents_converter.go
index c10f286b5..c84924f77 100644
--- a/backend/plugins/pagerduty/tasks/incidents_converter.go
+++ b/backend/plugins/pagerduty/tasks/incidents_converter.go
@@ -101,8 +101,8 @@ func ConvertIncidents(taskCtx plugin.SubTaskContext)
errors.Error {
CreatedDate: &incident.CreatedDate,
UpdatedDate: &incident.UpdatedDate,
LeadTimeMinutes: leadTime,
- Priority: string(incident.Urgency),
- Severity: incident.Priority,
+ Priority: incident.Priority,
+ Urgency: string(incident.Urgency),
}
var result []interface{}
if combined.User != nil {