Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simple_survey
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
simple_survey
Commits
97170ab8
Commit
97170ab8
authored
1 year ago
by
Kevin Rice
Browse files
Options
Downloads
Patches
Plain Diff
fixes issues with medium size data set speed
parent
696f85dc
No related branches found
Branches containing commit
Tags
4.0.0-beta4
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
simple_survey.install
+22
-0
22 additions, 0 deletions
simple_survey.install
src/Form/ExportForm.php
+19
-2
19 additions, 2 deletions
src/Form/ExportForm.php
with
41 additions
and
2 deletions
simple_survey.install
+
22
−
0
View file @
97170ab8
...
...
@@ -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
This diff is collapsed.
Click to expand it.
src/Form/ExportForm.php
+
19
−
2
View file @
97170ab8
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment