<commit_before>import React, { Component, PropTypes } from "react";

import { formatScalar } from "metabase/lib/formatting";

export default class Scalar extends Component {
    static displayName = "Number";
    static identifier = "scalar";
    static iconName = "number";

    static isSensible(cols, rows) {
        return rows.length === 1 && cols.length === 1;
    }

    static checkRenderable(cols, rows) {
        // scalar can always be rendered, nothing needed here
    }

    render() {
        let { data, isDashboard } = this.props;
        let formattedScalarValue = formatScalar(data && data.rows && data.rows[0] && data.rows[0][0] || "");

        if (isDashboard) {
            return (
                <div className={"Card--scalar " + this.props.className}>
                    <h1 className="Card-scalarValue text-normal">{formattedScalarValue}</h1>
                </div>
            );
        } else {<commit_msg>render scalar values when they are 0.<commit_after>import React, { Component, PropTypes } from "react";

import { formatScalar } from "metabase/lib/formatting";

export default class Scalar extends Component {
    static displayName = "Number";
    static identifier = "scalar";
    static iconName = "number";

    static isSensible(cols, rows) {
        return rows.length === 1 && cols.length === 1;
    }

    static checkRenderable(cols, rows) {
        // scalar can always be rendered, nothing needed here
    }

    render() {
        let { data, isDashboard } = this.props;
        let formattedScalarValue = (data && data.rows && data.rows[0] && data.rows[0].length > 0) ? formatScalar(data.rows[0][0]) : "";

        if (isDashboard) {
            return (
                <div className={"Card--scalar " + this.props.className}>
                    <h1 className="Card-scalarValue text-normal">{formattedScalarValue}</h1>
                </div>
            );
        } else {
{'fraction_non_alphanumeric': 0.12987012987012986, 'fraction_numerical': 0.008831168831168832, 'mean_word_length': 2.3789473684210525, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, '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': '7471827', 'n_tokens_mistral': 547, 'n_tokens_neox': 529, 'n_words': 140}