<commit_before>//
// Team Template Helpers

Template.teams.helpers({
  teams: function(){
    return Teams.find({});
  },

  myTeam: function(){
    var user = Meteor.user();
    var myTeam = Teams.findOne({ members: user._id }) || Teams.findOne({ owner: user });
    return myTeam;
  },

  ownerInfo: function() {
    if (this.owner.profile && this.owner.services) {
      str = this.owner.profile.name + ' <img src="' + this.owner.services.google.picture + '" style="border-radius: 50%; width: 30px; height:30px;">';
    } else {
      str = this.owner;
      Meteor.call('changeOwner', this, this.owner);
    }
    return new Handlebars.SafeString(str);
  },

  isOwner: function(){
    let superpowers = Session.get('admins');
    if (superpowers && Meteor.user()) {
      superpowers.push(this.owner.services && this.owner.services.google.email || this.owner);
      return superpowers.includes(Meteor.user().services.google.email);
    }
  },

  isAdmin: function(){
    if(Session.get("admins")){
      return Session.get('admins').includes(Meteor.user().services.google.email);
    }
  },

  teamMembers : function(){
    var str = '';
    console.log(this.members);<commit_msg>Fix connection between team and owner<commit_after>//
// Team Template Helpers

Template.teams.helpers({
  teams: function(){
    return Teams.find({});
  },

  myTeam: function(){
    var user = Meteor.user();
    var myTeam = Teams.findOne({ members: user._id }) || Teams.findOne({ 'owner._id': user._id });
    return myTeam;
  },

  ownerInfo: function() {
    if (this.owner.profile && this.owner.services) {
      str = this.owner.profile.name + ' <img src="' + this.owner.services.google.picture + '" style="border-radius: 50%; width: 30px; height:30px;">';
    } else {
      str = this.owner;
      Meteor.call('changeOwner', this, this.owner);
    }
    return new Handlebars.SafeString(str);
  },

  isOwner: function(){
    let superpowers = Session.get('admins');
    if (superpowers && Meteor.user()) {
      superpowers.push(this.owner.services && this.owner.services.google.email || this.owner);
      return superpowers.includes(Meteor.user().services.google.email);
    }
  },

  isAdmin: function(){
    if(Session.get("admins")){
      return Session.get('admins').includes(Meteor.user().services.google.email);
    }
  },

  teamMembers : function(){
    var str = '';
    console.log(this.members);
{'fraction_non_alphanumeric': 0.1745635910224439, 'fraction_numerical': 0.004987531172069825, 'mean_word_length': 3.2526501766784452, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6791527', 'n_tokens_mistral': 805, 'n_tokens_neox': 754, 'n_words': 146}