-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New Week goodie added along with a t file #210
Conversation
Hi @gsquire! Thanks for writing a plugin! Unfortunately, your test cases are not passing for me: t/Week.t .. 1/?
# Failed test 'Expected result but dont get one on week 43 1984'
# at /home/dylan/perl5/lib/perl5/DDG/Test/Goodie.pm line 65.
# Failed test 'Expected result but dont get one on week 8 1956'
# at /home/dylan/perl5/lib/perl5/DDG/Test/Goodie.pm line 65.
# Failed test 'Expected result but dont get one on week 21 1987'
# at /home/dylan/perl5/lib/perl5/DDG/Test/Goodie.pm line 65.
# Looks like you failed 3 tests of 7.
t/Week.t .. Dubious, test returned 3 (wstat 768, 0x300)
Failed 3/7 subtests
Test Summary Report
-------------------
t/Week.t (Wstat: 768 Tests: 7 Failed: 3)
Failed tests: 5-7
Non-zero exit status: 3
Files=1, Tests=7, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.21 cusr 0.02 csys = 0.25 CPU)
Result: FAIL Are they passing for you? Please let me know if so and I'll take a closer look, or let me know what in particular you're having trouble with. Thanks! |
Hi @nospampleasemam, that's weird they didn't work for you. Here is my output I got on my run: ok 1 - Regexp check against text for week current I ran the test with the command perl -Ilib t/Week.t. That is a dash eye. I wonder why it didn't work for you. Should I push my test file again? |
It looks like there's a typo on line 47 in the regex repetition notation. 5ac6ceb. After fixing this, all tests passed. So it looks good! But I have two suggestions. The first is that I'd like the results to be full sentences. I think something in the form "The 43rd week of 1984 began on March 8th." would sound best. To get the ordinal form of a number (i.e. "43rd"), you can use Tell me what you think! Thanks |
@nospampleasemam Sorry about the typo, I changed the code on my machine but not here correctly. Anyways, I think those are good ideas. I suppose my terse commands are a less likely to be remembered by someone to type it in. I will look into using that other module as well as changing up the query matching to use a regex instead. As you can tell I am new to this! Cheers |
@nospampleasemam I updated the code with some more natural queries. The only thing I can think of now that might need to be changed is allowing white space in the regular expressions. Thanks! |
Hi @gsquire, Thank you for making those changes! I hope you don't mind - I have made some substantial changes to your code. The first change I made was to the trigger. Instead of using two phrases to trigger on, the plugin now triggers on the word "week". We then use a regex immediately inside the handler function to describe all of the different formations of the query phrase. Doing it this way, it allows us to keep all of the trigger parsing in one place, rather than the three if statements you used. Next, I moved the I know that these are a lot of changes, but please take a look over them and tell me if everything makes sense. If anything doesn't - ask me! I'll be happy to explain. In the meantime, I have deployed the plugin on dylan.duckduckgo.com (https://dylan.duckduckgo.com/?q=what+week+is+this) to look at, and I am merging the code into our master repository. Thanks again for writing and submitting a goodie! I really hope we see another pull request from you in the future! :-) Dylan |
@nospampleasemam I searched around for your email but to no avail. I was just curious when this instant answer would be live on DDG? I was looking forward to seeing it work :). Thanks. |
So it's been there for one year but it's still not available live? 😩 |
Hi @YouriAckx, I'm very sorry about that! I'm not sure why it never got deployed, but I've pinged @moollaza and @jagtalon about this - hopefully we can get it live very quickly. Thanks again and my sincere apologies, |
There is a new task to get this reviewed and deployed live #712 |
I have written this plugin: https://duckduckhack.uservoice.com/forums/5168-ideas-for-duckduckgo-instant-answer-plugins/suggestions/3796478-display-which-week-of-the-year-it-is-an-addition
I hope people can provide some feedback and edit as well. Thank you.
IA Page: https://duck.co/ia/view/week