Comments (4)
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.
This issue has been automatically marked as stale because it has been inactive for 60 days. It will be closed in next 7 days if no further activity occurs.
from incubator-devlake.
This issue has been closed because it has been inactive for a long time. You can reopen it if you encounter the similar problem in the future.
from incubator-devlake.
Related Issues (20)
- [Bug][Backend] fatal error: concurrent map writes
- [Bug][gitextractor] Error running pipeline beta5 HOT 10
- [Bug][Github] Pull Requests not being updated HOT 1
- [Bug][Sonarcube] Data too long for column 'component' at row 12 HOT 1
- [Bug][Github] Table 'pull_request_assignees' & 'pull_request_reviewers' has no user data from Github HOT 7
- Question about RDS Devlake HOT 21
- [Question][DORA] About the logic of ‘Median Lead Time for Changes‘ HOT 10
- [Feature][Azure DevOps Go] Add TFVC Repository Support in DevLake Plugin for Azure DevOps Go
- [Question]Getting file info HOT 13
- [Bug][TimeAfter] Bug title The timeAfter parameter in the DevLake sync API isn't functioning as expected. HOT 2
- [Feature][Config UI] Support favorites in project list
- [Bug][CircleCI] Regex Matches Workflows but Fails to Match Jobs HOT 9
- [Feature][Webhook] Allow cleanup for (deployment/incident) data collected by a webhook
- [Question] Including the gitextractor and customize plugin in new GHE blueprint HOT 3
- [Question]How do I modify this so that it records file names that were updated during git commits/pull requests HOT 5
- [Bug][Framework] fields are empty in table `_devlake_subtasks`
- [Bug][Grafana] Monthly Deployment SQL Filter HOT 2
- Unable to access config-ui after resetting the admin password in Grafana HOT 1
- [Bug][jira] field_id is empty in issue_changelogs HOT 1
- [Question][Module Name] Question title HOT 1
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.