701 //<editor-fold desc="Issue History"> |
701 //<editor-fold desc="Issue History"> |
702 |
702 |
703 override fun listIssueHistory(projectId: Int, days: Int) = |
703 override fun listIssueHistory(projectId: Int, days: Int) = |
704 withStatement( |
704 withStatement( |
705 """ |
705 """ |
706 select evt.*, evtdata.* |
706 select u.username as current_assignee, evt.*, evtdata.* |
707 from lpit_issue_history_event evt |
707 from lpit_issue_history_event evt |
708 join lpit_issue using (issueid) |
708 join lpit_issue issue using (issueid) |
|
709 left join lpit_user u on u.userid = issue.assignee |
709 join lpit_issue_history_data evtdata using (eventid) |
710 join lpit_issue_history_data evtdata using (eventid) |
710 where project = ? |
711 where project = ? |
711 and time > now() - (? * interval '1' day) |
712 and time > now() - (? * interval '1' day) |
712 order by time desc |
713 order by time desc |
713 """.trimIndent() |
714 """.trimIndent() |
717 queryAll { rs-> |
718 queryAll { rs-> |
718 with(rs) { |
719 with(rs) { |
719 IssueHistoryEntry( |
720 IssueHistoryEntry( |
720 getTimestamp("time"), |
721 getTimestamp("time"), |
721 getEnum("type"), |
722 getEnum("type"), |
|
723 getString("current_assignee"), |
722 IssueHistoryData(getInt("issueid"), |
724 IssueHistoryData(getInt("issueid"), |
723 component = getString("component") ?: "", |
725 component = getString("component") ?: "", |
724 status = getEnum("status"), |
726 status = getEnum("status"), |
725 category = getEnum("category"), |
727 category = getEnum("category"), |
726 subject = getString("subject"), |
728 subject = getString("subject"), |
727 description = getString("description") ?: "", |
729 description = getString("description") ?: "", |
728 assignee = getString("assignee") ?: "", |
730 assignee = getString("assignee") ?: "", |
729 assigneeUsername = getString("assignee_username") ?: "", |
|
730 eta = getDate("eta"), |
731 eta = getDate("eta"), |
731 affected = getString("affected") ?: "", |
732 affected = getString("affected") ?: "", |
732 resolved = getString("resolved") ?: "" |
733 resolved = getString("resolved") ?: "" |
733 ) |
734 ) |
734 ) |
735 ) |
735 } |
736 } |
736 } |
737 } |
737 } |
738 } |
738 |
739 |
|
740 override fun listIssueCommentHistory(projectId: Int, days: Int) = |
|
741 withStatement( |
|
742 """ |
|
743 select u.username as current_assignee, evt.*, evtdata.* |
|
744 from lpit_issue_history_event evt |
|
745 join lpit_issue issue using (issueid) |
|
746 left join lpit_user u on u.userid = issue.assignee |
|
747 join lpit_issue_comment_history evtdata using (eventid) |
|
748 where project = ? |
|
749 and time > now() - (? * interval '1' day) |
|
750 order by time desc |
|
751 """.trimIndent() |
|
752 ) { |
|
753 setInt(1, projectId) |
|
754 setInt(2, days) |
|
755 queryAll { rs-> |
|
756 with(rs) { |
|
757 IssueCommentHistoryEntry( |
|
758 getTimestamp("time"), |
|
759 getEnum("type"), |
|
760 getString("current_assignee"), |
|
761 IssueCommentHistoryData( |
|
762 getInt("commentid"), |
|
763 getString("comment") |
|
764 ) |
|
765 ) |
|
766 } |
|
767 } |
|
768 } |
|
769 |
739 //</editor-fold> |
770 //</editor-fold> |
740 } |
771 } |