File tree Expand file tree Collapse file tree 3 files changed +24
-18
lines changed Expand file tree Collapse file tree 3 files changed +24
-18
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,8 @@ export class InicioComponent implements OnInit {
32
32
}
33
33
34
34
async obtener_cantidadEstudiantes ( ) {
35
- let nrc : string [ ] | any = this . Materias . map ( ( materia : any ) => materia . nrc_materia ) ;
36
- let carrera : string [ ] | any = this . Materias . map ( ( materia : any ) => materia . carrera_materia ) ;
35
+ let nrc : string [ ] | any = await this . Materias . map ( ( materia : any ) => materia . nrc_materia ) ;
36
+ let carrera : string [ ] | any = await this . Materias . map ( ( materia : any ) => materia . carrera_materia ) ;
37
37
38
38
for ( let a = 0 ; a <= nrc . length - 1 ; a ++ ) {
39
39
this . cantidad_alumnos [ a ] = await this . datos_Locales . getCantidadEstudiantes ( nrc [ a ] , carrera [ a ] ) ;
Original file line number Diff line number Diff line change @@ -32,19 +32,25 @@ export class FirestoreService {
32
32
}
33
33
34
34
async getListaAsistencia ( nrc : string , carrera : string ) {
35
-
36
- let url = '/' + carrera + '/Materias/' + nrc ;
37
- const lista_encontrada = await this . firestore . collection ( url ) . get ( ) . toPromise ( ) ;
38
-
39
- if ( lista_encontrada ) {
40
- const datos_lista = lista_encontrada . docs . map ( ( alumnos ) => alumnos . data ( ) ) ;
41
- return datos_lista ;
42
- } else {
43
- console . log ( 'No se pudo obtener la información de Firestore.' ) ;
35
+ try {
36
+ let url = '/' + carrera + '/Materias/' + nrc ;
37
+ const lista_encontrada = await this . firestore . collection ( url ) . get ( ) . toPromise ( ) ;
38
+ console . log ( "Lista Asistencia" , lista_encontrada ) ;
39
+ if ( lista_encontrada ) {
40
+ const datos_lista = await lista_encontrada . docs . map ( ( alumnos ) => alumnos . data ( ) ) ;
41
+ console . log ( "Dato" , datos_lista ) ;
42
+ return datos_lista ;
43
+ } else {
44
+ console . log ( 'No se pudo obtener la información de Firestore.' ) ;
45
+ return [ ] ;
46
+ }
47
+ } catch ( error ) {
48
+ console . error ( 'Error al obtener la información de Firestore:' , error ) ;
44
49
return [ ] ;
45
50
}
46
51
}
47
52
53
+
48
54
async getCantidadEstudiantes ( nrc : string , carrera : string ) {
49
55
let url = '/' + carrera + '/Materias/' + nrc ;
50
56
const lista_encontrada = await this . firestore . collection ( url ) . get ( ) . toPromise ( ) ;
Original file line number Diff line number Diff line change @@ -3,12 +3,12 @@ export const environment = {
3
3
apiUrl :'https://my-json-server.typicode.com/IrvingCM123/Consumir_Apis' ,
4
4
apiMensaje : 'http://localhost:2000/Servidor/enviar/' ,
5
5
firebase : {
6
- apiKey : 'AIzaSyDIahzHtIBUdWUOWGam_MesAxCUBgkcQkg ' ,
7
- authDomain : "sistemaasistencia-9d5e1 .firebaseapp.com" ,
8
- projectId : "sistemaasistencia-9d5e1" ,
9
- storageBucket : "sistemaasistencia-9d5e1 .appspot.com" ,
10
- messagingSenderId : "245812703918" ,
11
- appId : "1:245812703918 :web:68c6faf48e5971ab5c333f" ,
12
- measurementId : "G-V4BQXPDH5X"
6
+ apiKey : 'AIzaSyBJwetPrTGU_1DS3YNvI5sL8FZNpXNWXjk ' ,
7
+ authDomain : 'listasasistencia-f6f1d .firebaseapp.com' ,
8
+ projectId : 'listasasistencia-f6f1d' ,
9
+ storageBucket : 'listasasistencia-f6f1d .appspot.com' ,
10
+ messagingSenderId : '678706300098' ,
11
+ appId : '1:678706300098 :web:8695fa0606bac74a81275b' ,
12
+ measurementId : 'G-064GBWZ9SK' ,
13
13
}
14
14
} ;
You can’t perform that action at this time.
0 commit comments