Skip to content
Snippets Groups Projects
Commit 721ea438 authored by Boris Doesborg's avatar Boris Doesborg
Browse files

Issue #3458114 by ankitv18, batigolix: Make code pass the gitlab pipeline

parent 24d6a9ad
Branches
Tags
1 merge request!10Trigger Build
Pipeline #252923 passed
......@@ -23,7 +23,8 @@ include:
# https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.variables.yml
# Uncomment the lines below if you want to override any of the variables. The following is just an example.
################
# variables:
# SKIP_ESLINT: '1'
# OPT_IN_TEST_NEXT_MAJOR: '1'
# _CURL_TEMPLATES_REF: 'main'
variables:
SKIP_ESLINT: 1
OPT_IN_TEST_PREVIOUS_MINOR: 1
OPT_IN_TEST_NEXT_MINOR: 1
_CSPELL_WORDS: 'BARAN, corechart, gchart, lbaran, webformcharts, Webforms'
/* Analysis pages */
.webform-analysis-component {
display: inline-block;
width: 33.33%;
margin: 0 -2px;
padding: 0;
display: inline-block;
vertical-align: top;
}
@media all and (max-width: 1024px) {
......@@ -17,12 +17,12 @@
}
}
.webform-analysis-component-grid {
width: 100%;
clear: both;
width: 100%;
}
.webform-analysis-component-inner {
padding: 12px;
overflow: auto;
padding: 12px;
}
.webform-analysis-component table {
width: 100%;
......
(function ($, Drupal, settings) {
'use strict';
/**
* Webform Analaysis - Charts.
* Webform Analysis - Charts.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.WebformAnalysisCharts = {
attach: function (context, settings) {
if(!(context instanceof HTMLDocument)){
return;
attach(context, settings) {
if (!(context instanceof HTMLDocument)) {
return;
}
var webformcharts = settings.webformcharts;
const webformcharts = settings.webformcharts;
if(webformcharts === undefined) {
if (webformcharts === undefined) {
return;
}
google.charts.load('current', {packages: webformcharts.packages});
google.charts.load('current', { packages: webformcharts.packages });
google.charts.setOnLoadCallback(function () {
var charts = $.map(webformcharts.charts, function (value, index) {
const charts = $.map(webformcharts.charts, function (value, index) {
return [value];
});
charts.forEach(function (chart) {
var data = new google.visualization.arrayToDataTable(chart.data);
var options = chart.options;
var gchart = new google.visualization[chart.type](document.querySelector(chart.selector));
const data = new google.visualization.arrayToDataTable(chart.data);
const options = chart.options;
const gchart = new google.visualization[chart.type](
document.querySelector(chart.selector),
);
gchart.draw(data, options);
});
});
}
},
};
})(jQuery, Drupal, drupalSettings);
......@@ -208,7 +208,7 @@ class WebformAnalysisBlock extends BlockBase {
* Get Elements.
*
* @param \Drupal\webform_analysis\WebformAnalysisInterface $analysis
* Analaysis.
* Analysis.
*
* @return array
* Options.
......
......@@ -28,6 +28,13 @@ class WebformAnalysis implements WebformAnalysisInterface {
*/
protected $entity;
/**
* The entity variable.
*
* @var \Drupal\Core\Entity\EntityInterface
*/
protected $sourceEntity;
/**
* The elements variable.
*
......@@ -36,7 +43,7 @@ class WebformAnalysis implements WebformAnalysisInterface {
protected $elements;
/**
* Construct.
* WebformAnalysis Constructor.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity of form.
......@@ -50,7 +57,8 @@ class WebformAnalysis implements WebformAnalysisInterface {
$this->entity = NULL;
}
else {
/** @var \Drupal\webform\WebformRequestInterface $webform_request_handler */
/** @var \Drupal\webform\WebformRequestInterface $webform_request */
// @phpstan-ignore-next-line as it is used on purpose.
$webform_request = \Drupal::service('webform.request');
[$this->webform, $this->sourceEntity] = $webform_request->getWebformEntities();
}
......@@ -105,9 +113,8 @@ class WebformAnalysis implements WebformAnalysisInterface {
* {@inheritdoc}
*/
public function getComponentValuesCount($component) {
$db = \Drupal::database();
$query = $db->select('webform_submission_data', 'wsd');
// @phpstan-ignore-next-line as this class object used at several places.
$query = \Drupal::database()->select('webform_submission_data', 'wsd');
$query->fields('wsd', ['value']);
$query->addExpression('COUNT(value)', 'quantity');
$query->leftJoin('webform_submission', 'ws', 'wsd.sid = ws.sid');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment