Commit 5adecfd9 authored by Bruno Meyer's avatar Bruno Meyer 😢

#161: Fix bug on degree avarage graduation time analysis

parent 1c239147
Pipeline #19381 passed with stage
in 1 minute and 54 seconds
*/.vscode/
.vscode/
# info de contas criadas no sistema
login_info
# base de dados
......
......@@ -13,11 +13,12 @@ def index(request, submission_id):
submission_id = int(submission_id)
submission = Submission.objects.get(id=submission_id)
degree = submission.degree
if not (degree in request.user.educator.degree.all()):
return redirect("adega:dashboard")
return redirect("dashboard")
degree_data = get_degree_information(request.session,degree, submission_id=submission_id)
return render(request,"degree/index.html",{
......
......@@ -88,14 +88,24 @@ def average_graduation_time(df):
total_graduate = graduates.shape[0]
average_time = 0
year_end = int(df['ANO'].max())
semester_end = graduates['PERIODO'].max()
for index, row in graduates.iterrows():
if pd.notnull(row['ANO_EVASAO']):
year_end = int(row['ANO_EVASAO'])
try:
semester_end = int(row['SEMESTRE_EVASAO'])
except ValueError:
semester_end = graduates['PERIODO'].max()
try:
evasion_dt = int(row["DT_EVASAO"].split("/")[1])
if(evasion_dt > 7):
semester_end = 2
else:
semester_end = 1
except ValueError:
# TODO: Some students will be not considered
# The interface must inform the user this information
# and how many students wasnt considered
continue
year = int(row['ANO_INGRESSO'])
semester = int(row['SEMESTRE_INGRESSO'])
difference = 2 * (year_end - year) + (semester_end - semester) + 1
......
......@@ -80,7 +80,7 @@ def clean_history(df):
df.drop(drop_columns, axis=1, inplace=True)
df['PERIODO'] = df['PERIODO'].str.split('o').str[0]
# df['PERIODO'] = df['PERIODO'].str.split('o').str[0]
def clean_register(df):
......
......@@ -6,9 +6,6 @@ from datetime import timedelta
def analyze(submission, debug=True):
print(submission.path())
start_time = time.clock()
start_time_exec = time.time()
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment