<commit_before>import React from 'react';

const StatisticsUpdateModal = (props) => {
    const helpMessage = Features.wikiEd ? I18n.t('metrics.wiki_ed_help') : I18n.t('metrics.outreach_help');

    let errorMessage = '';
    const errorCount = props.course.updates.last_update.error_count;
    if (errorCount && errorCount > 0) {
      errorMessage = `${I18n.t('metrics.error_count_message', { error_count: errorCount })}`;
    } else if (props.course.updates.last_update.orphan_lock_failure) {
      errorMessage = `${I18n.t('metrics.last_update_failed')}`;
    }

    // Update numbers (ids) are stored incrementally as counts in update_logs, so the
    // last update number is the total number of updates till now
    const updateNumbers = Object.keys(props.course.flags.update_logs);
    const totalUpdatesMessage = `${I18n.t('metrics.total_updates')}: ${updateNumbers[updateNumbers.length - 1]}`;

    const updateTimesInformation = props.getUpdateTimesInformation();

    return (
      <div className="statistics-update-modal-container">
        <div className="statistics-update-modal">
          <b>{I18n.t('metrics.update_status_heading')}</b>
          <br/>
          { errorMessage }
          <ul>
            <li>{ totalUpdatesMessage }</li>
            { updateTimesInformation !== null && <li>{updateTimesInformation[1]}</li> }
          </ul>
          <b>{I18n.t('metrics.missing_data_heading')}</b>
          <br/>
          { I18n.t('metrics.missing_data_info') }:
          <ul>
            <li>{ I18n.t('metrics.replag_info') }<a href="https://replag.toolforge.org/" target="_blank">{I18n.t('metrics.replag_link')}</a></li>
            { props.course.type === 'ArticleScopedProgram' && <li>{ I18n.t('metrics.article_scoped_program_info') }</li> }
          </ul>
          <small>{ helpMessage }</small>
          <br/>
          <button className="button dark" onClick={props.toggleModal}>{I18n.t('metrics.close_modal')}</button>
        </div>
      </div>
    );
};

export default StatisticsUpdateModal;
<commit_msg>Added more course update information.<commit_after>import React from 'react';

const StatisticsUpdateModal = (props) => {
    const helpMessage = Features.wikiEd ? I18n.t('metrics.wiki_ed_help') : I18n.t('metrics.outreach_help');

    let lastUpdateSummary = '';
    const errorCount = props.course.updates.last_update.error_count;

    if (errorCount === 0) {
      lastUpdateSummary = `${I18n.t('metrics.last_update_success')}`;
    } else if (errorCount > 0) {
      lastUpdateSummary = `${I18n.t('metrics.error_count_message', { error_count: errorCount })}`;
    } else if (props.course.updates.last_update.orphan_lock_failure) {
      lastUpdateSummary = `${I18n.t('metrics.last_update_failed')}`;
    }

    const updateLogs = Object.values(props.course.flags.update_logs);
    const failureUpdatesCount = updateLogs.filter(log => log.orphan_lock_failure !== undefined).length;
    const erroredUpdatesCount = updateLogs.filter(log => log.error_count !== undefined && log.error_count > 0).length;
    const recentUpdatesSummary = I18n.t('metrics.recent_updates_summary', { total: updateLogs.length, failure_count: failureUpdatesCount, error_count: erroredUpdatesCount });

    // Update numbers (ids) are stored incrementally as counts in update_logs, so the
    // last update number is the total number of updates till now
    const updateNumbers = Object.keys(props.course.flags.update_logs);
    const totalUpdatesMessage = `${I18n.t('metrics.total_updates')}: ${updateNumbers[updateNumbers.length - 1]}`;

    const updateTimesInformation = props.getUpdateTimesInformation();

    return (
      <div className="statistics-update-modal-container">
        <div className="statistics-update-modal">
          <b>{I18n.t('metrics.update_status_heading')}</b>
          <br/>
          { lastUpdateSummary }
          <ul>
            <li>{ recentUpdatesSummary }</li>
            <li>{ totalUpdatesMessage }</li>
            { updateTimesInformation !== null && <li>{updateTimesInformation[1]}</li> }
          </ul>
          <b>{I18n.t('metrics.missing_data_heading')}</b>
          <br/>
          { I18n.t('metrics.missing_data_info') }:
          <ul>
            <li>{ I18n.t('metrics.replag_info') }<a href="https://replag.toolforge.org/" target="_blank">{I18n.t('metrics.replag_link')}</a></li>
            { props.course.type === 'ArticleScopedProgram' && <li>{ I18n.t('metrics.article_scoped_program_info') }</li> }
          </ul>
          <small>{ helpMessage }</small>
          <br/>
          <button className="button dark" onClick={props.toggleModal}>{I18n.t('metrics.close_modal')}</button>
        </div>
      </div>
    );
};

export default StatisticsUpdateModal;

{'fraction_non_alphanumeric': 0.15165576882514237, 'fraction_numerical': 0.012655557899177388, 'mean_word_length': 3.295289855072464, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 70, 'https://': 2, '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': '2405657', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1469, 'n_words': 252}