@dcieslak -- It's my first kata. Beginner's luck? :-)
On hardcoding solution: I'd have to add some filtering on keywords, but there are too many ways to do that. Filtering on query cost could be OK, but I have no idea how to do that with Ruby. Any ideas?
It will be slightly more challenging if some test cases could be long enough so greedy solutions (like sum of reduce) take too much time. Please take a look at my solution which, hopefully, avoids such situations
There's no table.
OK, but how would you pass a parameter to query (not using SQL injection)?
PS: Now try to solve this kata the right way.
Wow. This is good.
@dcieslak -- It's my first kata. Beginner's luck? :-)
On hardcoding solution: I'd have to add some filtering on keywords, but there are too many ways to do that. Filtering on query cost could be OK, but I have no idea how to do that with Ruby. Any ideas?
Well, that was not what I was thinking about... I don't want to force any solution, but hardcoding one is not a solution.
I'm thinking about forcing
generate_series()
, but maybe you can think another "right" solution?GREAT. We definitely need more "CREATE FUNCTION" SQL katas.
This comment is hidden because it contains spoiler information about the solution
Should the results be ordered in some way? There's no word about this in kata.
Is casting as text required? Isn't rounding to three decimal places enough?
Needs TDD tests.
It will be slightly more challenging if some test cases could be long enough so greedy solutions (like sum of reduce) take too much time. Please take a look at my solution which, hopefully, avoids such situations
Solving this without
.split()
would be more challenging and could quallify for 7kyu, instead of 8...Please provide basic test case in Test Driven Development (TDD) window of this kata.