Zeroclickinfo-goodies: Name days: Convert to structured answer and move code to template

Created on 18 Jul 2017  ·  12Comments  ·  Source: duckduckgo/zeroclickinfo-goodies

Description


The name days IA needs to be updated. It's got a lot of legacy code, injecting html into the duckbar which shouldn't be happening. For some reason the styles are messed up now (below is what it should look like)

Can you please update this @kirkins?

screen shot 2017-07-18 at 10 15 09 am

Steps to recreate

People to notify


Instant Answer Page: https://duck.co/ia/view/name_days

Highest Impact Tasks Improvement High Other

All 12 comments

Will take a look later.

Hey @kirkins, did you get a chance to look at this?

@pjhampton started but not done. It will take a lot of work and busy at job this week.

Thanks dude :)

@pjhampton I like Perl but still a noobie when it comes to the workflow.

I'm on codio and I want to run a utility that comes with this to preprocess the data _(as it needs to be re-written to remove the html)_.

https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/share/goodie/name_days/preprocess.pl

When I try to run it on Codio I get:

Can't locate DateTime.pm in @INC (you may need to install the DateTime module) (@INC contains: /etc/perl /usr/local/lib/perl/5
.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site
_perl .) at ./preprocess.pl line 5.
BEGIN failed--compilation aborted at ./preprocess.pl line 5.

I try running cpan then install DateTime and also tried App::DateTime, but I still get the same error.

Do you know how I can install the DateTime module globally? _(coming from node.js background)_

@pjhampton update:

Instead of doing ./preprocess.pl I used perl preprocess.pl and some how this made my CPAN modules available. So that is fixed.

Too bad I spent a bunch of time manually editing all the text files before I realized they were generated... doh. ◔̯︵◔

Thanks @kirkins! Sorry I didn't get seeing this. I got distracted with https://github.com/duckduckgo/zeroclickinfo-goodies/pull/4373

@mintsoft do you know of any examples of a structured answer with an array?

untitled

untitled

Title and name_days are the same above except name_days has been broken into an array.

It's like the second item in the array becomes an attribute itself :confounded:

@kirkins I don't know an example off the top of my head. What you're seeing is normal perl behaviour, the problem is that it should be an array reference, not an array to get what you intended:

data => {
    title => $text,
    name_days => \@name_days,
},

@pjhampton I posted some screen-shots comparing live, beta, and my PR.

It seems this comes down to the CSS file associated no longer being loaded. See this comparison on the network tab:

Live:
untitled

Beta:
untitled

It's strange that this would happen if the CSS was loading fine before. It makes me wonder if the root cause for this issue will cause similar problems for other Goodies.

Possibly, but don't worry about that @kirkins. You can override it in the IAs local CSS 👍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GuiltyDolphin picture GuiltyDolphin  ·  13Comments

pjhampton picture pjhampton  ·  11Comments

moollaza picture moollaza  ·  13Comments

pjhampton picture pjhampton  ·  11Comments

GuiltyDolphin picture GuiltyDolphin  ·  12Comments