# HG changeset patch # User Mike Becker # Date 1608304160 -3600 # Node ID 003b08bb3f251836131f14b3625f5ecf29fcc169 # Parent a5b9632729b6cd980c7824736975b61ecb2f472e Update issue "updated" date when a comment is added or changed - fixes #111 diff -r a5b9632729b6 -r 003b08bb3f25 src/main/kotlin/de/uapcore/lightpit/dao/AbstractIssueDao.kt --- a/src/main/kotlin/de/uapcore/lightpit/dao/AbstractIssueDao.kt Fri Dec 18 15:54:39 2020 +0100 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/AbstractIssueDao.kt Fri Dec 18 16:09:20 2020 +0100 @@ -74,6 +74,7 @@ /** * Stores the specified comment in database. * This is an update-or-insert operation. + * The "updated" date of the corresponding issue is also updated. * * @param issue the issue to save the comment for * @param comment the comment to save diff -r a5b9632729b6 -r 003b08bb3f25 src/main/kotlin/de/uapcore/lightpit/dao/postgres/PGIssueDao.kt --- a/src/main/kotlin/de/uapcore/lightpit/dao/postgres/PGIssueDao.kt Fri Dec 18 15:54:39 2020 +0100 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/postgres/PGIssueDao.kt Fri Dec 18 16:09:20 2020 +0100 @@ -93,6 +93,10 @@ "select * from lpit_issue_comment left join lpit_user using (userid) where issueid = ? order by created" ) + private val updateIssueLastModified = connection.prepareStatement( + "update lpit_issue set updated = now() where issueid = ?" + ); + override fun mapResult(rs: ResultSet): Issue { val project = Project(rs.getInt("project")) project.name = rs.getString("projectname") @@ -245,5 +249,7 @@ setForeignKeyOrNull(insertComment, 3, comment.author, User::id) insertComment.execute() } + updateIssueLastModified.setInt(1, issue.id); + updateIssueLastModified.execute(); } } \ No newline at end of file