Skip to content

Commit b1a458d

Browse files
committed
[smarcet] - #12809
* fix on ingestion
1 parent 770526e commit b1a458d

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

software/code/infrastructure/active_records/OpenStackRelease.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,14 @@ public function addSupportedVersion(IOpenStackApiVersion $version, $status = "Cu
251251

252252
/**
253253
* @param string $code_name
254-
* @return bool
254+
* @return OpenStackComponent|null
255255
*/
256256
public function supportsComponent($code_name)
257257
{
258-
$res = $this->getManyManyComponents('OpenStackComponents',
259-
"OpenStackComponent.CodeName = '{$code_name}' ")->First();
260-
261-
return $res;
258+
foreach(AssociationFactory::getInstance()->getMany2ManyAssociation($this, 'OpenStackComponents')->toArray() as $component){
259+
if($component->CodeName == $code_name) return $component;
260+
}
261+
return null;
262262
}
263263

264264
/**
@@ -407,11 +407,17 @@ public function getComponentById($component_id)
407407
return $this->OpenStackComponents()->filter(array( 'OpenStackComponentID' => $component_id))->first();
408408
}
409409

410-
public function getVersionLabel($component_id)
410+
public function getCurrentSupportedApiVersionLabel($component_id)
411411
{
412412
$api = $this->SupportedApiVersions()
413-
->innerJoin('OpenStackApiVersion','OpenStackApiVersion.ID = OpenStackReleaseSupportedApiVersion.ApiVersionID')
414-
->filter('OpenStackComponentID', $component_id)->sort('OpenStackReleaseSupportedApiVersion.ReleaseVersion','DESC')->first();
413+
->innerJoin('OpenStackApiVersion','OpenStackApiVersion.ID = OpenStackReleaseSupportedApiVersion.ApiVersionID')
414+
->filter(
415+
[
416+
'OpenStackComponentID' => $component_id,
417+
'OpenStackReleaseSupportedApiVersion.Status' => 'Current'
418+
]
419+
)
420+
->first();
415421
if(is_null($api))
416422
return 'N/A';
417423
$res = $api->ReleaseVersion;

software/code/infrastructure/active_records/OpenStackReleaseSupportedApiVersion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class OpenStackReleaseSupportedApiVersion
2525
private static $db = array
2626
(
2727
'ReleaseVersion' => 'Text',
28-
'Status' => "Enum('Deprecated, Supported, Current, Beta, Alpha' , 'Deprecated')",
28+
'Status' => "Enum('Deprecated, Supported, Current, Beta, Alpha' , 'Current')",
2929
'CreatedFromTask' => 'Boolean',
3030
);
3131

software/templates/Layout/SoftwareHomePage_getComponent.ss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@
354354
<% loop Releases %>
355355
<li <% if $Status == Current %>class="timeline-current"<% end_if %><% if $Status == Future %>class="timeline-future"<% end_if %>>
356356
<a href="https://releases.openstack.org/{$Slug}/index.html#{$Slug}-{$Top.Component.Slug}" target="_blank">
357-
<%t Software.VERSION 'Version' %> {$getVersionLabel($Top.Component.ID)} ({$Name}) <% if $Status == Current %>- LATEST RELEASE<% end_if %>
357+
<%t Software.VERSION 'Version' %> {$getCurrentSupportedApiVersionLabel($Top.Component.ID)} ({$Name}) <% if $Status == Current %>- LATEST RELEASE<% end_if %>
358358
</a>
359359
</li>
360360
<% end_loop %>

0 commit comments

Comments
 (0)