<commit_before># Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
# See the LICENCE file in the repository root for full licence text.

import * as React from 'react'
import { div, span } from 'react-dom-factories'
import { formatNumber } from 'utils/html'

bn = 'beatmap-basic-stats'

# value is in second
formatDuration = (value) ->
  s = value % 60
  m = Math.floor(value / 60) % 60
  h = Math.floor(value / 3600)

  if h > 0
    "#{h}:#{_.padStart m, 2, 0}:#{_.padStart s, 2, 0}"
  else
    "#{m}:#{_.padStart s, 2, 0}"


export BeatmapBasicStats = ({beatmap, beatmapset}) ->
  div
    className: bn
    for stat in ['total_length', 'bpm', 'count_circles', 'count_sliders']
      value = beatmap[stat]

      value =
        if stat == 'bpm'
          if value > 1000 then '∞' else formatNumber(value)
        else if stat == 'total_length'
          formatDuration value
        else
          formatNumber(value)

      title =
        osu.trans "beatmapsets.show.stats.#{stat}",
          if stat == 'total_length'
            hit_length: formatDuration(beatmap.hit_length)

      if stat == 'bpm' && beatmapset.offset != 0
        title += " (#{osu.trans 'beatmapsets.show.stats.offset', offset: osu.formatNumber(beatmapset.offset)})"

      div
        className: "#{bn}__entry"
        key: stat
        title: title
        div
          className: "#{bn}__entry-icon"
          style:
            backgroundImage: "url(/images/layout/beatmapset-page/#{stat}.svg)"
        span null, value
<commit_msg>Update another place using formatNumber<commit_after># Copyright (c) ppy Pty Ltd <<EMAIL>>. Licensed under the GNU Affero General Public License v3.0.
# See the LICENCE file in the repository root for full licence text.

import * as React from 'react'
import { div, span } from 'react-dom-factories'
import { formatNumber } from 'utils/html'

bn = 'beatmap-basic-stats'

# value is in second
formatDuration = (value) ->
  s = value % 60
  m = Math.floor(value / 60) % 60
  h = Math.floor(value / 3600)

  if h > 0
    "#{h}:#{_.padStart m, 2, 0}:#{_.padStart s, 2, 0}"
  else
    "#{m}:#{_.padStart s, 2, 0}"


export BeatmapBasicStats = ({beatmap, beatmapset}) ->
  div
    className: bn
    for stat in ['total_length', 'bpm', 'count_circles', 'count_sliders']
      value = beatmap[stat]

      value =
        if stat == 'bpm'
          if value > 1000 then '∞' else formatNumber(value)
        else if stat == 'total_length'
          formatDuration value
        else
          formatNumber(value)

      title =
        osu.trans "beatmapsets.show.stats.#{stat}",
          if stat == 'total_length'
            hit_length: formatDuration(beatmap.hit_length)

      if stat == 'bpm' && beatmapset.offset != 0
        title += " (#{osu.trans 'beatmapsets.show.stats.offset', offset: formatNumber(beatmapset.offset)})"

      div
        className: "#{bn}__entry"
        key: stat
        title: title
        div
          className: "#{bn}__entry-icon"
          style:
            backgroundImage: "url(/images/layout/beatmapset-page/#{stat}.svg)"
        span null, value

{'fraction_non_alphanumeric': 0.13208147676639084, 'fraction_numerical': 0.015276893698281349, 'mean_word_length': 2.5156599552572705, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '3106293', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1008, 'n_words': 292}