No description, website, or topics provided.
Clone or download
Pull request Compare This branch is even with ralake:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Look Up

Code Climate Test Coverage

Look up at

What is “LookUp”?

LookUp is a web-app that guides the user through a number of simple steps to survey a roof that they believe might be a good site for community solar power. Its overall aim is to engage and inspire a wider audience to consider setting up environmentally-friendly community energy projects that take some of the monopoly away from large energy companies.

How it works

The app collects the user's location using the google maps API, the direction that the roof is facing and the angle of the roof using your mobile’s in-built gyroscope and compass. It also collects other information such as the roof’s material and size, the potential shade that could fall on the roof during the day and a photograph of the site. At the end of the process the user is given an estimated amount of panels that can fit on the roof and the amount of power that these could generate based on the data collected.

How it was built

Built in Ruby with a Sinatra server and Postgres for the database. We used cucumber and capybara for our feature tests and RSpec for the unit tests.

Techs overview


  • Ruby
  • Javascript


  • Sinatra
  • Foundation

External libraries:

  • jQuery
  • Google maps API


  • PostrgeSQL

Test suites:

  • RSpec
  • Cucumber
  • Capybara


  • Heroku
  • AWS for saving images

Best code snippets

Retrieving geolocation in browser:

var lat;
var longit;
var id = $('.page-wrap').data("roof-id");
function getPosition(position) {
  lat = position.coords.latitude;
  longit = position.coords.longitude;
$('#submit_button').click(function() {
  $.post('/roofs/' + id + '/geolocation',{ latitude: lat, longitude: longit });

Getting mobile phone accelerometer data:

if(window.DeviceOrientationEvent) {
  window.addEventListener('deviceorientation', function(event) {
  angle = Math.abs(Math.round(event.beta));
  if(angle !== null); 
  dataContainerOrientation.innerHTML = 'Roof angle: ' + angle + ' degrees';
  }, false);
    $('#capture_hidden').attr('value', angle);

Checking if user running Safari, browser, as we encountered issues with complatibility with .click method:

if ("Safari") >= 0 &&"Chrome") < 0)


Used some external libraries, such as the map tool, which needed tweaking to make them work in our context. It wasn't possible to test the photo capture process or the touch screen map tool using cucumber/capybara which isn't ideal as they are quite complex steps. We made sure that we tested each on a number of different devices to ensure the feature's cross platform compatibility.