<commit_before>_ = require 'underscore'
sd = require('sharify').data
Backbone = require 'backbone'
Artworks = require '../collections/artworks.coffee'
Articles = require '../collections/articles.coffee'
Q = require 'q'

module.exports = class Article extends Backbone.Model

  urlRoot: "#{sd.POSITRON_URL}/api/articles"

  slideshowArtworks: ->
    return null unless (slideshow = _.first @get 'sections')?.type is 'slideshow'
    new Artworks (for item in slideshow.items when item.type is 'artwork'
      { id: item.id })

  fetchWithRelated: (options = {}) ->
    footerArticles = new Articles
    author = new Backbone.Model
    Q.all(
      @fetch()
      footerArticles.fetch
        cache: true
        data:
          # Artsy Editorial. TODO: Smart footer data.
          author_id: '<PASSWORD>'<commit_msg>Defer require so as to prevent circular references<commit_after>_ = require 'underscore'
Q = require 'q'
Backbone = require 'backbone'
sd = require('sharify').data
Artworks = require '../collections/artworks.coffee'

module.exports = class Article extends Backbone.Model
  urlRoot: "#{sd.POSITRON_URL}/api/articles"

  slideshowArtworks: ->
    return null unless (slideshow = _.first @get 'sections')?.type is 'slideshow'
    new Artworks (for item in slideshow.items when item.type is 'artwork'
      { id: item.id })

  fetchWithRelated: (options = {}) ->
    # Deferred require
    Articles = require '../collections/articles.coffee'
    footerArticles = new Articles
    author = new Backbone.Model
    Q.all(
      @fetch()
      footerArticles.fetch
        cache: true
        data:
          # Artsy Editorial. TODO: Smart footer data.
          author_id: '<PASSWORD>'
{'fraction_non_alphanumeric': 0.11636148848198465, 'fraction_numerical': 0.0, 'mean_word_length': 3.131707317073171, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3179805', 'n_tokens_mistral': 533, 'n_tokens_neox': 509, 'n_words': 144}