Операторы обновлений не пишут в Firestore - PullRequest
0 голосов
/ 20 апреля 2019

Когда я пытаюсь вставить в свою базу данных эти данные в качестве настройки для моего приложения при регистрации пользователя, в облаке Firestore ничего не происходит, и приложение не выдает мне никакой ошибки но все, что я вижу в макете Run, это

D/ViewRootImpl@ac77a32[SetupActivity]: ViewPostIme pointer 0
D/ViewRootImpl@ac77a32[SetupActivity]: ViewPostIme pointer 1
I/zygote64: Background concurrent copying GC freed 24441(965KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 5MB/11MB, paused 199us total 212.292ms
D/ViewRootImpl@ac77a32[SetupActivity]: ViewPostIme pointer 0
D/ViewRootImpl@ac77a32[SetupActivity]: ViewPostIme pointer 1
I/zygote64: Background concurrent copying GC freed 185447(5MB) AllocSpace objects, 0(0B) LOS objects, 49% free, 5MB/11MB, paused 108us total 225.435ms

Это мой код, который мне нужно реализовать

public void createDept(View view){
    assignDept();

    for(int r=1; r<=Integer.parseInt(RoomsNumber);r++){
        db.collection("Departments").document(Department)
                .collection("Room").document(RoomsNumber).update("RoomNumber", RoomsNumber);
        for(int b=1; b<=Integer.parseInt(BedsNumber);b++){
            db.collection("Departments").document(Department)
                    .collection("Room").document(RoomsNumber)
                    .collection("Bed").document(BedsNumber)
                    .update("Active", false, "BedNumber", BedsNumber, "PatientId", "0");
            db.collection("Departments").document(Department)
                    .collection("Room").document(RoomsNumber)
                    .collection("Bed").document(BedsNumber)
                    .collection("Sensors").document("1")
                    .update("ActiveState", false, "Type", "T&H");
            db.collection("Departments").document(Department)
                    .collection("Room").document(RoomsNumber)
                    .collection("Bed").document(BedsNumber)
                    .collection("Sensors").document("2")
                    .update("ActiveState", false, "Type", "S");
        }
    }
}
private void assignDept(){
    db.collection("Supervisor").document(SuperKey).update("Department", Department);
    db.collection("Departments").document(Department).update("NumberOfRooms", RoomsNumber);
    db.collection("Departments").document(Department).update("NumberOfBeds", BedsNumber);
    db.collection("Departments").document(Department).update("Active", true);
}

Есть идеи, как оптимизировать этот код, чтобы его можно было запустить? Спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...