osu-eng / technicity

A crowd source street view based survey tool
streetseen.osu.edu
Apache License 2.0
1 stars 3 forks source link

No publish study validation leads to errors on voting #51

Closed jasonlttl closed 11 years ago

jasonlttl commented 11 years ago

Right now, there's no guarantee a study will have regions. This should be checked when a study is published (not in voting). Voting should check only that a study is published and assume everything is ok.

Recording this as a reminder to make sure we get this bug fixed in both places.


NoMethodError in Static_pages#home

Showing /Users/jason_little/dev/tech/app/views/static_pages/home.html.erb where line #4 raised:

undefined method `regions' for nil:NilClass Extracted source (around line #4):

1: 2: <% @study = Study.find(:all).sample(1) %> 3: 4: <% @regions = @study[0].region_set.regions.find(:all).sample(1) %> 5: <% @locations = @regions[0].locations.find(:all).sample(2) %> 6: <% @imagelink1 = "http://maps.googleapis.com/maps/api/streetview?size=470x306&location=" + @locations[0].latitude.to_s() + "%20" + @locations[0].longitude.to_s() + "&sensor=false" %> 7: <% @imagelink2 = "http://maps.googleapis.com/maps/api/streetview?size=470x306&location=" + @locations[1].latitude.to_s() + "%20" + @locations[1].longitude.to_s() + "&sensor=false" %> Rails.root: /Users/jason_little/dev/tech

Application Trace | Framework Trace | Full Trace app/views/static_pages/home.html.erb:4:in `_app_views_static_pages_home_html_erb___3747929577376929496_70134696769940'

jasonlttl commented 11 years ago

Validation has been implemented in the study launch process. There are now two things to fix in voting.

1) Home page should only show studies where active=true

2) Ability to vote on voting tab should be disabled somehow. Below are some thoughts.

jasonlttl commented 11 years ago

home page and vote tab now check for active=true