<commit_before>import React from 'react';
import {
  map,
  orderBy
} from 'lodash';
import {
  withProps
} from 'recompose';
import ProvinceTableRow from './province-table-row';
import ProvinceTableColumnHeader from './province-table-column-header';
import {
  ADMIN_MAP
} from '../constants';


const ProvinceTable = ({
  provinces, fieldIdCount, VProMMsCount, language,
  sortField, sortOrder, sortHandler
}) => (
  <div className='table'>
    <table>
      <thead>
        <tr>
          {
            [['name', 'Province'], ['field', 'Field'], ['total', 'Total'], ['percentageComplete', 'Progress']]
              .map(([columnKey, columnLabel]) => (
                <ProvinceTableColumnHeader
                  key={columnLabel}
                  columnKey={columnKey}
                  label={columnLabel}
                  sortField={sortField}
                  sortOrder={sortOrder}
                  sortLinkHandler={sortHandler}
                />
              ))
          }
        </tr>
      </thead>
      <tbody>
        {map(
          orderBy(provinces, [sortField], [sortOrder]),
          ({ id, name, routeId, field, total }) => (
            <ProvinceTableRow
              key={id}
              id={id}
              name={name}
              routeId={routeId}
              field={field}
              total={total}
              language={language}
            />
          )
        )}
      </tbody>
    </table>
  </div>
);


export default withProps(
  ({ provinces, fieldIdCount, VProMMsCount }) => ({
    provinces: map(provinces, (province) => {
      const id = ADMIN_MAP.province[province.id].id;

      const field = fieldIdCount
        .filter(province => province.admin === id)
        .map(province => province.total_roads)[0] || 0;
      const total = VProMMsCount
        .filter(province => province.admin === id)
        .map(province => province.total_roads)[0] || 0;

      return {
        name: ADMIN_MAP.province[province.id].name,
        id,
        routeId: province.id,
        field,
        total
      };
    })
  })
)(ProvinceTable);
<commit_msg>correctly sort province table total column<commit_after>import React from 'react';
import {
  map,
  orderBy
} from 'lodash';
import {
  withProps
} from 'recompose';
import ProvinceTableRow from './province-table-row';
import ProvinceTableColumnHeader from './province-table-column-header';
import {
  ADMIN_MAP
} from '../constants';


const ProvinceTable = ({
  provinces, fieldIdCount, VProMMsCount, language,
  sortField, sortOrder, sortHandler
}) => (
  <div className='table'>
    <table>
      <thead>
        <tr>
          {
            [['name', 'Province'], ['field', 'Field'], ['total', 'Total'], ['percentageComplete', 'Progress']]
              .map(([columnKey, columnLabel]) => (
                <ProvinceTableColumnHeader
                  key={columnLabel}
                  columnKey={columnKey}
                  label={columnLabel}
                  sortField={sortField}
                  sortOrder={sortOrder}
                  sortLinkHandler={sortHandler}
                />
              ))
          }
        </tr>
      </thead>
      <tbody>
        {map(
          orderBy(provinces, [sortField], [sortOrder]),
          ({ id, name, routeId, field, total }) => (
            <ProvinceTableRow
              key={id}
              id={id}
              name={name}
              routeId={routeId}
              field={field}
              total={total}
              language={language}
            />
          )
        )}
      </tbody>
    </table>
  </div>
);


export default withProps(
  ({ provinces, fieldIdCount, VProMMsCount }) => ({
    provinces: map(provinces, (province) => {
      const id = ADMIN_MAP.province[province.id].id;

      const field = fieldIdCount
        .filter(province => province.admin === id)
        .map(province => province.total_roads)[0] || 0;
      const total = VProMMsCount
        .filter(province => province.admin === id)
        .map(province => parseInt(province.total_roads, 10))[0] || 0;

      return {
        name: ADMIN_MAP.province[province.id].name,
        id,
        routeId: province.id,
        field,
        total
      };
    })
  })
)(ProvinceTable);

{'fraction_non_alphanumeric': 0.13795534665099882, 'fraction_numerical': 0.0023501762632197414, 'mean_word_length': 1.8204108681245859, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 45, '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': '5823115', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1219, 'n_words': 242}