bnvk / Conjuror

An experiment in the CSV format, open data, magic, and wizardly things!
Other
11 stars 2 forks source link

Refactor Date into a lib, add fixed price option #23

Closed simonv3 closed 9 years ago

simonv3 commented 9 years ago

What's Changed

bnvk commented 9 years ago

Hrm, this currently breaks date filtering as the module is not being loaded and declared in the right way...

/Users/brennannovak/Beardo/lib/beard_date.js:8
  var filter_date = args.options.date.replace(/-/g, '');
                    ^
ReferenceError: args is not defined
    at Object.Beardo.Date.full (/Users/brennannovak/Beardo/lib/beard_date.js:8:21)
    at /Users/brennannovak/Beardo/beardo.js:165:48
    at Function._.each._.forEach (/Users/brennannovak/Beardo/node_modules/underscore/underscore.js:145:9)
    at Object.Beardo.magickData (/Users/brennannovak/Beardo/beardo.js:161:5)
    at /Users/brennannovak/Beardo/beardo.js:316:32
    at null.<anonymous> (/Users/brennannovak/Beardo/node_modules/csv/node_modules/csv-parse/lib/index.js:63:16)
    at emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:442:13)

I need to better learn how to modularize node stuff like this, but will get to it soon!

simonv3 commented 9 years ago

Huh, I'll fiddle with this on Monday On Mar 27, 2015 9:09 PM, "Brennan Novak" notifications@github.com wrote:

Hrm, this currently breaks date filtering as the module is not being loaded and declared in the right way...

/Users/brennannovak/Beardo/lib/beard_date.js:8 var filter_date = args.options.date.replace(/-/g, ''); ^ ReferenceError: args is not defined at Object.Beardo.Date.full (/Users/brennannovak/Beardo/lib/bearddate.js:8:21) at /Users/brennannovak/Beardo/beardo.js:165:48 at Function..each._.forEach (/Users/brennannovak/Beardo/node_modules/underscore/underscore.js:145:9) at Object.Beardo.magickData (/Users/brennannovak/Beardo/beardo.js:161:5) at /Users/brennannovak/Beardo/beardo.js:316:32 at null. (/Users/brennannovak/Beardo/node_modules/csv/node_modules/csv-parse/lib/index.js:63:16) at emit (events.js:117:20) at _stream_readable.js:944:16 at process._tickCallback (node.js:442:13)

I need to better learn how to modularize node stuff like this, but will get to it soon!

— Reply to this email directly or view it on GitHub https://github.com/bnvk/Beardo/pull/23#issuecomment-86935727.

simonv3 commented 9 years ago

The module was being loaded properly, it's just that "args" isn't available in the lib unless you pass it to it. For the sake of function-ness, I'm going to pass args to the function. It might be an idea to pass it to the Date instance when it gets instantiated.

simonv3 commented 9 years ago

@bnvk let me know if the above work for you, I did some testing on my end and I think the problem should be fixed.

bnvk commented 9 years ago

Ah yes, it was just the args being passed into the module. Nice fix ;)

Hrm, now I'm getting this error...

/Users/brennannovak/Beardo/beardo.js:341
                return callback();
                       ^
TypeError: undefined is not a function
    at /Users/brennannovak/Beardo/beardo.js:341:24
    at Object.Beardo.summonUser (/Users/brennannovak/Beardo/beardo.js:110:12)
    at /Users/brennannovak/Beardo/beardo.js:334:22
    at null.<anonymous> (/Users/brennannovak/Beardo/node_modules/csv/node_modules/csv-parse/lib/index.js:63:16)
    at emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:442:13)
simonv3 commented 9 years ago

Totally my fault. That's a quick-fix to get the tests running (though will probably be useful in the future regardless), I made sure to only run callback when it's defined.

Can you pull that down and tell me whether that works? If not, what command are you running?

bnvk commented 9 years ago

Annnnnnnd MERGED :+1: :grin:

simonv3 commented 9 years ago

:trumpet: :notes: