|
|
|
|
@ -67,20 +67,19 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate { |
|
|
|
|
currentSession = sessionRealm |
|
|
|
|
sessionHasBeenCustomized = true |
|
|
|
|
} else { |
|
|
|
|
realm.beginTransaction() |
|
|
|
|
currentSession = Session.newInstance(realm, isTournament) |
|
|
|
|
realm.executeTransaction { executeRealm -> |
|
|
|
|
currentSession = Session.newInstance(executeRealm, isTournament) |
|
|
|
|
FavoriteSessionFinder.copyParametersFromFavoriteSession(currentSession, null, requireContext()) |
|
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// Find the nearest location around the user |
|
|
|
|
parentActivity?.findNearestLocation { |
|
|
|
|
it?.let { location -> |
|
|
|
|
realm.beginTransaction() |
|
|
|
|
val realmLocation = realm.findById<Location>(location.id) |
|
|
|
|
realm.executeTransaction { executeRealm -> |
|
|
|
|
val realmLocation = executeRealm.findById<Location>(location.id) |
|
|
|
|
FavoriteSessionFinder.copyParametersFromFavoriteSession(currentSession, realmLocation, requireContext()) |
|
|
|
|
|
|
|
|
|
currentSession.location = realmLocation |
|
|
|
|
realm.commitTransaction() |
|
|
|
|
} |
|
|
|
|
updateSessionUI(true) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|