<commit_before><script src='http://code.highcharts.com/highcharts.js' type='text/javascript'> </script>
<div class="stripe">
	<div class="page-name">
		<h1>Reports</h1>
    	<!-- Data source select form prototype, data should be retrieved from MySQL 
    	     This form submits selected value to the current page -->
			<form method="POST" action=""> 
				<?php 
					if($currentSurvey) { 
						echo '<p class="intro-text">Choose data source to view statistical report.</p>';
						echo CHtml::activeDropDownList(new Survey(), 'id', $survey_list_data, 
						array(
							'onChange' => "this.form.submit()", 
							'options'=> array( 
								$currentSurvey->id => array('selected'=>true)
							)
						)); 
					} else {
						echo '<p class="intro-text">To get started, please create a new survey.</p></br>';
					}
				?>
			</form>
	</div>
</div>
<div class="content-width">
	<br>
            
 <?php
 //output report
    if ($currentSurvey) {
        if ($currentSurvey->questions == null) {
            echo '<h2>Add some new questions for "' . $currentSurvey->title . '" first.</h2></br>';
        } else {
            echo CHtml::link('Download CSV', array('survey/export/id/' . $currentSurvey->id), array('class' => 'button'));
        }

        foreach ($currentSurvey->questions as $question) {
            
            //show charts for all non-short answer questions
            if ($question->type != 0) {
                
                $chartArray = array();
                $answerArray = array();
                $responseCount = 0;

                foreach ($question->answers as $answer) {
                    $chartArray[] = array($answer->text, count($answer->responses));
                    $answerArray[] = array($answer->text);
                    $responseCount += count($answer->responses);
                }

                if ($responseCount == 0) {<commit_msg>Added link to switch chart types in the reports page<commit_after><script src='http://code.highcharts.com/highcharts.js' type='text/javascript'> </script>
<div class="stripe">
	<div class="page-name">
		<h1>Reports</h1>
    	<!-- Data source select form prototype, data should be retrieved from MySQL 
    	     This form submits selected value to the current page -->
			<form method="POST" action=""> 
				<?php 
					if($currentSurvey) { 
						echo '<p class="intro-text">Choose data source to view statistical report.</p>';
						echo CHtml::activeDropDownList(new Survey(), 'id', $survey_list_data, 
						array(
							'onChange' => "this.form.submit()", 
							'options'=> array( 
								$currentSurvey->id => array('selected'=>true)
							)
						)); 
					} else {
						echo '<p class="intro-text">To get started, please create a new survey.</p></br>';
					}
				?>
			</form>
	</div>
</div>
<div class="content-width">
	<br>
            
 <?php
 //output report
    if ($currentSurvey) {
        if ($currentSurvey->questions == null) {
            echo '<h2>Add some new questions for "' . $currentSurvey->title . '" first.</h2></br>';
        } else {
            echo CHtml::link('Download CSV', array('survey/export/id/' . $currentSurvey->id), array('class' => 'button'));
        }

        echo CHtml::link('Pie Charts', array('site/reports'), array('class' => 'button'));
        
        foreach ($currentSurvey->questions as $question) {
            
            //show charts for all non-short answer questions
            if ($question->type != 0) {
                
                $chartArray = array();
                $answerArray = array();
                $responseCount = 0;

                foreach ($question->answers as $answer) {
                    $chartArray[] = array($answer->text, count($answer->responses));
                    $answerArray[] = array($answer->text);
                    $responseCount += count($answer->responses);
                }

                if ($responseCount == 0) {
{'fraction_non_alphanumeric': 0.15951231902463806, 'fraction_numerical': 0.003556007112014224, 'mean_word_length': 2.0837901331245106, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 80, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6718248', 'n_tokens_mistral': 1288, 'n_tokens_neox': 1084, 'n_words': 275}