<commit_before>import Ember from 'ember';
import SortableTable from 'ilios/mixins/sortable-table';
import escapeRegExp from '../utils/escape-reg-exp';

const { Component, computed, isPresent } = Ember;

export default Component.extend(SortableTable, {
  classNames: ['my-materials'],
  filter: null,
  courseIdFilter: null,
  filteredMaterials: computed('materials.[]', 'filter', 'courseIdFilter', function(){
    let materials = this.get('materials');
    const filter = this.get('filter');
    const courseIdFilter = this.get('courseIdFilter');
    if (isPresent(courseIdFilter)) {
      materials = materials.filterBy('course', courseIdFilter);
    }
    if (isPresent(filter)) {
      let val = escapeRegExp(filter);
      const exp = new RegExp(val, 'gi');

      materials = materials.filter(material => {
        let searchString = material.title + material.courseTitle + material.sessionTitle;
        if (isPresent(material.instructors)) {
          searchString += material.instructors.join('');<commit_msg>Add a space into the material filter search string<commit_after>import Ember from 'ember';
import SortableTable from 'ilios/mixins/sortable-table';
import escapeRegExp from '../utils/escape-reg-exp';

const { Component, computed, isPresent } = Ember;

export default Component.extend(SortableTable, {
  classNames: ['my-materials'],
  filter: null,
  courseIdFilter: null,
  filteredMaterials: computed('materials.[]', 'filter', 'courseIdFilter', function(){
    let materials = this.get('materials');
    const filter = this.get('filter');
    const courseIdFilter = this.get('courseIdFilter');
    if (isPresent(courseIdFilter)) {
      materials = materials.filterBy('course', courseIdFilter);
    }
    if (isPresent(filter)) {
      let val = escapeRegExp(filter);
      const exp = new RegExp(val, 'gi');

      materials = materials.filter(material => {
        let searchString = material.title + ' ' + material.courseTitle + ' ' + material.sessionTitle + ' ';
        if (isPresent(material.instructors)) {
          searchString += material.instructors.join(' ');
{'fraction_non_alphanumeric': 0.13636363636363635, 'fraction_numerical': 0.0, 'mean_word_length': 4.137592137592137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5261231', 'n_tokens_mistral': 593, 'n_tokens_neox': 582, 'n_words': 139}