-
Notifications
You must be signed in to change notification settings - Fork 0
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
feature: Violating agents, allocation reasons and more #48
Conversation
label: "Collisions", | ||
value: simulation.statistics.totalNumberOfCollisions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
label: "Collisions", | |
value: simulation.statistics.totalNumberOfCollisions, | |
label: "Violations", | |
value: simulation.statistics.totalNumberOfCollisions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename property as well. Should be called violations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get it. The API property is called "total_number_of_collisions", I name it "totalNumberOfCollisions" and display it under the title "Collisions", but you are telling me it should be called Violations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
habs in meinem PR gefixed
Co-authored-by: thommann <34217413+thommann@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm proud of you. But it's to complex
const violationData = computed(() => { | ||
return Object.entries(simulation.agentInFocus.violations) | ||
.map(([agent_id, locations]) => { | ||
return locations.map((loc) => ({ | ||
...loc, | ||
agent: agent_id, | ||
})); | ||
}) | ||
.flat() | ||
.reduce((acc, violation) => { | ||
const subtitle = `Tick ${violation.t}`; | ||
let entryIndex = acc.findIndex((v) => v.subtitle === subtitle); | ||
if (entryIndex === -1) { | ||
acc.push({ | ||
subtitle, | ||
datapoints: [], | ||
}); | ||
entryIndex = acc.length - 1; | ||
} | ||
const agent = simulation.agents.find((a) => a.id === violation.agent); | ||
acc[entryIndex].datapoints.push({ | ||
label: `${agent.owner.name} > ${agent.id}`, | ||
value: { x: violation.x, y: violation.y, z: violation.z }, | ||
icon: GitPullRequest, | ||
onClick: () => { | ||
simulation.focusOnAgent(agent); | ||
}, | ||
}); | ||
return acc; | ||
}, []); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cyclic complexity to hight
No description provided.