Comments (2)
Hey @Challen-V! I'm here to help you with any bugs, questions, or contributions you have for the project. Looking forward to assisting you!
To address the issue where DevLake is not syncing the status of deleted issues from Jira, you need to ensure that the deletion of issues is properly handled in the extractIssues
function. Currently, the provided code does not include logic to handle deleted issues.
You can add a check to see if an issue has been deleted and then mark it accordingly. Here is a modified version of the extractIssues
function to include this logic:
func extractIssues(data *JiraTaskData, mappings *typeMappings, row *api.RawData) ([]interface{}, errors.Error) {
var apiIssue apiv2models.Issue
err := errors.Convert(json.Unmarshal(row.Data, &apiIssue))
if err != nil {
return nil, err
}
err = apiIssue.SetAllFields(row.Data)
if err != nil {
return nil, err
}
var results []interface{}
// if the field `created` is nil, ignore it
if apiIssue.Fields.Created == nil {
return results, nil
}
sprints, issue, comments, worklogs, changelogs, changelogItems, users := apiIssue.ExtractEntities(data.Options.ConnectionId)
for _, sprintId := range sprints {
sprintIssue := &models.JiraSprintIssue{
ConnectionId: data.Options.ConnectionId,
SprintId: sprintId,
IssueId: issue.IssueId,
IssueCreatedDate: &issue.Created,
ResolutionDate: issue.ResolutionDate,
}
results = append(results, sprintIssue)
}
if issue.ResolutionDate != nil {
temp := uint(issue.ResolutionDate.Unix()-issue.Created.Unix()) / 60
issue.LeadTimeMinutes = &temp
}
if data.Options.ScopeConfig != nil && data.Options.ScopeConfig.StoryPointField != "" {
unknownStoryPoint := apiIssue.Fields.AllFields[data.Options.ScopeConfig.StoryPointField]
switch sp := unknownStoryPoint.(type) {
case string:
// string, try to parse
temp, _ := strconv.ParseFloat(sp, 32)
issue.StoryPoint = &temp
case nil:
default:
// not string, convert to float64, ignore it if failed
temp, _ := unknownStoryPoint.(float64)
issue.StoryPoint = &temp
}
}
// Check if the issue is deleted
if apiIssue.Fields.Resolution != nil && strings.ToLower(apiIssue.Fields.Resolution.Name) == "deleted" {
issue.StdStatus = "DELETED"
} else {
// code in next line will set issue.Type to issueType.Name
issue.Type = mappings.typeIdMappings[issue.Type]
issue.StdType = mappings.stdTypeMappings[issue.Type]
if issue.StdType == "" {
issue.StdType = strings.ToUpper(issue.Type)
}
issue.StdStatus = getStdStatus(issue.StatusKey)
if value, ok := mappings.standardStatusMappings[issue.Type][issue.StatusKey]; ok {
issue.StdStatus = value.StandardStatus
}
}
// issue comments
results = append(results, issue)
for _, comment := range comments {
results = append(results, comment)
}
// worklogs
for _, worklog := range worklogs {
results = append(results, worklog)
}
var issueUpdated *time.Time
// likely this issue has more changelogs to be collected
if len(changelogs) == 100 {
issueUpdated = nil
} else {
issueUpdated = &issue.Updated
}
// changelogs
for _, changelog := range changelogs {
changelog.IssueUpdated = issueUpdated
results = append(results, changelog)
}
// changelog items
for _, changelogItem := range changelogItems {
results = append(results, changelogItem)
}
// users
for _, user := range users {
if user.AccountId != "" {
results = append(results, user)
}
}
results = append(results, &models.JiraBoardIssue{
ConnectionId: data.Options.ConnectionId,
BoardId: data.Options.BoardId,
IssueId: issue.IssueId,
})
// labels
labels := apiIssue.Fields.Labels
for _, v := range labels {
issueLabel := &models.JiraIssueLabel{
IssueId: issue.IssueId,
LabelName: v,
ConnectionId: data.Options.ConnectionId,
}
results = append(results, issueLabel)
}
// components
components := apiIssue.Fields.Components
var componentNames []string
for _, v := range components {
componentNames = append(componentNames, v.Name)
}
issue.Components = strings.Join(componentNames, ",")
// issuelinks
issuelinks := apiIssue.Fields.Issuelinks
for _, v := range issuelinks {
issueLink := &models.JiraIssueRelationship{
ConnectionId: data.Options.ConnectionId,
IssueId: issue.IssueId,
IssueKey: issue.IssueKey,
TypeId: v.Type.ID,
TypeName: v.Type.Name,
Inward: v.Type.Inward,
Outward: v.Type.Outward,
InwardIssueId: v.InwardIssue.ID,
InwardIssueKey: v.InwardIssue.Key,
OutwardIssueId: v.OutwardIssue.ID,
OutwardIssueKey: v.OutwardIssue.Key,
}
results = append(results, issueLink)
}
return results, nil
}
This modification checks if the issue's resolution is marked as "deleted" and sets the StdStatus
to "DELETED" accordingly. This should help in ensuring that deleted issues are properly marked and can be filtered out in Grafana [1].
Details
About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
To continue the conversation, mention @dosu.
from incubator-devlake.
Try this:
from incubator-devlake.
Related Issues (20)
- [Question][Module Name] cant connect to Jira HOT 2
- [Question][Module Name] Gitextractor cant clone repos from gitlab HOT 7
- [Question][Module Name] AxiosError: Request failed with status code 502 HOT 2
- [Question][Bitbucket] Conversion from collation utf8mb4_0900_ai_ci into utf8mb3_general_ci impossible HOT 2
- [Bug][backend] Docker build is failing HOT 4
- [Question][Module Name] Is it possible to clone Gitlab repos using SSH? HOT 4
- [Question][Deployment] Webhook: <no value> is allowed for required? HOT 2
- [Bug][gitext] Failed to clone Github private repos HOT 6
- [Bug][AzureDevOpsPlugin] Unauthorized request HOT 8
- [Feature][Keycloak] Can't add SSO in Apache Devlake.
- [Bug][JiraPlugin] Failing on "collectIssues" subtask HOT 9
- [Feature][Convertor] Add data processing for Issue tracking to compute issue status and assignee history HOT 1
- [Bug][Config UI] I can still add an existing scope in AzureDevops
- [Feature][GitLab] Add assignees and reviewers to table.pull_requests
- [Bug][Module Name] my data doesnt show on the dashboard can someone help me please HOT 3
- [Refactor][DORA] Refactor CalculateChangeLeadTimeMeta subtask HOT 2
- [Feature][PagerDuty] Change Incident Times HOT 5
- [Bug][PagerDuty] not enough info for Pagerduty execution (400) HOT 3
- [Bug][Module Name] AxiosError: Request failed with status code 500 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from incubator-devlake.