<commit_before>R = require 'ramda'
React = require 'react'
Slider = require '../components/bootstrap_slider'

getUniqueTimes =  (notifications) ->
  R.compose(R.uniq, R.map(R.get('time')), R.flatten, R.values)(notifications)

TimeSlider = React.createClass(

  handleSliderChange: (sliderValue) ->
    @props.handleChange(sliderValue)

  getMinAndMax: (times) ->
    min = switch tryMin = R.min(times)
      when Infinity then 0
      else tryMin
    max = switch tryMax = R.max(times)
      when -Infinity then 1000
      else tryMax
    [min, max]

  render: ->
    [min, max] = @getMinAndMax(getUniqueTimes(@props.notifications))

    <Slider id="time_slider"
      min={Math.round(min * 0.1)}
      max={Math.round(max * 1.1)}
      step=1
      value={@props.value}
      style={width: "100%"}<commit_msg>Improve slider max value<commit_after>R = require 'ramda'
React = require 'react'
Slider = require '../components/bootstrap_slider'

getUniqueTimes =  (notifications) ->
  R.compose(R.uniq, R.map(R.get('time')), R.flatten, R.values)(notifications)

TimeSlider = React.createClass(

  handleSliderChange: (sliderValue) ->
    @props.handleChange(sliderValue)

  getMinAndMax: (times) ->
    min = switch tryMin = R.min(times)
      when Infinity then 0
      else tryMin
    max = switch tryMax = R.max(times)
      when -Infinity then 1000
      else tryMax
    [min, max]

  render: ->
    [min, max] = @getMinAndMax(getUniqueTimes(@props.notifications))

    <Slider id="time_slider"
      min={Math.round(min * 0.1)}
      max={Math.round(max * 1.00)}
      step=1
      value={@props.value}
      style={width: "100%"}
{'fraction_non_alphanumeric': 0.14460784313725492, 'fraction_numerical': 0.016544117647058824, 'mean_word_length': 3.2305699481865284, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3222670', 'n_tokens_mistral': 580, 'n_tokens_neox': 558, 'n_words': 118}