Skip to content

Commit

Permalink
v1.4.5
Browse files Browse the repository at this point in the history
Merge pull request #436 from TechforgoodCAST/develop
  • Loading branch information
suninthesky authored Sep 11, 2017
2 parents 254dd85 + 2e8eeaf commit 7aba88d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/services/companies_house.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def lookup(org)
org.company_sic = data['SICCodes'].try(:[], 'SicText')

org.registered_on = data['IncorporationDate']
org.operating_for = operating_for_value(data['IncorporationDate'])
org.operating_for = operating_for_value(data['IncorporationDate']) if
data['IncorporationDate']

if data['CompanyCategory'] == 'Community Interest Company'
org.org_type = 5
Expand All @@ -50,7 +51,7 @@ def valid_json?(json)
end

def operating_for_value(date)
return false unless date
return unless date
years_old = ((Time.zone.today - date.to_date).to_f / 365)
if years_old <= 1
1
Expand Down

0 comments on commit 7aba88d

Please sign in to comment.