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

Return all events from transaction trees including non-root events #28

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 2 additions & 3 deletions src/main/scala/com/daml/projection/scaladsl/Consumer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ private[projection] object Consumer extends StrictLogging {
Instant.ofEpochSecond(timestamp.seconds, timestamp.nanos.toLong))
val workflowId = txTree.workflowId
val newProjectionOffset = Offset(txTree.offset)
val envelopes = txTree.rootEventIds.flatMap { eventId =>
val event = txTree.eventsById(eventId)
val envelopes = txTree.eventsById.valuesIterator.flatMap { event =>
val envelope =
Envelope[TreeEvent](
event,
Expand All @@ -332,7 +331,7 @@ private[projection] object Consumer extends StrictLogging {
Some(newProjectionOffset)
)
if (predicate(envelope)) Some(envelope) else None
}
}.toList
if (envelopes.nonEmpty) {
envelopes :+ TxBoundary[TreeEvent](projectionId, newProjectionOffset)
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/com/daml/projection/javadsl/JavaApiSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,9 @@ class JavaApiSpec
)
Then("the projected table should contain the events")
// create + exercise
transferResultContractIds.size must be(4)
transferResultContractIds.size must be(6)
transferResultContractIds must contain(firstResultContractId)
transferResultContractIds.filter(_ == "").size must be(2)
transferResultContractIds.filter(_ == "").size must be(4)

Then("the projection has advanced to the tx offset associated to the archived event")
projector.getCurrentOffset(projection).toScala must be(
Expand Down