<commit_before>/* app/models/project.js - Project model */
'use strict';

define([
    'backbone',
    'underscore',
    'app/models/cover',
    'app/collections/showcases'
], function( Backbone, _, CoverImage, Showcases ) {

    var Project = Backbone.Model.extend({
        parse : function(response, options){

            response.htmlDate = this.makeHtmlDate( response.timestamp )

            _.each( response.relatedLinks, function(item, index){
                var split = item.split('|')
                response.relatedLinks[index] = {
                    'title' : split[0] ? split[0].trim() : '',
                    'url' : split[1] ? split[1].trim() : ''
                }
            } )

            return response
        },

        initialize : function() {
            this.set({

                date : this.parseDate( this.get('timestamp') ),

                coverImage : new CoverImage( this.get('cover'), {
                    tags : this.get('brand_tags')
                            .concat( this.get('type_tags') )
                            .concat( this.get('industry_tags') )
                } ),

                showcases : new Showcases( this.get('showcases'), {
                    path : this.url()
                } )
            })

            this.get('showcases').add([
                {
                    type : 'info',
                    title : 'Info',
                    url_title : 'info',
                    content : this.get('info')
                },
                {
                    type : 'related',
                    title : 'Related',
                    url_title : 'related',
                    links : this.get('relatedLinks')
                }
            ], {
                path : this.url()
            })
        },<commit_msg>conditionally adding related links and info to project models only if present<commit_after>/* app/models/project.js - Project model */
'use strict';

define([
    'backbone',
    'underscore',
    'app/models/cover',
    'app/collections/showcases'
], function( Backbone, _, CoverImage, Showcases ) {

    var Project = Backbone.Model.extend({
        parse : function(response, options){

            response.htmlDate = this.makeHtmlDate( response.timestamp )

            _.each( response.relatedLinks, function(item, index){
                var split = item.split('|')
                response.relatedLinks[index] = {
                    'title' : split[0] ? split[0].trim() : '',
                    'url' : split[1] ? split[1].trim() : ''
                }
            } )

            return response
        },

        initialize : function() {
            this.set({

                date : this.parseDate( this.get('timestamp') ),

                coverImage : new CoverImage( this.get('cover'), {
                    tags : this.get('brand_tags')
                            .concat( this.get('type_tags') )
                            .concat( this.get('industry_tags') )
                } ),

                showcases : new Showcases( this.get('showcases'), {
                    path : this.url()
                } )
            })

            if ( this.get('info') ) {
                this.get('showcases').add({
                    type : 'info',
                    title : 'Info',
                    url_title : 'info',
                    content : this.get('info')
                }, {
                    path : this.url()
                })
            }

            if ( this.get('relatedLinks') ) {
                this.get('showcases').add({
                    type : 'related',
                    title : 'Related',
                    url_title : 'related',
                    links : this.get('relatedLinks')
                }, {
                    path : this.url()
                })
            }
        },
{'fraction_non_alphanumeric': 0.1308411214953271, 'fraction_numerical': 0.0020768431983385254, 'mean_word_length': 1.139367018323154, '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': '6578606', 'n_tokens_mistral': 1008, 'n_tokens_neox': 931, 'n_words': 180}