<commit_before>React = require 'react'
BS = require 'react-bootstrap'

interpolate = require 'interpolate'
navigation = require '../navigation/model'

CourseItem = React.createClass
  displayName: 'CourseItem'
  getDefaultProps: ->
    bookUrlPattern: '{cnxUrl}/contents/{ecosystem_book_uuid}'
  render: ->
    {course, cnxUrl, bookUrlPattern} = @props
    {ecosystem_book_uuid} = course
    routeData = navigation.getDataByView('task')
    return null unless course.isRegistered()

    category = course.catalog_offering_identifier.toLowerCase()
    link = interpolate bookUrlPattern, {cnxUrl, ecosystem_book_uuid}

    <BS.ListGroupItem
      href={"#{link}#{routeData.route}"}
      className='concept-coach-course-item'
      data-category={category}>
        {course.description()}
    </BS.ListGroupItem>

module.exports = {CourseItem}<commit_msg>Catalog offering may be undefined<commit_after>React = require 'react'
BS = require 'react-bootstrap'

interpolate = require 'interpolate'
navigation = require '../navigation/model'

CourseItem = React.createClass
  displayName: 'CourseItem'
  getDefaultProps: ->
    bookUrlPattern: '{cnxUrl}/contents/{ecosystem_book_uuid}'
  render: ->
    {course, cnxUrl, bookUrlPattern} = @props
    {ecosystem_book_uuid} = course
    routeData = navigation.getDataByView('task')
    return null unless course.isRegistered()

    category = course.catalog_offering_identifier?.toLowerCase() or 'unknown'
    link = interpolate bookUrlPattern, {cnxUrl, ecosystem_book_uuid}

    <BS.ListGroupItem
      href={"#{link}#{routeData.route}"}
      className='concept-coach-course-item'
      data-category={category}>
        {course.description()}
    </BS.ListGroupItem>

module.exports = {CourseItem}
{'fraction_non_alphanumeric': 0.1235632183908046, 'fraction_numerical': 0.0, 'mean_word_length': 4.4576802507836994, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5408175', 'n_tokens_mistral': 531, 'n_tokens_neox': 530, 'n_words': 99}