ImportIssueWorklog imports csv file into the table `issue_worklogs`
(boardId string, file io.ReadCloser, incremental bool)
| 670 | |
| 671 | // ImportIssueWorklog imports csv file into the table `issue_worklogs` |
| 672 | func (s *Service) ImportIssueWorklog(boardId string, file io.ReadCloser, incremental bool) errors.Error { |
| 673 | if !incremental { |
| 674 | err := s.dal.Delete( |
| 675 | &ticket.IssueWorklog{}, |
| 676 | dal.Where("issue_id IN (SELECT issue_id FROM board_issues WHERE board_id=? AND issue_id NOT IN (SELECT issue_id FROM board_issues WHERE board_id!=?))", boardId, boardId), |
| 677 | ) |
| 678 | if err != nil { |
| 679 | return err |
| 680 | } |
| 681 | } |
| 682 | return s.importCSV(file, boardId, s.issueWorklogHandler) |
| 683 | } |
| 684 | |
| 685 | // issueWorklogHandler saves a record into the `issue_worklogs` table |
| 686 | func (s *Service) issueWorklogHandler(record map[string]interface{}) errors.Error { |