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

lcaac: cli: include depth in trace #34

Merged
merged 1 commit into from
Oct 1, 2024
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
9 changes: 8 additions & 1 deletion cli/src/main/kotlin/ch/kleis/lcaac/cli/cmd/TraceCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class TraceCommand : CliktCommand(name = "trace", help = "Trace the contribution
.sortedBy { it.getShortName() }

val header = listOf(
"d_amount", "d_unit", "d_product", "alloc",
"depth", "d_amount", "d_unit", "d_product", "alloc",
"name", "a", "b", "c", "amount", "unit",
).plus(
controllablePorts.flatMap {
Expand All @@ -137,10 +137,14 @@ class TraceCommand : CliktCommand(name = "trace", help = "Trace the contribution
observablePorts.asSequence()
.map { row ->
val supply = analysis.supplyOf(row)
val depth = trace.getDepthOf(row)
?.let { it.toString() }
?: ""
val supplyAmount = supply.amount.value * allocationAmount
val prefix = when (row) {
is IndicatorValue -> {
listOf(
depth,
demandedAmount.toString(),
demandedUnit.toString(),
demandedProductName,
Expand All @@ -156,6 +160,7 @@ class TraceCommand : CliktCommand(name = "trace", help = "Trace the contribution

is ProductValue -> {
listOf(
depth,
demandedAmount.toString(),
demandedUnit.toString(),
demandedProductName,
Expand All @@ -171,6 +176,7 @@ class TraceCommand : CliktCommand(name = "trace", help = "Trace the contribution

is FullyQualifiedSubstanceValue -> {
listOf(
depth,
demandedAmount.toString(),
demandedUnit.toString(),
demandedProductName,
Expand All @@ -186,6 +192,7 @@ class TraceCommand : CliktCommand(name = "trace", help = "Trace the contribution

is PartiallyQualifiedSubstanceValue -> {
listOf(
depth,
demandedAmount.toString(),
demandedUnit.toString(),
demandedProductName,
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ javaVersion=17
gradleVersion=7.6
org.gradle.jvmargs=-Xmx4096m
lcaacGroup=ch.kleis.lcaac
lcaacVersion=1.7.4
lcaacVersion=1.7.5
Loading