<commit_before>import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { updateCharts } from '../helpers/commonDispatchers';
import { deleteChart } from '../helpers/backendInterface';
import PrintChart from './PrintChart';
import { log, LOW } from '../helpers/log';

const deletePoll = token => id => () => {
  deleteChart(token, id)
  .then(function(data){
    log(data, LOW);
  })
  .catch(function(err){
    log('failed', LOW);
    log(err, LOW);
  });
};

function ViewPollsPage({ charts, token, updateAllCharts }) {
  charts.length || updateAllCharts(token);
  return (
    <div>
      <h1>Your Polls</h1>
      {charts.map( (x, i)=> {
        return (
          <PrintChart
            key={i}
            pollId={x.id}
            title={x.title}
            desc={x.description}
            delete={deletePoll(token)}
          />
        );
      })}
    </div>
  );
}
ViewPollsPage.propTypes = {
  charts: PropTypes.array,<commit_msg>Now updates chart after delete<commit_after>import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { updateCharts } from '../helpers/commonDispatchers';
import { deleteChart } from '../helpers/backendInterface';
import PrintChart from './PrintChart';
import { log, LOW } from '../helpers/log';

const deletePoll = (token, updateCharts) => id => () => {
  deleteChart(token, id)
  .then(function(data){
    updateCharts(token);
  })
  .catch(function(err){
    log('failed', LOW);
    log(err, LOW);
  });
};

function ViewPollsPage({ charts, token, updateAllCharts }) {
  charts.length || updateAllCharts(token);
  return (
    <div>
      <h1>Your Polls</h1>
      {charts.map( (x, i)=> {
        return (
          <PrintChart
            key={i}
            pollId={x.id}
            title={x.title}
            desc={x.description}
            delete={deletePoll(token, updateAllCharts)}
          />
        );
      })}
    </div>
  );
}
ViewPollsPage.propTypes = {
  charts: PropTypes.array,
{'fraction_non_alphanumeric': 0.1639262580966617, 'fraction_numerical': 0.001993024414549078, 'mean_word_length': 2.585714285714286, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, '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': '3605457', 'n_tokens_mistral': 645, 'n_tokens_neox': 652, 'n_words': 134}