2. add testing function controller 3. null checking for join datedevelop
@@ -84,7 +84,7 @@ open class MailService( | |||||
if (mailRequest.from != null) { | if (mailRequest.from != null) { | ||||
helper.setFrom(mailRequest.from!!) | helper.setFrom(mailRequest.from!!) | ||||
} else { | } else { | ||||
helper.setFrom(settingsService.getString(SettingNames.MAIL_SMTP_USERNAME)) | |||||
helper.setFrom("Timesheet Reminder <" + settingsService.getString(SettingNames.MAIL_SMTP_USERNAME) + ">") | |||||
} | } | ||||
if (mailRequest.priority != null) helper.setPriority(mailRequest.priority!!) | if (mailRequest.priority != null) helper.setPriority(mailRequest.priority!!) | ||||
@@ -48,4 +48,9 @@ class MailController( | |||||
fun test7thStaffList(){ | fun test7thStaffList(){ | ||||
mailReminderService.test7thStaffList() | mailReminderService.test7thStaffList() | ||||
} | } | ||||
@GetMapping("/test15th-staff-list") | |||||
fun test15thStaffList(){ | |||||
mailReminderService.test15thStaffList() | |||||
} | |||||
} | } |
@@ -29,4 +29,9 @@ open class BuildingType : IdEntity<Long>() { | |||||
final override fun hashCode(): Int = | final override fun hashCode(): Int = | ||||
if (this is HibernateProxy) this.hibernateLazyInitializer.persistentClass.hashCode() else javaClass.hashCode() | if (this is HibernateProxy) this.hibernateLazyInitializer.persistentClass.hashCode() else javaClass.hashCode() | ||||
fun startsWith(prefix: String, ignoreCase: Boolean = false): Boolean { | |||||
if (this.name == null) return false | |||||
return this.name!!.startsWith(prefix, ignoreCase) | |||||
} | |||||
} | } |
@@ -495,7 +495,14 @@ open class ProjectsService( | |||||
} | } | ||||
open fun allBuildingTypes(): List<BuildingType> { | open fun allBuildingTypes(): List<BuildingType> { | ||||
return buildingTypeRepository.findAll() | |||||
val sortedBuildingType = buildingTypeRepository.findAll().sortedBy { it.name }.sortedWith { a, b -> | |||||
when { | |||||
a.startsWith("Others") && !b.startsWith("Others") -> 1 // Move "Others" to the end | |||||
!a.startsWith("Others") && b.startsWith("Others") -> -1 // Keep non-"Others" items above | |||||
else -> 0 // Maintain relative order for other items | |||||
} | |||||
} | |||||
return sortedBuildingType; | |||||
} | } | ||||
open fun allWorkNatures(): List<WorkNature> { | open fun allWorkNatures(): List<WorkNature> { | ||||