<commit_before>{{strip}}
  {{set layout="main.tpl"}}

  {{$name = '{0}-san'|translate:'app':$user->name}}
  {{$title = "{0}'s Battle Stat (Ranked Battle)"|translate:'app':$name}}
  {{set title="{{$app->name}} | {{$title}}"}}

  {{$this->registerMetaTag(['name' => 'twitter:card', 'content' => 'summary'])|@void}}
  {{$this->registerMetaTag(['name' => 'twitter:title', 'content' => $title])|@void}}
  {{$this->registerMetaTag(['name' => 'twitter:description', 'content' => $title])|@void}}
  {{$this->registerMetaTag(['name' => 'twitter:site', 'content' => '@stat_ink'])|@void}}
  {{if $user->twitter != ''}}
    {{$this->registerMetaTag(['name' => 'twitter:creator', 'content' => '@'|cat:$user->twitter])|@void}}
  {{/if}}

  {{\app\assets\FlotPieAsset::register($this)|@void}}
  <div class="container">
    <h1>
      {{$title|escape}}
    </h1>

    <div id="sns">
      {{\app\assets\TwitterWidgetAsset::register($this)|@void}}
      <a class="twitter-share-button" href="https://twitter.com/intent/tweet" data-count="none"><span class="fa fa-twitter"></span></a>
    </div>

    <div class="row">
      <div class="col-xs-12 col-sm-8 col-md-8 col-lg-9">
        <h2 id="exp">
          {{'Rank'|translate:'app'|escape}}
        </h2>
        <div style="margin-bottom:15px">
          <div class="row">
            <div class="col-xs-4 col-sm-4 col-md-2 col-lg-2">
              <div class="user-label">{{'Current'|translate:'app'|escape}}</div>
              <div class="user-number">
                {{$userRankStat->rank|escape}} {{$userRankStat->rankExp}}
              </div>
            </div>
{{*
            <div class="col-xs-4 col-sm-4 col-md-2 col-lg-2">
              <div class="user-label">{{'Deviation'|translate:'app'|escape}}</div>
              <div class="user-number">
                {{if $userRankStat->deviation !== null}}
                  <span class="auto-tooltip" title="
                        {{'Average'|translate:'app'|escape}}: {{$userRankStat->avgRank|escape}} {{$userRankStat->avgRankExp|escape}} /&#32
                        {{'Standard Deviation'|translate:'app'|escape}}: {{$userRankStat->standardDeviation|string_format:'%.1f'|escape}}
                      ">
                    {{$userRankStat->deviation|string_format:'%.1f'|escape}}
                  </span>
                {{/if}}
              </div>
            </div>
*}}
          </div>
        </div>
        <p>
          {{'Excluded: Private Battles and Squad Battles(when Rank S, S+)'|translate:'app'|escape}}
        </p>
        <script>
          window._rankData = {{$recentRank|json_encode}};
        </script>
        <div id="stat-rank-legend"></div>
        <div class="graph stat-rank"></div>
        <div class="graph stat-rank" data-limit="200"></div>
        <div class="text-right">
          <label>
            <input type="checkbox" id="show-rank-moving-avg" value="1" checked> {{'Show moving averages'|translate:'app'|escape}}
          </label>
        </div>

        <hr>

        <h2 id="wp">
          {{'Winning Percentage'|translate:'app'|escape}}
        </h2>
        <p>
          {{'Excluded: Private Battles'|translate:'app'|escape}}
        </p>
        <script>
          window._wpData = {{$recentWP|json_encode}};
        </script>
        <div id="stat-wp-legend"></div>
        <div class="graph stat-wp"></div>
        <div class="graph stat-wp" data-limit="200"></div>
        <p>
          特定ルールだけの勝率遷移はもう少しまってください。
        </p>
      </div>
      <div class="col-xs-12 col-sm-4 col-md-4 col-lg-3">
        {{include file="@app/views/includes/user-miniinfo.tpl" user=$user}}
        {{include file="@app/views/includes/ad.tpl"}}
      </div>
    </div>
  </div>
{{/strip}}
{{registerCss}}
  .stat-rank{height:300px}
{{/registerCss}}
{{registerJs}}
//<script>
(function($) {
  var $graphs = $('.graph');
  
  function drawRankGraph(json) {
    var $graph_ = $graphs.filter('.stat-rank');

    var rules = (function(json) {
      var ret = {
        area: [],
        yagura: [],
        hoko: []
      };
      var prevIndex = null;
      var prevRule = null;
      var prevValue = null;
      for (var i = 0; i < json.length; ++i) {
        var data = json[i];
        if (prevRule !== data.rule && prevRule !== null) {
          ret[prevRule].push([data.index, null]);
          ret[data.rule].push([prevIndex, prevValue]);
        }
        ret[data.rule].push([data.index, data.exp]);
        prevIndex = data.index;
        prevRule = data.rule;
        prevValue = data.exp;
      }
      return ret;
    })(json);

    var data = [
      {
        label: "{{'Rank'|translate:'app'|escape:'javascript'}} ({{'Splat Zones'|translate:'app-rule'|escape:'javascript'}})",
        data: rules.area,
        color: '#edc240'
      },
      {
        label: "{{'Rank'|translate:'app'|escape:'javascript'}} ({{'Tower Control'|translate:'app-rule'|escape:'javascript'}})",
        data: rules.yagura,
        color: '#40a2ed'
      },
      {
        label: "{{'Rank'|translate:'app'|escape:'javascript'}} ({{'Rainmaker'|translate:'app-rule'|escape:'javascript'}})",
        data: rules.hoko,
        color: '#ed4040'
      }
    ];

    if ($('#show-rank-moving-avg').prop('checked')) {
      data.push({
        label: "{{'Moving Avg. ({0} Battles)'|translate:'app':10|escape}}",
        data: json.map(function(v) {
          return [v.index, v.movingAvg];
        }),
        color: 'rgba(64,237,64,.5)'
      });
      data.push({
        label: "{{'Moving Avg. ({0} Battles)'|translate:'app':50|escape}}",
        data: json.map(function(v) {
          return [v.index, v.movingAvg50];
        }),
        color: 'rgba(148,64,237,.5)'
      });
    }

    $graph_.each(function() {
      var $graph = $(this);
      var limit = ~~$graph.attr('data-limit');
      if (limit > 0 && json.length <= limit) {
        $graph.hide();
        return;
      }

      $.plot($graph, data, {
        xaxis: {
          minTickSize: 1,
          min: limit > 0 ? -limit : null,
          tickFormatter: function (v) {
            return ~~v;
          }
        },
        yaxis: {
          minTickSize: 10,
          tickFormatter: function (v) {
            if (v >= 1100) {
              return v >= 1150 ? '' : 'S+ 99';
            }

            var rank = Math.floor(v / 100);
            var exp = v % 100;
            var ranks = ['C-', 'C', 'C+', 'B-', 'B', 'B+', 'A-', 'A', 'A+', 'S', 'S+'];
            return ranks[rank] + " " + exp;
          }
        },
        legend: {
          container: $('#stat-rank-legend')
        }
      });
    });
  }

  function drawWPGraph(json) {
    var $graph_ = $graphs.filter('.stat-wp');

    var rules = (function(json) {
      var ret = {
        area: [],
        yagura: [],
        hoko: []
      };
      var prevIndex = null;
      var prevRule = null;
      var prevValue = null;
      for (var i = 0; i < json.length; ++i) {
        var data = json[i];
        if (prevRule !== data.rule && prevRule !== null) {
          ret[prevRule].push([data.index, null]);
          ret[data.rule].push([prevIndex, prevValue]);
        }
        ret[data.rule].push([data.index, data.totalWP]);
        prevIndex = data.index;
        prevRule = data.rule;
        prevValue = data.totalWP;
      }
      return ret;
    })(json);

    var data = [
      {
        label: "{{'Winning Percentage'|translate:'app'|escape:'javascript'}} ({{'Splat Zones'|translate:'app-rule'|escape:'javascript'}})",
        data: rules.area,
        color: '#edc240'
      },
      {
        label: "{{'Winning Percentage'|translate:'app'|escape:'javascript'}} ({{'Tower Control'|translate:'app-rule'|escape:'javascript'}})",
        data: rules.yagura,
        color: '#40a2ed'
      },
      {
        label: "{{'Winning Percentage'|translate:'app'|escape:'javascript'}} ({{'Rainmaker'|translate:'app-rule'|escape:'javascript'}})",
        data: rules.hoko,
        color: '#ed4040'
      },
      {
        label: "{{'WP ({0} Battles)'|translate:'app':10|escape}}",
        data: json.map(function(v) {
          return [v.index, v.movingWP];
        }),
        color: 'rgba(64,237,64,.5)'
      },
      {
        label: "{{'WP ({0} Battles)'|translate:'app':50|escape}}",
        data: json.map(function(v) {
          return [v.index, v.movingWP50];
        }),
        color: 'rgba(148,64,237,.5)'
      }
    ];

    $graph_.each(function() {
      var $graph = $(this);
      var limit = ~~$graph.attr('data-limit');
      if (limit > 0 && json.length <= limit) {
        $graph.hide();
        return;
      }

      $.plot($graph, data, {
        xaxis: {
          min: limit > 0 ? -limit : null,
          minTickSize: 1,
          tickFormatter: function (v) {
            return ~~v;
          }
        },
        yaxis: {
          min: 0,
          max: 100,
        },
        legend: {
          container: $('#stat-wp-legend')
        }
      });
    });
  }

  var timerId = null;
  $(window).resize(function() {
    if (timerId !== null) {
      window.clearTimeout(timerId);
    }
    timerId = window.setTimeout(function() {
      $graphs.height($graphs.width() * 9 / 16);
      drawRankGraph(window._rankData);
      drawWPGraph(window._wpData);
    }, 33);
  }).resize();

  $('#show-rank-moving-avg').click(function () {
    $(window).resize();
  });
})(jQuery);
{{/registerJs}}
<commit_msg>fix ガチ統計<commit_after>{{strip}}
  {{set layout="main.tpl"}}

  {{$name = '{0}-san'|translate:'app':$user->name}}
  {{$title = "{0}'s Battle Stat (Ranked Battle)"|translate:'app':$name}}
  {{set title="{{$app->name}} | {{$title}}"}}

  {{$this->registerMetaTag(['name' => 'twitter:card', 'content' => 'summary'])|@void}}
  {{$this->registerMetaTag(['name' => 'twitter:title', 'content' => $title])|@void}}
  {{$this->registerMetaTag(['name' => 'twitter:description', 'content' => $title])|@void}}
  {{$this->registerMetaTag(['name' => 'twitter:site', 'content' => '@stat_ink'])|@void}}
  {{if $user->twitter != ''}}
    {{$this->registerMetaTag(['name' => 'twitter:creator', 'content' => '@'|cat:$user->twitter])|@void}}
  {{/if}}

  {{\app\assets\FlotAsset::register($this)|@void}}
  <div class="container">
    <h1>
      {{$title|escape}}
    </h1>

    <div id="sns">
      {{\app\assets\TwitterWidgetAsset::register($this)|@void}}
      <a class="twitter-share-button" href="https://twitter.com/intent/tweet" data-count="none"><span class="fa fa-twitter"></span></a>
    </div>

    <div class="row">
      <div class="col-xs-12 col-sm-8 col-md-8 col-lg-9">
        <h2 id="exp">
          {{'Rank'|translate:'app'|escape}}
        </h2>
        <div style="margin-bottom:15px">
          <div class="row">
            <div class="col-xs-4 col-sm-4 col-md-2 col-lg-2">
              <div class="user-label">{{'Current'|translate:'app'|escape}}</div>
              <div class="user-number">
                {{$userRankStat->rank|escape}} {{$userRankStat->rankExp}}
              </div>
            </div>
          </div>
        </div>
        <p>
          {{'Excluded: Private Battles and Squad Battles(when Rank S, S+)'|translate:'app'|escape}}
        </p>
        <script>
          window._rankData = {{$recentRank|json_encode}};
        </script>
        <div id="stat-rank-legend"></div>
        <div class="graph stat-rank"></div>
        <div class="graph stat-rank" data-limit="200"></div>
        <div class="text-right">
          <label>
            <input type="checkbox" id="show-rank-moving-avg" value="1" checked> {{'Show moving averages'|translate:'app'|escape}}
          </label>
        </div>

        <hr>

        <h2 id="wp">
          {{'Winning Percentage'|translate:'app'|escape}}
        </h2>
        <p>
          {{'Excluded: Private Battles'|translate:'app'|escape}}
        </p>
        <script>
          window._wpData = {{$recentWP|json_encode}};
        </script>
        <div id="stat-wp-legend"></div>
        <div class="graph stat-wp"></div>
        <div class="graph stat-wp" data-limit="200"></div>
        <p>
          特定ルールだけの勝率遷移はもう少しまってください。
        </p>
      </div>
      <div class="col-xs-12 col-sm-4 col-md-4 col-lg-3">
        {{include file="@app/views/includes/user-miniinfo.tpl" user=$user}}
        {{include file="@app/views/includes/ad.tpl"}}
      </div>
    </div>
  </div>
{{/strip}}
{{registerCss}}
  .stat-rank{height:300px}
{{/registerCss}}
{{registerJs}}
//<script>
(function($) {
  var $graphs = $('.graph');
  
  function drawRankGraph(json) {
    var $graph_ = $graphs.filter('.stat-rank');

    var rules = (function(json) {
      var ret = {
        area: [],
        yagura: [],
        hoko: []
      };
      var prevIndex = null;
      var prevRule = null;
      var prevValue = null;
      for (var i = 0; i < json.length; ++i) {
        var data = json[i];
        if (prevRule !== data.rule && prevRule !== null) {
          ret[prevRule].push([data.index, null]);
          ret[data.rule].push([prevIndex, prevValue]);
        }
        ret[data.rule].push([data.index, data.exp]);
        prevIndex = data.index;
        prevRule = data.rule;
        prevValue = data.exp;
      }
      return ret;
    })(json);

    var data = [
      {
        label: "{{'Rank'|translate:'app'|escape:'javascript'}} ({{'Splat Zones'|translate:'app-rule'|escape:'javascript'}})",
        data: rules.area,
        color: '#edc240'
      },
      {
        label: "{{'Rank'|translate:'app'|escape:'javascript'}} ({{'Tower Control'|translate:'app-rule'|escape:'javascript'}})",
        data: rules.yagura,
        color: '#40a2ed'
      },
      {
        label: "{{'Rank'|translate:'app'|escape:'javascript'}} ({{'Rainmaker'|translate:'app-rule'|escape:'javascript'}})",
        data: rules.hoko,
        color: '#ed4040'
      }
    ];

    if ($('#show-rank-moving-avg').prop('checked')) {
      data.push({
        label: "{{'Moving Avg. ({0} Battles)'|translate:'app':10|escape}}",
        data: json.map(function(v) {
          return [v.index, v.movingAvg];
        }),
        color: 'rgba(64,237,64,.5)'
      });
      data.push({
        label: "{{'Moving Avg. ({0} Battles)'|translate:'app':50|escape}}",
        data: json.map(function(v) {
          return [v.index, v.movingAvg50];
        }),
        color: 'rgba(148,64,237,.5)'
      });
    }

    $graph_.each(function() {
      var $graph = $(this);
      var limit = ~~$graph.attr('data-limit');
      if (limit > 0 && json.length <= limit) {
        $graph.hide();
        return;
      }

      $.plot($graph, data, {
        xaxis: {
          minTickSize: 1,
          min: limit > 0 ? -limit : null,
          tickFormatter: function (v) {
            return ~~v;
          }
        },
        yaxis: {
          minTickSize: 10,
          tickFormatter: function (v) {
            if (v >= 1100) {
              return v >= 1150 ? '' : 'S+ 99';
            }

            var rank = Math.floor(v / 100);
            var exp = v % 100;
            var ranks = ['C-', 'C', 'C+', 'B-', 'B', 'B+', 'A-', 'A', 'A+', 'S', 'S+'];
            return ranks[rank] + " " + exp;
          }
        },
        legend: {
          container: $('#stat-rank-legend')
        }
      });
    });
  }

  function drawWPGraph(json) {
    var $graph_ = $graphs.filter('.stat-wp');

    var rules = (function(json) {
      var ret = {
        area: [],
        yagura: [],
        hoko: []
      };
      var prevIndex = null;
      var prevRule = null;
      var prevValue = null;
      for (var i = 0; i < json.length; ++i) {
        var data = json[i];
        if (prevRule !== data.rule && prevRule !== null) {
          ret[prevRule].push([data.index, null]);
          ret[data.rule].push([prevIndex, prevValue]);
        }
        ret[data.rule].push([data.index, data.totalWP]);
        prevIndex = data.index;
        prevRule = data.rule;
        prevValue = data.totalWP;
      }
      return ret;
    })(json);

    var data = [
      {
        label: "{{'Winning Percentage'|translate:'app'|escape:'javascript'}} ({{'Splat Zones'|translate:'app-rule'|escape:'javascript'}})",
        data: rules.area,
        color: '#edc240'
      },
      {
        label: "{{'Winning Percentage'|translate:'app'|escape:'javascript'}} ({{'Tower Control'|translate:'app-rule'|escape:'javascript'}})",
        data: rules.yagura,
        color: '#40a2ed'
      },
      {
        label: "{{'Winning Percentage'|translate:'app'|escape:'javascript'}} ({{'Rainmaker'|translate:'app-rule'|escape:'javascript'}})",
        data: rules.hoko,
        color: '#ed4040'
      },
      {
        label: "{{'WP ({0} Battles)'|translate:'app':20|escape}}",
        data: json.map(function(v) {
          return [v.index, v.movingWP];
        }),
        color: 'rgba(64,237,64,.5)'
      },
      {
        label: "{{'WP ({0} Battles)'|translate:'app':50|escape}}",
        data: json.map(function(v) {
          return [v.index, v.movingWP50];
        }),
        color: 'rgba(148,64,237,.5)'
      }
    ];

    $graph_.each(function() {
      var $graph = $(this);
      var limit = ~~$graph.attr('data-limit');
      if (limit > 0 && json.length <= limit) {
        $graph.hide();
        return;
      }

      $.plot($graph, data, {
        xaxis: {
          min: limit > 0 ? -limit : null,
          minTickSize: 1,
          tickFormatter: function (v) {
            return ~~v;
          }
        },
        yaxis: {
          min: 0,
          max: 100,
        },
        legend: {
          container: $('#stat-wp-legend')
        }
      });
    });
  }

  var timerId = null;
  $(window).resize(function() {
    if (timerId !== null) {
      window.clearTimeout(timerId);
    }
    timerId = window.setTimeout(function() {
      $graphs.height($graphs.width() * 9 / 16);
      drawRankGraph(window._rankData);
      drawWPGraph(window._wpData);
    }, 33);
  }).resize();

  $('#show-rank-moving-avg').click(function () {
    $(window).resize();
  });
})(jQuery);
{{/registerJs}}

{'fraction_non_alphanumeric': 0.20727777777777778, 'fraction_numerical': 0.01588888888888889, 'mean_word_length': 2.0956147893379193, 'pattern_counts': {'":': 0, '<': 137, '<?xml version=': 0, '>': 188, 'https://': 2, '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': '2862171', 'n_tokens_mistral': 6253, 'n_tokens_neox': 5975, 'n_words': 1040}