Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update VSTeamJobRequest.ps1 #229

Merged
merged 2 commits into from
Jan 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 6.4.3

Merged [Pull Request](https://github.com/DarqueWarrior/vsteam/pull/229) from [Asif Mithawala](https://github.com/asifma) which included the following:

Added additional property checks in VSTeamJobRequest

## 6.4.2

Merged [Pull Request](https://github.com/DarqueWarrior/vsteam/pull/226) from [Asif Mithawala](https://github.com/asifma) which included the following:
Expand Down
38 changes: 23 additions & 15 deletions Source/Classes/VSTeamJobRequest.ps1
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
class VSTeamJobRequest : VSTeamLeaf {
[datetime] $QueueTime
[datetime] $AssignTime
[datetime] $StartTime
[nullable[datetime]] $AssignTime
[nullable[datetime]] $StartTime
[nullable[datetime]] $FinishTime
[timespan] $Duration
[string] $Type
[string] $Result
[string[]] $Demands
[string] $Pipeline

VSTeamJobRequest (
[object]$obj
) : base($obj.owner.name, $obj.requestId, $null) {

$this.Type = $obj.planType
if ($obj.PSobject.Properties.Name -contains "result") {
$this.Result = $obj.result
if ($obj.PSobject.Properties.Name -notcontains "result" -and $obj.PSobject.Properties.Name -notcontains "assignTime") {
$this.Result = 'queued'
}
else {
$this.Result = 'running'
elseif ($obj.PSobject.Properties.Name -notcontains "result" -and $obj.PSobject.Properties.Name -contains "assignTime") {
$this.Result = 'running'
}
else {
$this.Result = $obj.result
}
$this.Demands = $obj.demands
$this.QueueTime = $obj.queueTime
$this.AssignTime = $obj.assignTime
$this.StartTime = $obj.receiveTime
if ($obj.PSobject.Properties.Name -contains "assignTime") {
$this.AssignTime = $obj.assignTime
}
else {
$this.AssignTime = $null
}
if ($obj.PSobject.Properties.Name -contains "receiveTime") {
$this.StartTime = $obj.receiveTime
}
else {
$this.StartTime = $null
}
if ($obj.PSobject.Properties.Name -contains "finishTime") {
$this.FinishTime = $obj.finishTime
}
else {
$this.FinishTime = $null
$this.FinishTime = $null
}
$this.Pipeline = $obj.definition.name

if ($null -ne $this.FinishTime) {
if ($null -ne $this.FinishTime -and $null -ne $this.StartTime) {
$this.Duration = $this.FinishTime - $this.StartTime
}

$this._internalObj = $obj

$this.AddTypeName('Team.JobRequest')
}
}
2 changes: 1 addition & 1 deletion Source/VSTeam.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'VSTeam.psm1'

# Version number of this module.
ModuleVersion = '6.4.2'
ModuleVersion = '6.4.3'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down