def getConnexionELPByMonth(session, COD_ELP, month, year, listeInds): CI = aliased(tables.ConnexionINDMySQL) nbConnexion = session.query(CI.SESAME_ETU).filter( and_(CI.SESAME_ETU.in_(listeInds), func.MONTH(CI.DATE_CONN) == month, func.YEAR(CI.DATE_CONN) == year)) return nbConnexion.count()
def getConnexionELPByYearByIND(session, COD_ELP, year, listeInds): CI = aliased(tables.ConnexionINDMySQL) nbConnexion = session.query(CI.SESAME_ETU, func.count( CI.DATE_CONN)).filter( and_(CI.SESAME_ETU.in_(listeInds), func.YEAR(CI.DATE_CONN) == year)).group_by(CI.SESAME_ETU) return nbConnexion
def getConsultationByCoursByYear(session, ID_COURS, year='%'): #LOG.info("----- getConsultationByCoursByYear -----") COC = aliased(tables.ConsultationCoursMySQL) nbConsultations = session.query(COC.PUBLIC_CONS, func.count( COC.DATE_CONS)).filter( and_(COC.ID_COURS == ID_COURS, COC.TYPE_CONS == "Cours", func.YEAR(COC.DATE_CONS) == year)).group_by(COC.PUBLIC_CONS) return nbConsultations
def getConsultationCoursByYear(session, year='%', listeIdCours=[], SESAME_ETU=None): COC = aliased(tables.ConsultationCoursMySQL) if SESAME_ETU: nbConsultations = session.query(COC.ID_COURS, func.count( COC.DATE_CONS)).filter( and_(COC.SESAME_ETU == SESAME_ETU, COC.ID_COURS.in_(listeIdCours), func.YEAR(COC.DATE_CONS) == year)).group_by(COC.ID_COURS) else: nbConsultations = session.query(COC.ID_COURS, func.count( COC.DATE_CONS)).filter( and_(COC.ID_COURS.in_(listeIdCours), func.YEAR(COC.DATE_CONS) == year)).group_by(COC.ID_COURS) return nbConsultations
def getConsultationByElementsByCoursByYear(session, ID_COURS, year, elements_list=[]): #LOG.info("----- getConsultationByElementsByCoursByYear -----") COC = aliased(tables.ConsultationCoursMySQL) nbConsultations = session.query(COC.ID_CONS, func.count( COC.DATE_CONS)).filter( and_(COC.ID_COURS == ID_COURS, COC.ID_CONS.in_(elements_list), func.YEAR(COC.DATE_CONS) == year)).group_by(COC.ID_CONS) return nbConsultations
def getConsultationByElementByCoursByYearForGraph(session, ID_COURS, ID_CONS, year='%'): #LOG.info("----- getConsultationByElementByCoursByYearForGraph -----") COC = aliased(tables.ConsultationCoursMySQL) nbConsultations = session.query(func.MONTH( COC.DATE_CONS), func.count(COC.DATE_CONS), COC.PUBLIC_CONS).filter( and_(COC.ID_COURS == ID_COURS, COC.ID_CONS == ID_CONS, func.YEAR(COC.DATE_CONS) == year)).group_by( func.MONTH(COC.DATE_CONS), COC.PUBLIC_CONS) return nbConsultations