<commit_before>import { Template } from 'meteor/templating';
import { _ } from 'meteor/erasaur:meteor-lodash';

import { Opportunities } from '../../../api/opportunity/OpportunityCollection.js';
import { OpportunityInstances } from '../../../api/opportunity/OpportunityInstanceCollection.js';
import { Interests } from '../../../api/interest/InterestCollection.js';
import { Semesters } from '../../../api/semester/SemesterCollection.js';
import { Slugs } from '../../../api/slug/SlugCollection.js';
import { Users } from '../../../api/user/UserCollection.js';
import { getRouteUserName } from '../shared/route-user-name';

Template.Student_Opportunities_Of_Interest_Card.onCreated(function appBodyOnCreated() {
  this.subscribe(Opportunities.getPublicationName());
  this.subscribe(Interests.getPublicationName());
  this.subscribe(Semesters.getPublicationName());
  this.subscribe(Slugs.getPublicationName());
  this.subscribe(Users.getPublicationName());
});


Template.Student_Opportunities_Of_Interest_Card.helpers({
  getDictionary() {
    return Template.instance().state;
  },
  opportunities() {
    return Opportunities.find().fetch();
  },
  opportunityName(opportunity) {
    return opportunity.name;
  },
  opportunitySemesters(opp) {
    const semesters = opp.semesterIDs;
    const semesterNames = [];
    _.map(semesters, (sem) => {
      semesterNames.push(Semesters.toString(sem));
    });
    return semesterNames;
  },
  interestName(interest) {
    return interest.name;
  },
  opportunityInterests(opp) {
    const ret = [];
    if (getRouteUserName()) {
      const opportunity = opp;
      _.map(opportunity.interestIDs, (id) => {
        ret.push(Interests.findDoc(id));
      });
    }
    return ret;
  },
  opportunityShortDescription(opp) {
    let description = opp.description;
    if (description.length > 200) {
      description = `${description.substring(0, 200)} ...`;
    }
    return description;
  },
  userInterests() {
    const ret = [];
    if (getRouteUserName()) {
      const user = Users.findDoc({ username: getRouteUserName() });
      _.map(user.interestIDs, (id) => {
        ret.push(Interests.findDoc(id));<commit_msg>Suggested opportunities no longer list dates in the past<commit_after>import { Template } from 'meteor/templating';
import { _ } from 'meteor/erasaur:meteor-lodash';

import { Opportunities } from '../../../api/opportunity/OpportunityCollection.js';
import { OpportunityInstances } from '../../../api/opportunity/OpportunityInstanceCollection.js';
import { Interests } from '../../../api/interest/InterestCollection.js';
import { Semesters } from '../../../api/semester/SemesterCollection.js';
import { Slugs } from '../../../api/slug/SlugCollection.js';
import { Users } from '../../../api/user/UserCollection.js';
import { getRouteUserName } from '../shared/route-user-name';

Template.Student_Opportunities_Of_Interest_Card.onCreated(function appBodyOnCreated() {
  this.subscribe(Opportunities.getPublicationName());
  this.subscribe(Interests.getPublicationName());
  this.subscribe(Semesters.getPublicationName());
  this.subscribe(Slugs.getPublicationName());
  this.subscribe(Users.getPublicationName());
});


Template.Student_Opportunities_Of_Interest_Card.helpers({
  getDictionary() {
    return Template.instance().state;
  },
  opportunities() {
    return Opportunities.find().fetch();
  },
  opportunityName(opportunity) {
    return opportunity.name;
  },
  opportunitySemesters(opp) {
    const semesters = opp.semesterIDs;
    const semesterNames = [];
    const currentSemesterID = Semesters.getCurrentSemester();
    const currentSemester = Semesters.findDoc(currentSemesterID);
    _.map(semesters, (sem) => {
      if (Semesters.findDoc(sem).sortBy >= currentSemester.sortBy) {
        semesterNames.push(Semesters.toString(sem));
      }
    });
    return semesterNames;
  },
  interestName(interest) {
    return interest.name;
  },
  opportunityInterests(opp) {
    const ret = [];
    if (getRouteUserName()) {
      const opportunity = opp;
      _.map(opportunity.interestIDs, (id) => {
        ret.push(Interests.findDoc(id));
      });
    }
    return ret;
  },
  opportunityShortDescription(opp) {
    let description = opp.description;
    if (description.length > 200) {
      description = `${description.substring(0, 200)} ...`;
    }
    return description;
  },
  userInterests() {
    const ret = [];
    if (getRouteUserName()) {
      const user = Users.findDoc({ username: getRouteUserName() });
      _.map(user.interestIDs, (id) => {
        ret.push(Interests.findDoc(id));
{'fraction_non_alphanumeric': 0.15664488017429193, 'fraction_numerical': 0.0030501089324618735, 'mean_word_length': 3.6942740286298568, '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': '3111977', 'n_tokens_mistral': 1409, 'n_tokens_neox': 1369, 'n_words': 224}