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

flat isn't flat enough #104

Open
kwerle opened this issue Jul 12, 2016 · 5 comments
Open

flat isn't flat enough #104

kwerle opened this issue Jul 12, 2016 · 5 comments

Comments

@kwerle
Copy link
Contributor

kwerle commented Jul 12, 2016

I have to be bug for bug compatible with some existing code.
default_formula: :flat
still looks at the earth as a sphere - just a rougher one. I need
default_formula: :neanderthal

Sigh.

@kwerle
Copy link
Contributor Author

kwerle commented Jul 12, 2016

module Geokit
  module ActsAsMappable
    module ClassMethods

      # Returns the distance calculation to be used as a display column or a condition.  This
      # is provide for anyone wanting access to the raw SQL.
      def distance_sql(origin, units=default_units, formula=default_formula)
        case formula
        when :sphere
          sql = sphere_distance_sql(origin, units)
        when :flat
          sql = flat_distance_sql(origin, units)
        when :neanderthal
          sql = neanderthal_distance_sql(origin, units)
        end
        sql
      end

      # Returns the distance SQL using the really flat-world formula (Phythagorean Theory).
      def neanderthal_distance_sql(origin, units)
        adapter.flat_distance_sql(origin, 1.0, 1.0)
      end

    end
  end
end

@mnoack
Copy link
Member

mnoack commented Jul 13, 2016

@kwerle If you can do this in the form of a pull request which passes the tests and doesn't reduce coverage I'll likely be happy to merge.

@kwerle
Copy link
Contributor Author

kwerle commented Jul 13, 2016

OK, I'll take a stab at it in the near future. Thanks!

@kwerle
Copy link
Contributor Author

kwerle commented Aug 12, 2016

@mnoack How do you run tests for this? It looks like rake test should work (and do sqlite testing), but it does not seem to do so:

root@46a5710ea34d:/tmp/src# rake test
/usr/local/bin/ruby -w -I"lib:lib:test" -I"/usr/local/bundle/gems/rake-11.2.2/lib" "/usr/local/bundle/gems/rake-11.2.2/lib/rake/rake_test_loader.rb" "test/*_test.rb" 
/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/rubygems_integration.rb:468: warning: method redefined; discarding old find_spec_for_exe
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems.rb:261: warning: previous definition of find_spec_for_exe was here
/usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/core_ext/time/calculations.rb:243: warning: method redefined; discarding old +
/usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/core_ext/time/calculations.rb:253: warning: method redefined; discarding old -
/usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/core_ext/time/calculations.rb:263: warning: method redefined; discarding old -
/usr/local/bundle/gems/simplecov-rcov-0.2.3/lib/simplecov-rcov.rb:25: warning: assigned but unused variable - generated_on
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's default settings.
/usr/local/bundle/gems/geokit-1.10.0/lib/geokit/geo_loc.rb:66: warning: method redefined; discarding old state
/usr/local/bundle/gems/geokit-1.10.0/lib/geokit/geo_loc.rb:82: warning: method redefined; discarding old full_address
/usr/local/bundle/gems/geokit-1.10.0/lib/geokit/geo_loc.rb:87: warning: method redefined; discarding old street_number
/usr/local/bundle/gems/geokit-1.10.0/lib/geokit/geo_loc.rb:93: warning: method redefined; discarding old street_name
/usr/local/bundle/gems/geokit-1.10.0/lib/geokit/geo_loc.rb:99: warning: method redefined; discarding old formatted_address
/usr/local/bundle/gems/geokit-1.10.0/lib/geokit/geo_loc.rb:115: warning: method redefined; discarding old city=
/usr/local/bundle/gems/geokit-1.10.0/lib/geokit/geo_loc.rb:121: warning: method redefined; discarding old street_address=
DEPRECATION WARNING: use_transactional_fixtures= is deprecated and will be removed from Rails 5.1 (use use_transactional_tests= instead) (called from <class:GeokitTestCase> at /tmp/src/test/test_helper.rb:46)
/usr/local/bundle/gems/simplecov-rcov-0.2.3/lib/simplecov-rcov.rb:97: warning: instance variable @asset_output_path not initialized
Coverage report Rcov style generated for Unit Tests to /tmp/src/coverage/rcov
[Coveralls] Outside the CI environment, not sending data.

@kwerle
Copy link
Contributor Author

kwerle commented Oct 10, 2016

Ping. I'd really like a hand running tests.
When I run
rake test_sqlite
It does (essentially) the above. If I change tests (so that they should fail) I get no change. If I add runtime errors to the tests, I get no change. I'm stumped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants