<commit_before>Activities = new Mongo.Collection('activities');

var ActivitiesSchema = new SimpleSchema({
  residentIds: {
    type: [String],
    autoform: {
      type: "select-multiple",
      placeholder: "Choose resident(s)",
      options: function() {
        // Get list of homes, sorted alphabetically
        const homes = Homes.find({}, {sort: {name: 1}}).fetch();

        // Create an array residents grouped by home
        const residentsSelectOptions = _.map(homes, function (home) {
          // Get home ID
          const homeId = home._id;

          // do not show departed residents
          const departed = false;

          // Sort by first name in alphabetical order
          const sort = {firstName: 1}

          // Get a list of residents for current home
          const homeResidents = Residents.find({ homeId, departed }, {sort}).fetch();

          // Create an object containing a home and its residents
          const homeGroup = {
            optgroup: home.name,
            options: _.map(homeResidents, function (resident) {
              // Create an object containing the resident name and ID
              const residentObject = {
                value: resident._id,
                label: resident.fullName()
              };

              return residentObject;
           })
          }

          return homeGroup;
        });

        return residentsSelectOptions;
      }
    }<commit_msg>Exclude residents who are on hiatus from select list<commit_after>Activities = new Mongo.Collection('activities');

var ActivitiesSchema = new SimpleSchema({
  residentIds: {
    type: [String],
    autoform: {
      type: "select-multiple",
      placeholder: "Choose resident(s)",
      options: function() {
        // Get list of homes, sorted alphabetically
        const homes = Homes.find({}, {sort: {name: 1}}).fetch();

        // Create an array residents grouped by home
        const residentsSelectOptions = _.map(homes, function (home) {
          // Get home ID
          const homeId = home._id;

          // do not show departed residents
          const departed = false;

          // do not show residents who are on hiatus
          const onHiatus = false;

          // Sort by first name in alphabetical order
          const sort = {firstName: 1}

          // Get a list of residents for current home
          const homeResidents = Residents.find({ homeId, departed, onHiatus }, {sort}).fetch();

          // Create an object containing a home and its residents
          const homeGroup = {
            optgroup: home.name,
            options: _.map(homeResidents, function (resident) {
              // Create an object containing the resident name and ID
              const residentObject = {
                value: resident._id,
                label: resident.fullName()
              };

              return residentObject;
           })
          }

          return homeGroup;
        });

        return residentsSelectOptions;
      }
    }
{'fraction_non_alphanumeric': 0.09024793388429753, 'fraction_numerical': 0.001322314049586777, 'mean_word_length': 1.8070500927643784, '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': '7532568', 'n_tokens_mistral': 757, 'n_tokens_neox': 710, 'n_words': 258}