diff --git a/acrarium/src/main/kotlin/com/faendir/acra/service/DataService.kt b/acrarium/src/main/kotlin/com/faendir/acra/service/DataService.kt index e28f1a9c..ce4c794f 100644 --- a/acrarium/src/main/kotlin/com/faendir/acra/service/DataService.kt +++ b/acrarium/src/main/kotlin/com/faendir/acra/service/DataService.kt @@ -287,7 +287,8 @@ class DataService( @PreAuthorize("T(com.faendir.acra.security.SecurityUtils).hasPermission(#app, T(com.faendir.acra.model.Permission\$Level).VIEW)") fun findAllVersions(app: App): List = - JPAQuery(entityManager).from(QVersion.version).where(QVersion.version.app.eq(app)).select(QVersion.version).fetch() + JPAQuery(entityManager).from(QVersion.version).where(QVersion.version.app.eq(app)).select(QVersion.version).orderBy(QVersion.version.code.desc()) + .fetch() @PreAuthorize("T(com.faendir.acra.security.SecurityUtils).hasPermission(#app, T(com.faendir.acra.model.Permission\$Level).VIEW)") fun findMailSettings(app: App, user: User): MailSettings? = JPAQuery(entityManager).from(QMailSettings.mailSettings) @@ -299,7 +300,7 @@ class DataService( fun changeConfiguration(a: App, configuration: App.Configuration) { var app = a app.configuration = configuration - app = store(app) + store(app) } @Transactional @@ -378,7 +379,7 @@ class DataService( @PreAuthorize("T(com.faendir.acra.security.SecurityUtils).hasPermission(#app, T(com.faendir.acra.model.Permission\$Level).VIEW)") fun getFromReports(app: App, select: Expression, where: Predicate? = null, sorted: Boolean = true): List = (JPAQuery(entityManager) as JPAQuery<*>).from(QReport.report).where(QReport.report.stacktrace.bug.app.eq(app).and(where)) - .select(select).apply { if(sorted && select is ComparableExpressionBase) orderBy(select.asc()) }.distinct().fetch() + .select(select).apply { if (sorted && select is ComparableExpressionBase) orderBy(select.asc()) }.distinct().fetch() @PreAuthorize("T(com.faendir.acra.security.SecurityUtils).hasPermission(#bug.app, T(com.faendir.acra.model.Permission\$Level).VIEW)") fun getStacktraces(bug: Bug): List = @@ -425,7 +426,7 @@ class DataService( devices.forEach { store(it) } } - fun hasDeviceTableEntries() : Boolean { + fun hasDeviceTableEntries(): Boolean { return JPAQuery(entityManager).from(QDevice.device1).select(Expressions.ONE).fetchFirst() != null }