Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Failure to properly handle database out of synchronization with agent language #307

Merged
merged 1 commit into from
Dec 8, 2021
Merged
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
11 changes: 7 additions & 4 deletions iast/views/vul_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,20 @@ def get_languages(agent_items):
if agent_id not in agent_ids:
agent_ids[agent_id] = 0
agent_ids[agent_id] = agent_ids[agent_id] + 1

language_agents = dict()
language_items = IastAgent.objects.filter(
id__in=agent_ids.keys()).values('id', 'language')
for language_item in language_items:
language_agents[language_item['id']] = language_item['language']

for agent_id, count in agent_ids.items():
default_language[
language_agents[agent_id]] = count + default_language[
language_agents[agent_id]]
if default_language.get(language_agents[agent_id],None):
default_language[
language_agents[agent_id]] = count + default_language[
language_agents[agent_id]]
else:
default_language[
language_agents[agent_id]] = count
return [{
'language': _key,
'count': _value
Expand Down