From c55ab31671138ded4881f3bf1386f6be81dbdeed Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sat, 10 Oct 2015 09:30:25 -0700 Subject: [PATCH] Pass session to getTemps --- app/main/utils.py | 10 +++++++--- app/main/views.py | 5 +---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/main/utils.py b/app/main/utils.py index c31b02c..a1fcdcd 100644 --- a/app/main/utils.py +++ b/app/main/utils.py @@ -3,9 +3,13 @@ import numpy from .models import DB -def getTemps(datasets, community_id, minyear, maxyear): - model, scenario = datasets.split(',') - data = DB.getTemps(minyear, maxyear, community_id, model, scenario) +def getTemps(session): + model, scenario = session['datasets'].split(',') + data = DB.getTemps(session['minyear'], + session['maxyear'], + session['community_data']['id'], + model, + scenario) return data diff --git a/app/main/views.py b/app/main/views.py index 6da95e6..078fb82 100644 --- a/app/main/views.py +++ b/app/main/views.py @@ -31,10 +31,7 @@ def index(): session['ds_name'] = session['datasets'].split(',') - temps_arr = getTemps(session['datasets'], - community_id, - session['minyear'], - session['maxyear']) + temps_arr = getTemps(session) session['avg_temp'] = avg_air_temp(temps_arr) indices = ann_air_indices(temps_arr)