@html.route('/')
def index():
    projects = db.session.query(Project.name, Project.date, Project.iteration, Project.description, Project.id, Project.images, db.func.count(Roi.id).label('nROIs'), (db.func.count(Roi.id) - db.func.ifnull(db.func.sum(Roi.testingROI), 0)).label('nTrainingROIs'), db.func.count(db.func.distinct(Image.id)).label('nImages'), db.func.ifnull(db.func.sum(db.func.distinct(Image.nobjects)), 0).label('nObjects')).outerjoin(Image, (Image.projId == Project.id)).outerjoin(Roi, (Roi.imageId == Image.id)).group_by(Project.id).all()
    return render_template('index.html', projects=projects)
@html.route('/')
def index():
    projects = db.session.query(Project.name, Project.date, Project.iteration, Project.description, Project.id, Project.images, db.func.count(Roi.id).label('nROIs'), (db.func.count(Roi.id) - db.func.ifnull(db.func.sum(Roi.testingROI), 0)).label('nTrainingROIs'), db.func.count(db.func.distinct(Image.id)).label('nImages'), db.func.ifnull(db.func.sum(db.func.distinct(Image.nobjects)), 0).label('nObjects')).outerjoin(Image, (Image.projId == Project.id)).outerjoin(Roi, (Roi.imageId == Image.id)).group_by(Project.id).all()
    return render_template('index.html', projects=projects)