Minor improvements

multistore
Laurent 2 years ago
parent dd7b6c8b34
commit b68a7e5513
  1. 6
      PadelClub/Data/DataStore.swift
  2. 2
      PadelClub/Data/README.md

@ -59,8 +59,6 @@ class DataStore: ObservableObject {
store.synchronizationApiURL = "https://xlr.alwaysdata.net/api/" store.synchronizationApiURL = "https://xlr.alwaysdata.net/api/"
var synchronized : Bool = true var synchronized : Bool = true
self.user = User.placeHolder() // force the didSet
#if DEBUG #if DEBUG
if let server = PListReader.readString(plist: "local", key: "server") { if let server = PListReader.readString(plist: "local", key: "server") {
store.synchronizationApiURL = server store.synchronizationApiURL = server
@ -109,9 +107,7 @@ class DataStore: ObservableObject {
@objc func collectionDidLoad(notification: Notification) { @objc func collectionDidLoad(notification: Notification) {
self.objectWillChange.send() self.objectWillChange.send()
if let userSingleton: StoredSingleton<User> = notification.object as? StoredSingleton<User> { if let userSingleton: StoredSingleton<User> = notification.object as? StoredSingleton<User> {
Logger.log("StoredObject<User> loaded with user = \(String(describing: userSingleton.item()))") self.user = userSingleton.item() ?? self._temporaryLocalUser.item ?? User.placeHolder()
self.user = userSingleton.item() ?? User.placeHolder()
} else if let clubsCollection: StoredCollection<Club> = notification.object as? StoredCollection<Club> { } else if let clubsCollection: StoredCollection<Club> = notification.object as? StoredCollection<Club> {
self._fixMissingClubCreatorIfNecessary(clubsCollection) self._fixMissingClubCreatorIfNecessary(clubsCollection)
} else if let eventsCollection: StoredCollection<Event> = notification.object as? StoredCollection<Event> { } else if let eventsCollection: StoredCollection<Event> = notification.object as? StoredCollection<Event> {

@ -11,7 +11,7 @@ Dans Django:
- Ajouter le champ dans la classe - Ajouter le champ dans la classe
- S'il c'est un champ dans **CustomUser**: - S'il c'est un champ dans **CustomUser**:
- Ajouter le champ à la méthode fields_for_update - Ajouter le champ à la méthode fields_for_update
- s’assurer que ca casse pas la creation de user dans serializers.py - Ajouter le champ dans UserSerializer > create > create_user dans serializers.py
- Faire le *makemigrations* + *migrate* - Faire le *makemigrations* + *migrate*

Loading…
Cancel
Save