Answers Module 12 assessment issue

I am facing an issue validating my submitted work for Answers Module 12 assessment. The validation fails on the second task “Add a new card called restaurant and update data mappings”. Passed the first task.

I have validated by comparing both tasks and do not see an issue. Has anyone else encountered this? below is a screenshot of my restaurants/component.js file for reference.

1 Like

Likely a problem with the second step, “Map to the c_restaurantFeatures field”


Help anyone?

Hey Andrai,

You’re so close and your instincts are spot on! You just need to update your services line to read:

services: profile.c_restaurantFeatures,

Let me know if that works!

2 Likes

Yes, that worked. And its right there in the “troubleshooting common errors” section

Thanks!

1 Like

Hi @Sarah_Dougherty I have the exact same issue and cant see what I’ve done wrong. I did update the services to read profile.c_restaurantFeatures. Would you be so kind to help? Thanks

Hi Mali,

When you’re referencing fields, make sure you include profile. to indicate it’s a field on the entity profile, and don’t use quotes, like Sarah had posted above. Instead of this:

services: 'c_restaurantFeatures'

Your card should reference the Restaurant Features field like below:

services: profile.c_restaurantFeatures,
1 Like

Hi @afarooque thanks so much! i did “” the whole time. thats why it didnt work … uiuiui. thanks :))))

Hey @afarooque,

Could you please help with this challenge? I cannot see where I am going wrong.

This is my report card:

image

This is my events.json code:

{
  "verticalKey": "events", // The vertical key from your search configuration
  "pageTitle": "Event Search", // !!!REPLACE THIS VALUE!!! The contents of the title tag and meta open graph tag for title
  // "metaDescription": "", // The meta tag for open graph description
  // "canonicalUrl": "", // The link tag for canonical URL as well as the meta tag for open graph url
  // "keywords": "", // The meta tag for keywords
  "pageSettings": {
    /**
     "search": {
       "verticalKey": "events", // The vertical key from your search configuration
       "defaultInitialSearch": "" // Enter a default search term
     }
    **/
  },  
  "componentSettings": {
    /**
    "QASubmission": {
      "entityId": "", // Set the ID of the entity to use for Q&A submissions, must be of entity type "Organization"
      "privacyPolicyUrl": "" // The fully qualified URL to the privacy policy
    },
    **/
    /**
    "Facets": {
      "title": "", // The title to display above the facets
      "expand": false, // Allow the user to expand and collapse the facets
      "showMore": false, // Display a link to see more facet options within a facet
      "searchOnChange": true // Will automatically run a search as facets are selected or unselected. Set to false to only trigger updates with an Apply button. 
      // Additional options are available in the documentation
    },
    **/
    /**
    "FilterLink": {
      "changeFiltersText": "sorts and filters", // Text that displays by default
      "resetFiltersText": "reset filters", // Text when filters are applied
      "clearSearchText": "clear search" // Text when there are no results, conducts an empty search
    },
    **/
    "AppliedFilters": {
      "removable": true
    },
    "VerticalResults": {
      "noResults": {
        "displayAllResults": true // Optional, whether to display all results in the vertical when no results are found.
      },
      "hideResultsHeader": true
    },
    "SearchBar": {
      "placeholderText": "Search", // The placeholder text in the answers search bar
      "allowEmptySearch": true // Allows users to submit an empty search in the searchbar
    },
    "Pagination": {
      "noResults": {
        "visible": true 
      }
    }
  },
  // Configuration used to define the look and feel of the vertical, both on this page and, by default,
  // on the universal page.
  "verticalsToConfig": {
    "events": { // The vertical key from your search configuration
      // "label": "", // The name of the vertical in the section header and the navigation bar
      // "verticalLimit": 15, // The result count limit for vertical search
      // "universalLimit": 5, // The result count limit for universal search
      "cardType": "eventoverride", // The name of the card to use - e.g. accordion, location, customcard 
      "icon": "calendar", // The icon to use on the card for this vertical
      "universalSectionTemplate": "standard"
    }
  }
}

And this is my cards > component.js code:

{{> cards/card_component componentName='eventoverride' }}

class eventoverrideCardComponent extends BaseCard['eventoverride'] {
  constructor(config = {}, systemConfig = {}) {
    super(config, systemConfig);
  }

  /**
   * This returns an object that will be called `card`
   * in the template. Put all mapping logic here.
   *
   * @param profile profile of the entity in the card
   */
  dataForRender(profile) {
    const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_blank';
    
    return {
      title: profile.name, // The header text of the card
      url: profile.website, // If the card title is a clickable link, set URL here
      target: linkTarget, // If the title's URL should open in a new tab, etc.
      titleEventOptions: this.addDefaultEventOptions(),
      date: Formatter.bigDate(profile),
      subtitle: Formatter.dateRange(profile),
      details: profile.description, // The text in the body of the card
      // If the card's details are longer than a certain character count, you can truncate the
      // text. A toggle will be supplied that can show or hide the truncated text.
      // showMoreDetails: {
      //   showMoreLimit: 750, // Character count limit
      //   showMoreText: 'Show more', // Label when toggle will show truncated text
      //   showLessText: 'Show less' // Label when toggle will hide truncated text
      // },
      // The primary CTA of the card
      CTA1: {
        label: 'Turtle Up', // The CTA's label
        iconName: 'calendar', // The icon to use for the CTA
        url: profile.ticketUrl || profile.website, // The URL a user will be directed to when clicking
        target: linkTarget, // Where the new URL will be opened
        eventType: 'RSVP', // Type of Analytics event fired when clicking the CTA
        eventOptions: this.addDefaultEventOptions(),
        // ariaLabel: '', // Accessible text providing a descriptive label for the CTA
      },
      // The secondary CTA of the card
      CTA2: {
        label: 'Directions',
        iconName: 'directions',
        url: Formatter.getDirectionsUrl(profile),
        target: linkTarget,
        eventType: 'DRIVING_DIRECTIONS',
        eventOptions: this.addDefaultEventOptions(),
        // ariaLabel: '',
      }
    };
  }

  /**
   * The template to render
   * @returns {string}
   * @override
   */
  static defaultTemplateName (config) {
    return 'cards/eventoverride';
  }
}

ANSWERS.registerTemplate(
  'cards/eventoverride',
  {{{stringifyPartial (read 'cards/eventoverride/template') }}}
);
ANSWERS.registerComponentType(eventoverrideCardComponent);

I hope you can see where I’m going wrong. I’ve tried submitting this multiple times :confused:

Thank you,

Ashley

Hey Ashley,

At the moment, the component.js file for the “eventoverride” card has the CTA1’s target set to linkTarget. The challenge is expecting that to be changed to target: '_blank', so you should be able to make that change and resubmit!

Best,
DJ

DJ you are amazing - that was it! Thank you so much :smiley:

1 Like

DJ & Ashley,

Thank you so much for this thread. This was an exact problem I was having and it helped a bunch.

Best,
Quinton

2 Likes