<commit_before>import React, { Component } from "react";
import { Label } from "reactstrap";
import gql from "graphql-tag";
import { graphql } from "react-apollo";
import Dots from "./dots";
import SubscriptionHelper from "../../../../helpers/subscriptionHelper";
const SUB = gql`
  subscription DilithiumStress($simulatorId: ID!) {
    reactorUpdate(simulatorId: $simulatorId) {
      id
      alphaLevel
      alphaTarget
      betaLevel
      betaTarget
      model
      heat
    }
  }
`;

class DilithiumStress extends Component {
  // This calculation came from client/src/components/views/DilithiumStress/dilithiumStress.js
  calcStressLevel = (reactor) => {
    const { alphaTarget, betaTarget } = reactor;
    const { alphaLevel, betaLevel } = reactor;
    const alphaDif = Math.abs(alphaTarget - alphaLevel);
    const betaDif = Math.abs(betaTarget - betaLevel);
    const stressLevel = alphaDif + betaDif > 100 ? 100 : alphaDif + betaDif;
    return stressLevel;
  }

  // Not sure if this is the best way to get this card. Perhaps the parent react
  // node should decide if this component should render or not since it contains
  // the props necessary to decide whether or not it would be appropriate to
  // render this? ¯\_(ツ)_/¯
  getDilithiumStressCard = (station) => {
    if (!station) return null;
    return station.cards.find(card => card.component === 'DilithiumStress');
  }

  render() {
    if (this.props.data.loading || !this.props.data.reactors) return null;
    const dilithiumStressCard = this.getDilithiumStressCard(this.props.station)
    if (!dilithiumStressCard) return null;
    // I'm assuming this is the way to get the reactor info.
    const reactor = this.props.data.reactors && this.props.data.reactors[0];
    if (!reactor) return null;
    const stressLevel = this.calcStressLevel(reactor) / 100<commit_msg>removes extra comments<commit_after>import React, { Component } from "react";
import { Label } from "reactstrap";
import gql from "graphql-tag";
import { graphql } from "react-apollo";
import Dots from "./dots";
import SubscriptionHelper from "../../../../helpers/subscriptionHelper";
const SUB = gql`
  subscription DilithiumStress($simulatorId: ID!) {
    reactorUpdate(simulatorId: $simulatorId) {
      id
      alphaLevel
      alphaTarget
      betaLevel
      betaTarget
      model
      heat
    }
  }
`;

class DilithiumStress extends Component {
  // This calculation came from client/src/components/views/DilithiumStress/dilithiumStress.js
  calcStressLevel = (reactor) => {
    const { alphaTarget, betaTarget } = reactor;
    const { alphaLevel, betaLevel } = reactor;
    const alphaDif = Math.abs(alphaTarget - alphaLevel);
    const betaDif = Math.abs(betaTarget - betaLevel);
    const stressLevel = alphaDif + betaDif > 100 ? 100 : alphaDif + betaDif;
    return stressLevel;
  }

  getDilithiumStressCard = (station) => {
    if (!station) return null;
    return station.cards.find(card => card.component === 'DilithiumStress');
  }

  render() {
    if (this.props.data.loading || !this.props.data.reactors) return null;
    const dilithiumStressCard = this.getDilithiumStressCard(this.props.station)
    if (!dilithiumStressCard) return null;
    const reactor = this.props.data.reactors && this.props.data.reactors[0];
    if (!reactor) return null;
    const stressLevel = this.calcStressLevel(reactor) / 100
{'fraction_non_alphanumeric': 0.11107828655834565, 'fraction_numerical': 0.005908419497784343, 'mean_word_length': 3.490716180371353, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1693169', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1032, 'n_words': 281}