<commit_before>_             = require 'underscore'
sd            = require('sharify').data
Backbone      = require 'backbone'
OrderedSets   = require '../../collections/ordered_sets.coffee'
Partner       = require '../../models/partner'
Profiles      = require '../../collections/profiles'
Q             = require 'q'

@index = (req, res) ->
  featuredPartners = new OrderedSets(key: 'partners:featured-partners')
  # Fetch the featured partners (OrderedSet)
  featuredPartners.fetch({ cache: true }).then ->
    featuredPartners = featuredPartners.first()
    # Fetch the OrderedSets Items as Profiles
    url = "#{sd.ARTSY_URL}/api/v1/set/#{featuredPartners.get('id')}/items"
    profiles = new Profiles []
    profiles.fetch({ url: url, cache: true }).then ->
      # For each Profile, set a Partner and fetch/set that Partner's Locations
      Q.allSettled(_.map(profiles.models, (profile) ->
        partner = new Partner(profile.get('owner'))
        profile.set 'owner', partner
        return partner.locations().fetch({ cache: true })
      )).then ->
        # Final data set is a collection of profiles with populated
        # partners and locations
        res.locals.sd.PROFILES = profiles
        res.render 'template',
          featuredPartnerProfiles: profiles<commit_msg>Fixes problem with only museums showing up on featured partners page<commit_after>_             = require 'underscore'
sd            = require('sharify').data
Backbone      = require 'backbone'
OrderedSets   = require '../../collections/ordered_sets.coffee'
Partner       = require '../../models/partner'
Profiles      = require '../../collections/profiles'
Q             = require 'q'

@index = (req, res) ->
  featuredPartners = new OrderedSets(key: 'partners:featured-partners')
  # Fetch the featured partners (OrderedSet)
  featuredPartners.fetchAll({ cache: true }).then ->
    profiles = featuredPartners.first().get('items')
    # For each Profile, set a Partner and fetch/set that Partner's Locations
    Q.allSettled(profiles.map (profile) ->
      partner = new Partner(profile.get('owner'))
      profile.set 'owner', partner
      return partner.locations().fetch({ cache: true })
    ).then ->
      # Final data set is a collection of profiles with populated
      # partners and locations
      res.locals.sd.PROFILES = profiles
      res.render 'template',
        featuredPartnerProfiles: profiles
{'fraction_non_alphanumeric': 0.12385702410640066, 'fraction_numerical': 0.00041562759767248546, 'mean_word_length': 2.8635634028892456, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '3191126', 'n_tokens_mistral': 676, 'n_tokens_neox': 683, 'n_words': 188}