|
|
@@ -41,15 +41,15 @@ open class TeamService( |
|
|
|
val ids = req.addStaffIds!! |
|
|
|
// println(ids) |
|
|
|
val teamLead = staffRepository.findById(ids[0]).orElseThrow() |
|
|
|
val teamName = "Team " + teamLead.name |
|
|
|
|
|
|
|
val initials = teamLead.name.split(" ").map { it.first() } |
|
|
|
val teamCode = initials.joinToString("") |
|
|
|
// val teamName = "Team " + teamLead.name |
|
|
|
// |
|
|
|
// val initials = teamLead.name.split(" ").map { it.first() } |
|
|
|
// val teamCode = initials.joinToString("") |
|
|
|
|
|
|
|
val team = Team().apply { |
|
|
|
this.staff = teamLead |
|
|
|
name = teamName |
|
|
|
code = teamCode |
|
|
|
name = req.name |
|
|
|
code = req.code |
|
|
|
description = req.description |
|
|
|
} |
|
|
|
teamRepository.saveAndFlush(team) |
|
|
@@ -73,11 +73,12 @@ open class TeamService( |
|
|
|
|
|
|
|
if (addIds.isNotEmpty()) { |
|
|
|
val leader = staffRepository.findById(addIds[0].toLong()).orElseThrow() |
|
|
|
teamName = "Team " + leader.name |
|
|
|
// teamName = "Team " + leader.name |
|
|
|
teamName = req.name |
|
|
|
teamLead = leader; |
|
|
|
|
|
|
|
val initials = leader.name.split(" ").map { it.first() } |
|
|
|
teamCode = initials.joinToString("") |
|
|
|
// val initials = leader.name.split(" ").map { it.first() } |
|
|
|
// teamCode = initials.joinToString("") |
|
|
|
teamCode = req.code |
|
|
|
} else { |
|
|
|
teamLead = team.staff |
|
|
|
teamName = team.name |
|
|
|