<commit_before>import FilterBox from "./box";
import TenderPrice from "../../filters/tender-price";
import AwardValue from "../../filters/award-value";

class ValueAmount extends FilterBox{
  getTitle(){
    return 'Value amount';
  }

  renderChild(slug, Component){
    const {state, onUpdate, translations} = this.props;
    const minValue = state.get('min'+slug);
    const maxValue = state.get('max'+slug);
    return (
			<Component
			translations={translations}
			minValue={minValue}
			maxValue={maxValue}
			onUpdate={({min, max}, {min: minPossibleValue, max: maxPossibleValue}) => {
				if(minValue != min){
					onUpdate("min"+slug, min == minPossibleValue ? "" : min)
				}
				if(maxValue != max){
					onUpdate("max"+slug, max == maxPossibleValue ? "" : max)
				}
			}}
			/>
		)
  }

  getBox(){
    return (
      <div className="box-content">
        {this.renderChild("TenderValue", TenderPrice)}
        {this.renderChild("AwardValue", AwardValue)}
      </div>
    )
  }
}

export default ValueAmount;<commit_msg>OCE-249 Range filters fixes<commit_after>import FilterBox from "./box";
import TenderPrice from "../../filters/tender-price";
import AwardValue from "../../filters/award-value";

class ValueAmount extends FilterBox {
  getTitle() {
    return 'Value amount';
  }

  update(slug, {min, max}, {min: minPossibleValue, max: maxPossibleValue}) {
    const {state, onUpdate} = this.props;
    const minValue = state.get('min' + slug, minPossibleValue);
    const maxValue = state.get('max' + slug, maxPossibleValue);
    if(minValue != min) {
      onUpdate("min" + slug, min == minPossibleValue ? "" : min)
    }
    if(maxValue != max) {
      onUpdate("max" + slug, max == maxPossibleValue ? "" : max)
    }
  }

  renderChild(slug, Component) {
    const {state, translations} = this.props;
    const minValue = state.get('min' + slug);
    const maxValue = state.get('max' + slug);
    return (
        <Component
            translations={translations}
            minValue={minValue}
            maxValue={maxValue}
            onUpdate={this.update.bind(this, slug)}
        />
    )
  }

  getBox() {
    return (
        <div className="box-content">
          {this.renderChild("TenderValue", TenderPrice)}
          {this.renderChild("AwardValue", AwardValue)}
        </div>
    )
  }
}

export default ValueAmount;
{'fraction_non_alphanumeric': 0.15351993214588636, 'fraction_numerical': 0.001272264631043257, 'mean_word_length': 2.9448160535117056, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, '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': '1453152', 'n_tokens_mistral': 792, 'n_tokens_neox': 739, 'n_words': 158}