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

[fix] #2202: Fix total field in query response #2346

Merged

Conversation

Erigara
Copy link
Contributor

@Erigara Erigara commented Jun 8, 2022

Signed-off-by: Shanin Roman shanin1000@yandex.ru

Description of the Change

The total is the number of values returned in the top-most level of an iterable container after applying filter and before pagination.

  • Fix total field calculation in handle_queries;
  • Extend test torii_pagination to check that total field value is unaffected by pagination.

Issue

Closes #2202.

Benefits

The total field is now what the SDK developers expect.

Possible Drawbacks

None.

Usage Examples or Tests

cargo test --package iroha --lib -- torii::tests::torii_pagination --exact --nocapture

@github-actions github-actions bot added the iroha2-dev The re-implementation of a BFT hyperledger in RUST label Jun 8, 2022
@codecov
Copy link

codecov bot commented Jun 8, 2022

Codecov Report

Merging #2346 (bac9c54) into iroha2-dev (6973f71) will increase coverage by 0.45%.
The diff coverage is 77.57%.

❗ Current head bac9c54 differs from pull request most recent head 1be2e6f. Consider uploading reports for the commit 1be2e6f to get more accurate results

@@              Coverage Diff               @@
##           iroha2-dev    #2346      +/-   ##
==============================================
+ Coverage       65.50%   65.95%   +0.45%     
==============================================
  Files             133      134       +1     
  Lines           24697    25416     +719     
==============================================
+ Hits            16177    16764     +587     
- Misses           8520     8652     +132     
Impacted Files Coverage Δ
config/src/lib.rs 15.38% <0.00%> (+1.09%) ⬆️
core/src/smartcontracts/isi/world.rs 9.52% <0.00%> (+0.43%) ⬆️
data_model/primitives/src/atomic.rs 15.87% <ø> (ø)
data_model/primitives/src/fixed.rs 64.10% <0.00%> (+0.30%) ⬆️
data_model/src/events/data/events.rs 39.58% <ø> (ø)
telemetry/src/retry_period.rs 68.18% <0.00%> (-10.77%) ⬇️
telemetry/src/ws.rs 86.97% <0.00%> (ø)
data_model/src/role.rs 5.88% <18.75%> (+2.80%) ⬆️
data_model/src/peer.rs 46.66% <26.66%> (-17.23%) ⬇️
data_model/src/lib.rs 56.54% <29.82%> (-5.40%) ⬇️
... and 49 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff6e607...1be2e6f. Read the comment docs.

cli/src/torii/tests.rs Show resolved Hide resolved
.len()
.try_into()
.map_err(|e: TryFromIntError| QueryError::Conversion(e.to_string()))?;

let result = filter.filter(original_result);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arndey Should we also include the number of filtered-out results in the total?

@s8sato s8sato self-assigned this Jun 9, 2022
cli/src/torii/routing.rs Show resolved Hide resolved
Signed-off-by: Shanin Roman <shanin1000@yandex.ru>
@appetrosyan appetrosyan merged commit 4f983f8 into hyperledger:iroha2-dev Jun 9, 2022
@Erigara Erigara deleted the fix_query_pagination_total branch June 9, 2022 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
iroha2-dev The re-implementation of a BFT hyperledger in RUST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants