<commit_before>import Ember from 'ember';
import DS from 'ember-data';
import ENV from '../config/environment';

export default DS.Model.reopenClass({
  random: function(proposal_id) {
    var path = "/proposals/next";
    if(proposal_id) {
      path += "?proposal_id=" + proposal_id;
    }
    return (new Ember.RSVP.Promise(function(resolve, reject) {
      Ember.$.getJSON(ENV.api + path).then(
        function(data) {
          resolve(data);
        }, reject);
    }));
  },
}).extend({
  type: DS.attr("string"),
  user: DS.belongsTo("user"),
  lang: DS.belongsTo("lang"),
  wordset: DS.belongsTo("wordset", {async: true}),
  project: DS.belongsTo("project", {inverse: null}),
  wordName: DS.attr("string"),
  reason: DS.attr("string"),
  state: DS.attr("string"),
  createdAt: DS.attr("date"),
  tally: DS.attr("number"),
  votes: DS.hasMany("vote"),
  activities: DS.hasMany("activity"),
  flagged: DS.attr("boolean"),

  // NewWord
  meanings: DS.attr(),

  // MeaningLike
  def: DS.attr("string"),
  example: DS.attr("string"),

  // ChangeMeaning
  meaning: DS.belongsTo("meaning", {inverse: null}),
  original: DS.attr(),
  parentId: DS.attr(),

  // NewMeaning
  pos: DS.attr("string"),

  typeName: function() {
    if(this.get("type") === "NewWordset") {
      return "New Word";
    } else if(this.get("type") === "NewMeaning") {
      return "New Meaning";
    } else if(this.get("type") === "MeaningChange") {
      return "Change";
    } else if(this.get("type") === "MeaningRemoval") {
      return "Removal";
    }
  }.property("type"),
  isRemoval: function() {
    return (this.get("type") === "MeaningRemoval");
  }.property("type"),
  isEditableType: function() {
    return (this.get("type") !== "MeaningRemoval");
  }.property("typeName"),
  positiveTally: function() {
    if(this.get("tally") > 0 ) {
      return "width: " + this.get("tally") + "%;";<commit_msg>Add labels to proposal<commit_after>import Ember from 'ember';
import DS from 'ember-data';
import ENV from '../config/environment';

export default DS.Model.reopenClass({
  random: function(proposal_id) {
    var path = "/proposals/next";
    if(proposal_id) {
      path += "?proposal_id=" + proposal_id;
    }
    return (new Ember.RSVP.Promise(function(resolve, reject) {
      Ember.$.getJSON(ENV.api + path).then(
        function(data) {
          resolve(data);
        }, reject);
    }));
  },
}).extend({
  type: DS.attr("string"),
  user: DS.belongsTo("user"),
  lang: DS.belongsTo("lang"),
  wordset: DS.belongsTo("wordset", {async: true}),
  project: DS.belongsTo("project", {inverse: null}),
  wordName: DS.attr("string"),
  reason: DS.attr("string"),
  state: DS.attr("string"),
  createdAt: DS.attr("date"),
  tally: DS.attr("number"),
  votes: DS.hasMany("vote"),
  activities: DS.hasMany("activity"),
  flagged: DS.attr("boolean"),

  // NewWord
  meanings: DS.attr(),

  // MeaningLike
  def: DS.attr("string"),
  example: DS.attr("string"),
  labels: DS.hasMany("labels", {inverse: null}),

  // ChangeMeaning
  meaning: DS.belongsTo("meaning", {inverse: null}),
  original: DS.attr(),
  parentId: DS.attr(),

  // NewMeaning
  pos: DS.attr("string"),

  typeName: function() {
    if(this.get("type") === "NewWordset") {
      return "New Word";
    } else if(this.get("type") === "NewMeaning") {
      return "New Meaning";
    } else if(this.get("type") === "MeaningChange") {
      return "Change";
    } else if(this.get("type") === "MeaningRemoval") {
      return "Removal";
    }
  }.property("type"),
  isRemoval: function() {
    return (this.get("type") === "MeaningRemoval");
  }.property("type"),
  isEditableType: function() {
    return (this.get("type") !== "MeaningRemoval");
  }.property("typeName"),
  positiveTally: function() {
    if(this.get("tally") > 0 ) {
      return "width: " + this.get("tally") + "%;";
{'fraction_non_alphanumeric': 0.20556133056133055, 'fraction_numerical': 0.0005197505197505198, 'mean_word_length': 3.5876042908224077, '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': '2320855', 'n_tokens_mistral': 1341, 'n_tokens_neox': 1317, 'n_words': 261}