fix puntuaciones
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:prosappco/src/models/scores_model.dart';
|
||||
|
||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||
|
||||
@@ -46,6 +47,28 @@ Future<List<Event>> getByProId(String day) async {
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Event>> getByProIdAll() async {
|
||||
try {
|
||||
var snapshot = await FirebaseFirestore.instance
|
||||
.collection('services')
|
||||
.where('professional_id', isEqualTo: uid)
|
||||
.get();
|
||||
|
||||
List<Event> eventos = [];
|
||||
for (var element in snapshot.docs) {
|
||||
final event = Event.fromJson(element.data());
|
||||
event.scoresModel =
|
||||
await ScoresModel.scoreTo(event.userId ?? "", false, false);
|
||||
eventos.add(event);
|
||||
}
|
||||
print('eventos $eventos');
|
||||
return eventos;
|
||||
} catch (e) {
|
||||
print('Error getByProId $e');
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
class Event {
|
||||
String? title;
|
||||
String? description;
|
||||
@@ -54,6 +77,7 @@ class Event {
|
||||
String? range1Hour2;
|
||||
String? userId;
|
||||
String? professionalId;
|
||||
ScoresModel? scoresModel;
|
||||
|
||||
Event({
|
||||
this.title,
|
||||
|
||||
Reference in New Issue
Block a user