MCPcopy Index your code
hub / github.com/apache/devlake / ImportSprint

Method ImportSprint

backend/plugins/customize/service/service.go:568–586  ·  view source on GitHub ↗

ImportSprint imports csv file into the table `sprints`

(boardId string, file io.ReadCloser, incremental bool)

Source from the content-addressed store, hash-verified

566
567// ImportSprint imports csv file into the table `sprints`
568func (s *Service) ImportSprint(boardId string, file io.ReadCloser, incremental bool) errors.Error {
569 if !incremental {
570 err := s.dal.Delete(
571 &ticket.Sprint{},
572 dal.Where("id IN (SELECT sprint_id FROM board_sprints WHERE board_id=? AND sprint_id NOT IN (SELECT sprint_id FROM board_sprints WHERE board_id!=?))", boardId, boardId),
573 )
574 if err != nil {
575 return err
576 }
577 err = s.dal.Delete(
578 &ticket.BoardSprint{},
579 dal.Where("board_id = ?", boardId),
580 )
581 if err != nil {
582 return err
583 }
584 }
585 return s.importCSV(file, boardId, s.sprintHandler(boardId))
586}
587
588// sprintHandler saves a record into the `sprints` table
589func (s *Service) sprintHandler(boardId string) func(record map[string]interface{}) errors.Error {

Callers 1

TestImportSprintDataFlowFunction · 0.95

Calls 3

importCSVMethod · 0.95
sprintHandlerMethod · 0.95
DeleteMethod · 0.65

Tested by 1

TestImportSprintDataFlowFunction · 0.76