MCPcopy Create free account
hub / github.com/apache/devlake / issueChangelogHandler

Method issueChangelogHandler

backend/plugins/customize/service/service.go:624–669  ·  view source on GitHub ↗

issueChangelogHandler saves a record into the `issue_changelogs` table

(record map[string]interface{})

Source from the content-addressed store, hash-verified

622
623// issueChangelogHandler saves a record into the `issue_changelogs` table
624func (s *Service) issueChangelogHandler(record map[string]interface{}) errors.Error {
625 // create account
626 authorName, err := getStringField(record, "author_name", false)
627 if err != nil {
628 return err
629 }
630 rawDataParams, err := getStringField(record, "_raw_data_params", true)
631 if err != nil {
632 return err
633 }
634 if authorName != "" {
635 authorId, err := s.createOrUpdateAccount(authorName, rawDataParams)
636 if err != nil {
637 return err
638 }
639 record["author_id"] = authorId
640 }
641 // set field_id = field_name
642 fieldName, err := getStringField(record, "field_name", true)
643 if err != nil {
644 return err
645 }
646 record["field_id"] = fieldName
647 // handle assignee
648 if fieldName == "assignee" {
649 originalFromValue, err := getStringField(record, "original_from_value", false)
650 if err != nil {
651 return err
652 }
653 originalToValue, err := getStringField(record, "original_to_value", false)
654 if err != nil {
655 return err
656 }
657 fromId, err := s.createOrUpdateAccount(originalFromValue, rawDataParams)
658 if err != nil {
659 return err
660 }
661 record["original_from_value"] = fromId
662 toId, err := s.createOrUpdateAccount(originalToValue, rawDataParams)
663 if err != nil {
664 return err
665 }
666 record["original_to_value"] = toId
667 }
668 return s.dal.CreateWithMap(&ticket.IssueChangelogs{}, record)
669}
670
671// ImportIssueWorklog imports csv file into the table `issue_worklogs`
672func (s *Service) ImportIssueWorklog(boardId string, file io.ReadCloser, incremental bool) errors.Error {

Callers

nothing calls this directly

Calls 3

createOrUpdateAccountMethod · 0.95
getStringFieldFunction · 0.70
CreateWithMapMethod · 0.65

Tested by

no test coverage detected