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

Add WKAoI field to Project Model #2244

Merged
merged 2 commits into from
Sep 12, 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
19 changes: 19 additions & 0 deletions src/mmw/apps/modeling/migrations/0022_project_wkaoi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('modeling', '0021_old_scenarios'),
]

operations = [
migrations.AddField(
model_name='project',
name='wkaoi',
field=models.CharField(help_text='Well-Known Area of Interest ID for faster geoprocessing', max_length=255, null=True),
),
]
4 changes: 4 additions & 0 deletions src/mmw/apps/modeling/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class Project(models.Model):
null=True,
help_text='Serialized JSON representation of additional'
' data gathering steps, such as MapShed.')
wkaoi = models.CharField(
null=True,
max_length=255,
help_text='Well-Known Area of Interest ID for faster geoprocessing')

def __unicode__(self):
return self.name
Expand Down
11 changes: 8 additions & 3 deletions src/mmw/js/src/modeling/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ var ModelingController = {

App.map.set({
'areaOfInterest': project.get('area_of_interest'),
'areaOfInterestName': project.get('area_of_interest_name')
'areaOfInterestName': project.get('area_of_interest_name'),
'wellKnownAreaOfInterest': project.get('wkaoi'),
});
initScenarioEvents(project);
initViews(project, lock);
Expand Down Expand Up @@ -168,7 +169,8 @@ var ModelingController = {
.done(function() {
App.map.set({
'areaOfInterest': project.get('area_of_interest'),
'areaOfInterestName': project.get('area_of_interest_name')
'areaOfInterestName': project.get('area_of_interest_name'),
'wellKnownAreaOfInterest': project.get('wkaoi'),
});
if (project.get('scenarios').isEmpty()) {
// No scenarios available. Set the `needs_reset` flag so
Expand Down Expand Up @@ -197,6 +199,7 @@ function itsiResetProject(project) {
'user_id': App.user.get('id'),
'area_of_interest': App.map.get('areaOfInterest'),
'area_of_interest_name': App.map.get('areaOfInterestName'),
'wkaoi': App.map.get('wellKnownAreaOfInterest'),
'needs_reset': false
});

Expand Down Expand Up @@ -276,6 +279,7 @@ function projectCleanUp() {
App.rootView.subHeaderRegion.empty();
App.rootView.sidebarRegion.empty();
App.rootView.compareRegion.empty();
App.clearAnalyzeCollection();
}

function projectErrorState() {
Expand Down Expand Up @@ -347,7 +351,8 @@ function reinstateProject(number, lock) {
.done(function() {
App.map.set({
'areaOfInterest': project.get('area_of_interest'),
'areaOfInterestName': project.get('area_of_interest_name')
'areaOfInterestName': project.get('area_of_interest_name'),
'wellKnownAreaOfInterest': project.get('wkaoi'),
});
setPageTitle();
lock.resolve();
Expand Down
3 changes: 2 additions & 1 deletion src/mmw/js/src/modeling/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ var ProjectMenuView = Marionette.ItemView.extend({
App.projectNumber = undefined;
App.map.set({
'areaOfInterest': null,
'areaOfInterestName': null
'areaOfInterestName': null,
'wellKnownAreaOfInterest': null,
});

router.navigate('projects/', { trigger: true });
Expand Down
6 changes: 4 additions & 2 deletions src/mmw/js/src/projects/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ var ProjectsView = Marionette.LayoutView.extend({
App.projectNumber = undefined;
App.map.set({
'areaOfInterest': null,
'areaOfInterestName': null
'areaOfInterestName': null,
'wellKnownAreaOfInterest': null,
});

router.navigate('', { trigger: true });
Expand Down Expand Up @@ -170,7 +171,8 @@ var ProjectRowView = Marionette.ItemView.extend({
App.clearAnalyzeCollection();
App.map.set({
'areaOfInterest': null,
'areaOfInterestName': ''
'areaOfInterestName': '',
'wellKnownAreaOfInterest': null,
});
router.navigate('/project/' + this.model.id, { trigger: true });
}
Expand Down