<commit_before>define([
 'backbone', 'moment', 'underscore',
 'stories/collections/MediaCollection'
], function(
  Backbone, moment, _,
  MediaCollection
) {

  'use strict';

  var Story = Backbone.Model.extend({
    urlRoot: window.gfw.config.GFW_API_HOST_NEW_API + '/story/',

    defaults: {
      media: new MediaCollection()
    },

    initialize: function(params) {
      this.edit = params && params.edit || null;
    },

    parse: function(response) {
      var attributes;
      if (response.data) {
        attributes = response.data.attributes;
        attributes.id = response.data.id;
      } else {
        attributes = response.attributes;
      }

      if (this.edit && attributes.media) {
        attributes.media = new MediaCollection(attributes.media);
      }

      return attributes;
    },

    toJSON: function() {
      var json = _.clone(this.attributes);

      for(var attr in json) {
        if((json[attr] instanceof Backbone.Model) || (json[attr] instanceof Backbone.Collection)) {
          json[attr] = json[attr].toJSON();
        }
      }

      return json;
    },

    addMedia: function(media) {
      var mediaCollection = this.get('media');
      mediaCollection.append(media);
    },

    formattedDate: function() {
      var date = moment(this.get('date'));
      return date.format('MMMM DD, YYYY');
    },
<commit_msg>Fix: Stories List - Link to story<commit_after>define([
 'backbone', 'moment', 'underscore',
 'stories/collections/MediaCollection'
], function(
  Backbone, moment, _,
  MediaCollection
) {

  'use strict';

  var Story = Backbone.Model.extend({
    urlRoot: window.gfw.config.GFW_API_HOST_NEW_API + '/story/',

    defaults: {
      media: new MediaCollection()
    },

    initialize: function(params) {
      this.edit = params && params.edit || null;
    },

    parse: function(response) {
      var attributes;
      if (response.data) {
        attributes = response.data.attributes;
        attributes.id = response.data.id;
      } else {
        attributes = response.attributes;
        attributes.id = response.id;
      }

      if (this.edit && attributes.media) {
        attributes.media = new MediaCollection(attributes.media);
      }

      return attributes;
    },

    toJSON: function() {
      var json = _.clone(this.attributes);

      for(var attr in json) {
        if((json[attr] instanceof Backbone.Model) || (json[attr] instanceof Backbone.Collection)) {
          json[attr] = json[attr].toJSON();
        }
      }

      return json;
    },

    addMedia: function(media) {
      var mediaCollection = this.get('media');
      mediaCollection.append(media);
    },

    formattedDate: function() {
      var date = moment(this.get('date'));
      return date.format('MMMM DD, YYYY');
    },

{'fraction_non_alphanumeric': 0.1360544217687075, 'fraction_numerical': 0.0, 'mean_word_length': 2.50564617314931, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5445403', 'n_tokens_mistral': 840, 'n_tokens_neox': 813, 'n_words': 171}