2022-09-22 15:15:32 +00:00
|
|
|
|
|
|
|
from io import BytesIO
|
|
|
|
from flask import Flask, render_template
|
|
|
|
# app = Flask("Project Numeri")
|
|
|
|
from flask import Flask, make_response, request
|
|
|
|
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
|
|
|
|
from matplotlib.figure import Figure
|
|
|
|
import base64
|
|
|
|
|
2022-09-30 16:45:45 +00:00
|
|
|
# app = Flask(__name__)
|
|
|
|
GRADE_LIST = "Cijfers-HerrewijnenJonathan.csv"
|
|
|
|
print(GRADE_LIST)
|
2022-09-22 15:15:32 +00:00
|
|
|
|
|
|
|
def plot():
|
|
|
|
# Generate the figure **without using pyplot**.
|
|
|
|
fig = Figure()
|
|
|
|
ax = fig.subplots()
|
|
|
|
ax.plot([1, 2])
|
|
|
|
# Save it to a temporary buffer.
|
|
|
|
buf = BytesIO()
|
|
|
|
fig.savefig(buf, format="png")
|
|
|
|
# Embed the result in the html output.
|
|
|
|
data = base64.b64encode(buf.getbuffer()).decode("ascii")
|
|
|
|
return f"<img src='data:image/png;base64,{data}'/>"
|
|
|
|
|
|
|
|
|
|
|
|
# import pandas as pd
|
|
|
|
# import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
# class Cijferlijst:
|
|
|
|
# def __init__(self, grade_list=GRADE_LIST):
|
|
|
|
# self.grade_list = grade_list
|
|
|
|
# self.ps = pd.read_csv(GRADE_LIST, skiprows=2, sep=';')
|
|
|
|
|
|
|
|
# '''
|
|
|
|
# Get all data from a subject and a (yearly) period:
|
|
|
|
# GetSubjectByYear("godsdienst", "2010/2011")
|
|
|
|
# '''
|
|
|
|
# def GetSubjectByYear(self, subject, year):
|
|
|
|
# if(type(subject) == str and type(year) == str):
|
|
|
|
# select_year = self.ps[self.ps['Schooljaar(Voortgangsdossier)'] == year]
|
|
|
|
# select_subject = select_year[select_year["Vak(Voortgangsdossier)"] == subject]
|
|
|
|
|
|
|
|
# #filter period and rapport
|
|
|
|
# rapports = select_subject[select_subject['Cijfertype(Voortgangsdossier)'] != "Periodegemiddelde"]
|
|
|
|
# return rapports[rapports ['Cijfertype(Voortgangsdossier)'] != "Rapportcijfer"]
|
|
|
|
# else:
|
|
|
|
# return False
|
2021-09-20 20:39:36 +00:00
|
|
|
|
|
|
|
|
2022-09-22 15:15:32 +00:00
|
|
|
# def iets(self):
|
|
|
|
# print(self.grade_list)
|
2021-09-15 21:05:34 +00:00
|
|
|
|
2022-09-22 15:15:32 +00:00
|
|
|
# def CalculateMedian(self, subject, year):
|
|
|
|
# # Calculates average for all scores without weight!
|
|
|
|
# Grades = self.ps['Cijfer(Voortgangsdossier)'].loc[:]
|