<commit_before>class @Courseware
  @prefix: ''

  constructor: ->
    Logger.bind()
    @render()

  @start: ->
    new Courseware

  render: ->
    XBlock.initializeBlocks($('.course-content'))
    
    courseContentElement = $('.course-content')[0]
    blocks = XBlock.initializeBlocks(courseContentElement)

    if (courseContentElement.dataset.enableCompletionOnViewService == 'true')
      markBlocksCompletedOnViewIfNeeded(blocks[0].runtime, courseContentElement)

    $('.course-content .histogram').each ->
      id = $(this).attr('id').replace(/histogram_/, '')
      try
        histg = new Histogram id, $(this).data('histogram')
      catch error
        histg = error
        if console?
          console.log(error)
      return histg<commit_msg>fix double initialization of blocks<commit_after>class @Courseware
  @prefix: ''

  constructor: ->
    Logger.bind()
    @render()

  @start: ->
    new Courseware

  render: ->
    courseContentElement = $('.course-content')[0]
    blocks = XBlock.initializeBlocks(courseContentElement)

    if (courseContentElement.dataset.enableCompletionOnViewService == 'true')
      markBlocksCompletedOnViewIfNeeded(blocks[0].runtime, courseContentElement)

    $('.course-content .histogram').each ->
      id = $(this).attr('id').replace(/histogram_/, '')
      try
        histg = new Histogram id, $(this).data('histogram')
      catch error
        histg = error
        if console?
          console.log(error)
      return histg
{'fraction_non_alphanumeric': 0.13449899125756556, 'fraction_numerical': 0.0026899798251513113, 'mean_word_length': 3.0434782608695654, 'pattern_counts': {'":': 0, '<': 3, '<?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': '397580', 'n_tokens_mistral': 430, 'n_tokens_neox': 415, 'n_words': 80}