Fri, 18 Dec 2020 16:09:20 +0100
Update issue "updated" date when a comment is added or changed - fixes #111
1.1 --- a/src/main/kotlin/de/uapcore/lightpit/dao/AbstractIssueDao.kt Fri Dec 18 15:54:39 2020 +0100 1.2 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/AbstractIssueDao.kt Fri Dec 18 16:09:20 2020 +0100 1.3 @@ -74,6 +74,7 @@ 1.4 /** 1.5 * Stores the specified comment in database. 1.6 * This is an update-or-insert operation. 1.7 + * The "updated" date of the corresponding issue is also updated. 1.8 * 1.9 * @param issue the issue to save the comment for 1.10 * @param comment the comment to save
2.1 --- a/src/main/kotlin/de/uapcore/lightpit/dao/postgres/PGIssueDao.kt Fri Dec 18 15:54:39 2020 +0100 2.2 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/postgres/PGIssueDao.kt Fri Dec 18 16:09:20 2020 +0100 2.3 @@ -93,6 +93,10 @@ 2.4 "select * from lpit_issue_comment left join lpit_user using (userid) where issueid = ? order by created" 2.5 ) 2.6 2.7 + private val updateIssueLastModified = connection.prepareStatement( 2.8 + "update lpit_issue set updated = now() where issueid = ?" 2.9 + ); 2.10 + 2.11 override fun mapResult(rs: ResultSet): Issue { 2.12 val project = Project(rs.getInt("project")) 2.13 project.name = rs.getString("projectname") 2.14 @@ -245,5 +249,7 @@ 2.15 setForeignKeyOrNull(insertComment, 3, comment.author, User::id) 2.16 insertComment.execute() 2.17 } 2.18 + updateIssueLastModified.setInt(1, issue.id); 2.19 + updateIssueLastModified.execute(); 2.20 } 2.21 } 2.22 \ No newline at end of file