Skip to content

Commit

Permalink
!deploy v2.23.2 - quick fix on error introduced in last version
Browse files Browse the repository at this point in the history
  • Loading branch information
scrthq committed Mar 5, 2019
1 parent 929d347 commit 147a9a0
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 39 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

* [Changelog](#changelog)
* [2.23.2](#2232)
* [2.23.1](#2231)
* [2.23.0](#2230)
* [2.22.4](#2224)
Expand Down Expand Up @@ -75,6 +76,10 @@

***

## 2.23.2

* Fixed logic issue with Get-GSUsageReport for reports returning no entities where errors would be thrown. Resolved by guarding against acting on `$null` values in the loop.

## 2.23.1

**This update changes the output of `Get-GSUsageReport` -- please review the output changes before updating if you have scripts that use that function!!**
Expand Down
2 changes: 1 addition & 1 deletion PSGSuite/PSGSuite.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSGSuite.psm1'

# Version number of this module.
ModuleVersion = '2.23.1'
ModuleVersion = '2.23.2'

# ID used to uniquely identify this module
GUID = '9d751152-e83e-40bb-a6db-4c329092aaec'
Expand Down
78 changes: 40 additions & 38 deletions PSGSuite/Public/Reports/Get-GSUsageReport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -134,50 +134,52 @@ function Get-GSUsageReport {
}
else {
$result.UsageReportsValue | ForEach-Object {
$orig = $_
$orig | Add-Member -MemberType NoteProperty -Name CustomerId -Value $orig.Entity.CustomerId -Force -PassThru | Add-Member -MemberType NoteProperty -Name EntityType -Value $orig.Entity.Type -Force
switch ($PSCmdlet.ParameterSetName) {
Entity {
$orig | Add-Member -MemberType NoteProperty -Name EntityKey -Value $orig.Entity.EntityKey -Force
$orig | Add-Member -MemberType NoteProperty -Name CommunityName -Value $orig.Parameters[$orig.Parameters.Name.IndexOf('gplus:community_name')].StringValue -Force
}
User {
$orig | Add-Member -MemberType NoteProperty -Name Email -Value $orig.Entity.UserEmail -Force -PassThru | Add-Member -MemberType NoteProperty -Name UserEmail -Value $orig.Entity.UserEmail -Force -PassThru | Add-Member -MemberType NoteProperty -Name ProfileId -Value $orig.Entity.ProfileId -Force
}
}
foreach ($param in $orig.Parameters | Sort-Object Name) {
if ($null -ne $param.Name) {
$paramValue = if ($null -ne $param.StringValue) {
$param.StringValue
}
elseif ($null -ne $param.IntValue) {
$param.IntValue
}
elseif ($null -ne $param.DatetimeValue) {
$param.DatetimeValue
}
elseif ($null -ne $param.BoolValue) {
$param.BoolValue
}
elseif ($null -ne $param.MsgValue) {
$param.MsgValue
}
else {
$null
if ($null -ne $_) {
$orig = $_
$orig | Add-Member -MemberType NoteProperty -Name CustomerId -Value $orig.Entity.CustomerId -Force -PassThru | Add-Member -MemberType NoteProperty -Name EntityType -Value $orig.Entity.Type -Force
switch ($PSCmdlet.ParameterSetName) {
Entity {
$orig | Add-Member -MemberType NoteProperty -Name EntityKey -Value $orig.Entity.EntityKey -Force
$orig | Add-Member -MemberType NoteProperty -Name CommunityName -Value $orig.Parameters[$orig.Parameters.Name.IndexOf('gplus:community_name')].StringValue -Force
}
if ($Flat) {
$orig | Add-Member -MemberType NoteProperty -Name $param.Name -Value $paramValue -Force
User {
$orig | Add-Member -MemberType NoteProperty -Name Email -Value $orig.Entity.UserEmail -Force -PassThru | Add-Member -MemberType NoteProperty -Name UserEmail -Value $orig.Entity.UserEmail -Force -PassThru | Add-Member -MemberType NoteProperty -Name ProfileId -Value $orig.Entity.ProfileId -Force
}
else {
$pName = $param.Name -split ":"
if ($orig.PSObject.Properties.Name -notcontains $pName[0]) {
$orig | Add-Member -MemberType NoteProperty -Name $pName[0] -Value $([Ordered]@{}) -Force
}
foreach ($param in $orig.Parameters | Sort-Object Name) {
if ($null -ne $param.Name) {
$paramValue = if ($null -ne $param.StringValue) {
$param.StringValue
}
elseif ($null -ne $param.IntValue) {
$param.IntValue
}
elseif ($null -ne $param.DatetimeValue) {
$param.DatetimeValue
}
elseif ($null -ne $param.BoolValue) {
$param.BoolValue
}
elseif ($null -ne $param.MsgValue) {
$param.MsgValue
}
else {
$null
}
if ($Flat) {
$orig | Add-Member -MemberType NoteProperty -Name $param.Name -Value $paramValue -Force
}
else {
$pName = $param.Name -split ":"
if ($orig.PSObject.Properties.Name -notcontains $pName[0]) {
$orig | Add-Member -MemberType NoteProperty -Name $pName[0] -Value $([Ordered]@{}) -Force
}
$orig.$($pName[0])[$pName[1]] = $paramValue
}
$orig.$($pName[0])[$pName[1]] = $paramValue
}
}
$orig
}
$orig
}
}
$warnings += $result.Warnings
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ Update-GSSheetValue Export-GSSheet

[Full CHANGELOG here](https://github.com/scrthq/PSGSuite/blob/master/CHANGELOG.md)

#### 2.23.2

* Fixed logic issue with Get-GSUsageReport for reports returning no entities where errors would be thrown. Resolved by guarding against acting on `$null` values in the loop.

#### 2.23.1

**This update changes the output of `Get-GSUsageReport` -- please review the output changes before updating if you have scripts that use that function!!**
Expand Down

0 comments on commit 147a9a0

Please sign in to comment.