<commit_before><template>
  <div id="directory-filter-by" class="row page" :class="'view-' + viewType">
    <div class="col-sm-3" v-if="!isMobile">
      <makeries-menu/>
    </div>
    <div class="col-sm-9">
      <div class="row no-gutter">
        <div class="col-sm-10 col-md-11 pull-left search-directory-wrapper lg-margin-bottom">
          <h3 class="no-margin">
            {{currentFilterTypeValuePretty}}
          </h3>
        </div>
        <div class="col-sm-2 col-md-1 pull-left view-type-wrapper">
          <view-type/>
        </div>
      </div>
      <div class="row small-gutter">
        <div class="col-xs-12">
          <makeries-list :makeries="filteredData"/>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import {mapGetters} from 'vuex'
  import Config from '../../api/app.config'
  import {getNthFragment} from '../../modules/utils'
  import banner from '../common/banner'
  import makeriesMenu from './directory-menu.vue'
  import makeriesList from './makeries-list.vue'
  import viewType from './view-type.vue'
  import waitDirectoryData from '../../mixins/waitDirectoryData'

  export default {
    name: 'filter-by',
    components: {banner, makeriesMenu, makeriesList, viewType},
    mixins: [waitDirectoryData],
    computed: {
      ...mapGetters(['directory', 'isMobile', 'viewType']),
      currentFilterType () {
        let currentFilter = getNthFragment(this.$route.path, 3)
        let filterTypes = Config.routerSettings.filterBy
        let rev = {}
        for (let key in filterTypes) {
          rev[getNthFragment(filterTypes[key], 3)] = key
        }
        return rev[currentFilter]
      },
      currentFilterTypeValue () {
        return getNthFragment(this.$route.path, 4)
      },
      currentFilterTypeValuePretty () {
        return this.currentFilterTypeValue.replace(/-/g, ' ')
      },
      filteredData () {
        return this.directory.filter(item => {
          if (item[this.currentFilterType].length > 0) {
            for (let i = 0; i < item[this.currentFilterType].length; i++) {
              if (this.currentFilterTypeValue === item[this.currentFilterType][i].pretty) {
                return item
              }
            }
          } else {
            return this.currentFilterTypeValue === item[this.currentFilterType].pretty
          }
        })
      }
    },
    metaInfo () {
      return {
        title: `${Config.titles.directory.filterBy} ${Config.titles.directory[this.currentFilterType].toLowerCase()}: ${this.currentFilterTypeValuePretty}`
      }
    }
  }
</script>
<commit_msg>fixed the region based filter<commit_after><template>
  <div id="directory-filter-by" class="row page" :class="'view-' + viewType">
    <div class="col-sm-3" v-if="!isMobile">
      <makeries-menu/>
    </div>
    <div class="col-sm-9">
      <div class="row no-gutter">
        <div class="col-sm-10 col-md-11 pull-left search-directory-wrapper lg-margin-bottom">
          <h3 class="no-margin">
            {{currentFilterTypeValuePretty}}
          </h3>
        </div>
        <div class="col-sm-2 col-md-1 pull-left view-type-wrapper">
          <view-type/>
        </div>
      </div>
      <div class="row small-gutter">
        <div class="col-xs-12">
          <makeries-list :makeries="filteredData"/>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import {mapGetters} from 'vuex'
  import Config from '../../api/app.config'
  import {getNthFragment} from '../../modules/utils'
  import banner from '../common/banner'
  import makeriesMenu from './directory-menu.vue'
  import makeriesList from './makeries-list.vue'
  import viewType from './view-type.vue'
  import waitDirectoryData from '../../mixins/waitDirectoryData'

  export default {
    name: 'filter-by',
    components: {banner, makeriesMenu, makeriesList, viewType},
    mixins: [waitDirectoryData],
    computed: {
      ...mapGetters(['directory', 'isMobile', 'viewType']),
      currentFilterType () {
        let currentFilter = getNthFragment(this.$route.path, 3)
        let filterTypes = Config.routerSettings.filterBy
        let rev = {}
        for (let key in filterTypes) {
          rev[getNthFragment(filterTypes[key], 3)] = key
        }
        return rev[currentFilter]
      },
      currentFilterTypeValue () {
        return getNthFragment(this.$route.path, 4)
      },
      currentFilterTypeValuePretty () {
        return this.currentFilterTypeValue.replace(/-/g, ' ')
      },
      filteredData () {
        return this.directory.filter(item => {
          if (Array.isArray(item[this.currentFilterType])) {
            for (let i = 0; i < item[this.currentFilterType].length; i++) {
              if (this.currentFilterTypeValue === item[this.currentFilterType][i].pretty) {
                return item
              }
            }
          } else {
            return item[this.currentFilterType] !== null && this.currentFilterTypeValue === item[this.currentFilterType].pretty
          }
        })
      }
    },
    metaInfo () {
      return {
        title: `${Config.titles.directory.filterBy} ${Config.titles.directory[this.currentFilterType].toLowerCase()}: ${this.currentFilterTypeValuePretty}`
      }
    }
  }
</script>

{'fraction_non_alphanumeric': 0.1507318000380156, 'fraction_numerical': 0.006272571754419312, 'mean_word_length': 2.3052763819095476, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 56, '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': '5093219', 'n_tokens_mistral': 1607, 'n_tokens_neox': 1584, 'n_words': 309}