Skip to content

Commit

Permalink
fix(api): Missing VM tags in API
Browse files Browse the repository at this point in the history
  • Loading branch information
mromulus committed Feb 16, 2024
1 parent dda48ea commit 0eb94d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
9 changes: 0 additions & 9 deletions app/calculation/generate_tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,6 @@ def network_result

def virtual_machine_result
[].tap do |results|
if subject.numbered_actor && !subject.numbered_actor.subtree.include?(subject.actor)
results << {
id: ActorAPIName.result_for(subject.actor, numbered_by: subject.numbered_actor),
name: ActorAPIName.result_for(subject.actor, numbered_by: subject.numbered_actor),
config_map: {},
children: []
}
end

if subject.customization_specs.size > 1
results << {
id: "#{subject.name}_all_specs",
Expand Down
8 changes: 7 additions & 1 deletion app/presenters/api/v3/tags_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module API
module V3
class TagsPresenter < Struct.new(:exercise, :scope)
def as_json(_opts)
actor_tags + os_tags + zone_tags + capability_tags + spec_tags
actor_tags + vm_tags + os_tags + zone_tags + capability_tags + spec_tags
end

private
Expand Down Expand Up @@ -55,6 +55,12 @@ def spec_tags
GenerateTags.result_for(spec_scope.all).uniq
end
end

def vm_tags
Rails.cache.fetch(['apiv3', exercise.cache_key_with_version, 'vm_tags', vm_scope.cache_key_with_version]) do
GenerateTags.result_for(vm_scope.all).uniq
end
end
end
end
end

0 comments on commit 0eb94d6

Please sign in to comment.