<commit_before>{% extends "base.html" %}
{% set active_page = "stats" %}
{% set page_title = 'User Stats - Mining and account information for user ' +  username %}
{% block body %}

<script>
$(document).ready(function() {

  {# Initial graph generation #}
  generate_graph('hour', '%H:%M %p', '{{ username }}' );

  {# Generate user stats #}
  setTimeout(function(){
    var hashrate, seconds, mhashpersec, user_shares, est_payout,
        round_reward, shares_to_solve, percentage_value, dogerate, day_shares;

    round_reward = {{ config['reward'] }};
    user_shares = {{ round_shares or 'NaN' }};
    last_10_shares = {{ last_10_shares }};

    {# Calculate est round payout  #}
    shares_to_solve = {{ g.current_difficulty }} * Math.pow(2, 16);
    shares_to_solve = shares_to_solve * 2;
    percentage_value = user_shares / shares_to_solve;
    est_payout = ((percentage_value * round_reward)) * .99;

    {# Calculate mhashes/sec  #}
    seconds = 60000;
    hashrate = Math.pow(2, 16) * last_10_shares;

    {# Calculate est doge per day  #}
    day_shares = (last_10_shares * 60 * 24);
    percentage_value = day_shares / (shares_to_solve/2);
    dogerate = ((percentage_value * round_reward)) * .99;

    mhashpersec = (hashrate / seconds) / 1000;
    setInterval(set_content = function(){
      $('.odometer.hashrate').text(numberWithCommas(Math.round(mhashpersec * 1000) / 1000));
      $('.odometer.usershares').text(numberWithCommas(Math.round(user_shares)));
      $('.odometer.estpayout').text(numberWithCommas(Math.round(est_payout * 1000) / 1000));
      $('.odometer.dogerate').text(numberWithCommas(Math.round(dogerate * 1000) / 1000));
    },1000);

    set_content();
<commit_msg>Pass in hashrate directly<commit_after>{% extends "base.html" %}
{% set active_page = "stats" %}
{% set page_title = 'User Stats - Mining and account information for user ' +  username %}
{% block body %}

<script>
$(document).ready(function() {

  {# Initial graph generation #}
  generate_graph('hour', '%H:%M %p', '{{ username }}' );

  {# Generate user stats #}
  setTimeout(function(){
    var hashrate, seconds, mhashpersec, user_shares, est_payout,
        round_reward, shares_to_solve, percentage_value, dogerate, day_shares;

    round_reward = {{ config['reward'] }};
    user_shares = {{ round_shares or 'NaN' }};
    last_10_shares = {{ last_10_shares }};

    {# Calculate est round payout  #}
    shares_to_solve = {{ g.current_difficulty }} * Math.pow(2, 16);
    shares_to_solve = shares_to_solve * 2;
    percentage_value = user_shares / shares_to_solve;
    est_payout = ((percentage_value * round_reward)) * .99;

    {# Calculate mhashes/sec  #}
    mhashpersec = {{ last_10_hashrate }};

    {# Calculate est doge per day  #}
    day_shares = (last_10_shares * 60 * 24);
    percentage_value = day_shares / (shares_to_solve/2);
    dogerate = ((percentage_value * round_reward)) * .99;

    setInterval(set_content = function(){
      $('.odometer.hashrate').text(numberWithCommas(Math.round(mhashpersec * 1000) / 1000));
      $('.odometer.usershares').text(numberWithCommas(Math.round(user_shares)));
      $('.odometer.estpayout').text(numberWithCommas(Math.round(est_payout * 1000) / 1000));
      $('.odometer.dogerate').text(numberWithCommas(Math.round(dogerate * 1000) / 1000));
    },1000);

    set_content();

{'fraction_non_alphanumeric': 0.15455904334828102, 'fraction_numerical': 0.03288490284005979, 'mean_word_length': 3.994029850746269, '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': '782817', 'n_tokens_mistral': 1285, 'n_tokens_neox': 1150, 'n_words': 217}