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