Skip to content

Commit

Permalink
don't override student notes and metadata when moving them
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Dec 18, 2024
1 parent 6f96517 commit 9ebe29d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions modules/clas/src/main/ClasApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import lila.core.id.{ ClasId, ClasInviteId, StudentId }
import lila.core.msg.MsgApi
import lila.db.dsl.{ *, given }
import lila.rating.{ Perf, PerfType, UserPerfs }
import lila.core.user.Me.userId
import lila.clas.Student.WithUser

final class ClasApi(
colls: ClasColls,
Expand Down Expand Up @@ -260,9 +258,9 @@ final class ClasApi(
sendWelcomeMessage(teacher.id, user, clas)).inject(Student.WithPassword(student, password))
}

def move(s: WithUser, toClas: Clas)(using teacher: Me): Fu[Option[Student]] = for
def move(s: Student.WithUser, toClas: Clas)(using teacher: Me): Fu[Option[Student]] = for
_ <- closeAccount(s)
stu = Student.make(s.user, toClas, teacher.userId, s.student.realName, s.student.managed)
stu = s.student.copy(id = Student.makeId(s.user.id, toClas.id), clasId = toClas.id)
moved <- colls.student.insert
.one(stu)
.inject(stu.some)
Expand Down

0 comments on commit 9ebe29d

Please sign in to comment.