Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove historical model from dropdown #50

Merged
merged 2 commits into from
May 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/apps/home/templates/home/map_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<div class="container-fluid">
<div class="row">
<div class="col-sm-6">
<div><p id="admin3_label"></p></div>
<div class="embed-responsive" style="height: 25px;"><p id="admin3_label"></p></div>
<div id="map" class="map-div img-responsive">
<span id="spinner" class="glyphicon glyphicon-refresh ts-om-spin" style="color:#ffa500;"></span>
</div>
Expand Down
9 changes: 8 additions & 1 deletion website/apps/home/views/ListModelView.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,21 @@ def get_context_data(self, **kwargs):
context = super(ListModelView, self).get_context_data(**kwargs)
# Get a list of all the models in the system
model_list_queryset = SimulationModel.objects.all()
model_list = []
for model in model_list_queryset:
# Check that the model is not only used for historical data
for sim in Simulation.objects.all():
if sim.sim_model == model and sim.historical==False:
model_list.append(model)
model_list = list(set(model_list))

# Get the historical and simulated objects
historical_simulation_list = Simulation.objects.filter(historical=True).order_by("-creation_timestamp")

# Get the most recent simulation for the map view link
latest_simulation = Simulation.objects.exclude(historical=True).latest('creation_timestamp')

context["model_list"] = model_list_queryset
context["model_list"] = model_list
context["historical_simulation_list"] = historical_simulation_list
context["model_filter"] = self.request.GET.get('filter')
context["most_recent_model_id"] = latest_simulation.sim_model.id
Expand Down
6 changes: 5 additions & 1 deletion website/apps/home/views/MapView.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ def get_context_data(self, **kwargs):
model_list_queryset = SimulationModel.objects.all()
model_list = []
for model in model_list_queryset:
model_list.append(model)
# Check that the model is not only used for historical data
for sim in Simulation.objects.all():
if sim.sim_model == model and sim.historical==False:
model_list.append(model)
model_list = list(set(model_list))

full_simulation_list_nonhistorical = Simulation.objects.filter(historical=False)
location_info = {}
Expand Down