Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

matching algorithm select innovations closest to the day of the year,…

… not to the absolute date
  • Loading branch information...
commit eb9e55729a0a92c19835176e14b8ab4320489ef6 1 parent b545138
Dhruv Bansal dhruvbansal authored

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  innovation_matcher.rb
2  innovation_matcher.rb
@@ -17,7 +17,7 @@ def find_match user_data
17 17 dob = (user_data["dob"] or return)
18 18 [].tap do |innovations|
19 19 begin
20   - result_set = db.query("SELECT * FROM innovations ORDER BY ABS(innovation_date - DATE(\"#{Mysql.quote(dob)}\")) LIMIT 3")
  20 + result_set = db.query("SELECT * FROM innovations WHERE innovation_date != \"0000-00-00\" ORDER BY ABS(DAYOFYEAR(DATE(\"#{Mysql.quote(dob)}\")) - DAYOFYEAR(innovation_date)) LIMIT 3")
21 21 rescue Mysql::Error => e
22 22 return
23 23 end

0 comments on commit eb9e557

Please sign in to comment.
Something went wrong with that request. Please try again.