Skip to content
Snippets Groups Projects
Commit 97170ab8 authored by Kevin Rice's avatar Kevin Rice
Browse files

fixes issues with medium size data set speed

parent 696f85dc
No related branches found
Tags 4.0.0-beta4
No related merge requests found
......@@ -127,3 +127,25 @@ function simple_survey_update_9009() {
$manager->installFieldStorageDefinition('submit_button_value', 'survey_question', 'survey_question', $field_storage_definition);
}
/**
* Updates parent uuid field storage definition.
*/
function simple_survey_update_10001() {
$manager = \Drupal::entityDefinitionUpdateManager();
if ($field = $manager->getFieldStorageDefinition('parent_uuid', 'survey_answer')) {
$manager->updateFieldStorageDefinition($field);
}
}
/**
* Updates question idA field storage definition.
*/
function simple_survey_update_10002() {
$manager = \Drupal::entityDefinitionUpdateManager();
if ($field = $manager->getFieldStorageDefinition('question_id', 'survey_answer')) {
$manager->updateFieldStorageDefinition($field);
}
}
\ No newline at end of file
......@@ -120,10 +120,27 @@ class ExportForm extends EntityForm {
];
if ($form_state->getValue('export_type') == 'csv') {
$batch = $this->createCsvBatch($options);
$batch = $this->createCsvBatch($options);
}
else {
$batch = $this->createBqBatch($options);
/** @var \Drupal\Core\Database\Connection $db */
$db = \Drupal::service('database');
$num_responses = (int) $db->select('survey_response', 'sr')
->condition('sr.survey', $options['survey'])
->condition('sr.sent_to_bq', $options['sent_to_bq'])
->condition('sr.created', strtotime($options['start_date']), '>=')
->condition('sr.created', strtotime($options['end_date']), '<=')
->countQuery()->execute()->fetchField();
if ($num_responses === 0 && $options['sent_to_bq'] === 0) {
$this->messenger()->addWarning('All responses for this date range have been sent. If you want to send them again please select "Export responses that have already been sent to BigQuery".');
return FALSE;
}
else {
$batch = $this->createBqBatch($options);
}
}
batch_set($batch);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment