Skip to content

Commit

Permalink
Reformatted Code
Browse files Browse the repository at this point in the history
Just some simple reformatting.
  • Loading branch information
ryanrath committed May 21, 2019
1 parent e0b0720 commit e409576
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions html/gui/js/modules/summary/SummaryStatisticsPortlet.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ XDMoD.Modules.SummaryPortlets.SummaryStatisticsPortlet = Ext.extend(Ext.ux.Portl
var title = this.baseTitle;

var dateRanges = CCR.xdmod.ui.DurationToolbar.getDateRanges();
for ( var i = 0; i < dateRanges.length; i++ ) {
for (var i = 0; i < dateRanges.length; i++) {
var dateRange = dateRanges[i];
if (dateRange.text === this.config.timeframe) {
this.config.start_date = this.formatDate(dateRange.start);
this.config.end_date = this.formatDate(dateRange.end);
title = `${this.baseTitle} - ${this.config.start_date} to ${this.config.end_date}`;
title = this.baseTitle + ' - ' + this.config.start_date + ' to ' + this.config.end_date;
}
}

Expand Down Expand Up @@ -205,8 +205,8 @@ XDMoD.Modules.SummaryPortlets.SummaryStatisticsPortlet = Ext.extend(Ext.ux.Portl
this.getTopToolbar().doLayout();
}, // populateSummaryStatistics

formatDate: function(date) {
return `${date.getFullYear()}-${("" + (date.getMonth() + 1)).padStart(2, '0')}-${("" + date.getDate()).padStart(2, '0')}`
formatDate: function (date) {
return date.getFullYear() + '-' + ('' + (date.getMonth() + 1)).padStart(2, '0') + '-' + ('' + date.getDate()).padStart(2, '0');
} // formatDate: function(date) {
}); // XDMoD.Modules.SummaryPortlets.CenterHealthPortlet = Ext.extend(Ext.ux.Portlet, {

Expand Down
14 changes: 7 additions & 7 deletions tests/integration/lib/Rest/SummaryControllerProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ public function testGetStatistics(array $options)
// present in the `data` section. This will let us detect when we have a `float` and
// include a delta for the equality test.
$expectedTypes = array();
foreach($expected['formats'] as $format) {
foreach($format['items'] as $item) {
foreach ($expected['formats'] as $format) {
foreach ($format['items'] as $item) {
$expectedTypes[$item['fieldName']] = $item['numberType'];
}
}

// These attributes can just straight up be checked for equality.
$equalAttributes = array('totalCount', 'success', 'message', 'formats');
foreach($equalAttributes as $attribute) {
foreach ($equalAttributes as $attribute) {
$this->assertEquals($expected[$attribute], $actual[$attribute]);
}

Expand All @@ -88,14 +88,14 @@ public function testGetStatistics(array $options)
$expectedData = $expected['data'][0];
$actualData = $actual['data'][0];

foreach($expectedData as $fieldName => $value) {
foreach ($expectedData as $fieldName => $value) {
$this->assertArrayHasKey($fieldName, $actualData);

if ((array_key_exists($fieldName, $expectedTypes) && $expectedTypes[$fieldName] === 'float') ||
strpos($fieldName, 'sem_') !== false) {
// Make sure that the values we are validating are in the correct format.
$expectedValue = (float) $value[0];
$actualValue = (float) $actualData[$fieldName][0];
$expectedValue = (float)$value[0];
$actualValue = (float)$actualData[$fieldName][0];

$this->assertEquals($expectedValue, $actualValue, "", 1.0e-8);
} else {
Expand All @@ -117,7 +117,7 @@ public function provideTestGetStatistics()

private function recursivelyFilter(array $data, array $keys)
{
foreach($data as $key => $value) {
foreach ($data as $key => $value) {
if (in_array($key, $keys, true)) {
unset($data[$key]);
} elseif (is_array($value)) {
Expand Down

0 comments on commit e409576

Please sign in to comment.