-
Notifications
You must be signed in to change notification settings - Fork 12
Add premium percentage to list orders table #155
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
Conversation
WalkthroughAdds a "📊 Premium %" column to the orders table in the print_orders_table function, displaying the premium value for each order with center alignment. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/parser/orders.rs`:
- Around line 217-219: The header Cell::new("📊 Premium %") expects the premium
value to include a percent sign but the row currently uses
single_order.premium.to_string(); update the display logic for the premium
column (the code that renders single_order.premium in the rows — also the
similar occurrence later in the file) to format the value with a trailing
percent, e.g. use format!("{}%", single_order.premium) so it matches the header
and other places like print_premium() and dispute info.
| Cell::new("📊 Premium %") | ||
| .add_attribute(Attribute::Bold) | ||
| .set_alignment(CellAlignment::Center), |
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.
🧩 Analysis chain
🏁 Script executed:
# First, check the file structure and find the relevant files
find . -type f -name "*.rs" | head -20Repository: MostroP2P/mostro-cli
Length of output: 519
🏁 Script executed:
# Search for SmallOrder definition and premium field
rg -n "struct\s+SmallOrder" --type=rust -A 10Repository: MostroP2P/mostro-cli
Length of output: 46
🏁 Script executed:
# Check the actual code at lines 217-219 and 276 in src/parser/orders.rs
sed -n '210,225p' src/parser/orders.rs
sed -n '270,285p' src/parser/orders.rsRepository: MostroP2P/mostro-cli
Length of output: 1501
🏁 Script executed:
# Check Cargo.toml to understand dependencies
cat Cargo.toml | grep -A 5 "mostro_core\|dependencies"Repository: MostroP2P/mostro-cli
Length of output: 344
🏁 Script executed:
# Search for SmallOrder import in orders.rs
rg -n "use.*SmallOrder|import.*SmallOrder|from.*SmallOrder" src/parser/orders.rsRepository: MostroP2P/mostro-cli
Length of output: 46
🏁 Script executed:
# Check the beginning of orders.rs file for imports
head -50 src/parser/orders.rsRepository: MostroP2P/mostro-cli
Length of output: 1497
🏁 Script executed:
# Look for all uses of premium in the file
rg -n "premium" src/parser/orders.rs -B 2 -A 2Repository: MostroP2P/mostro-cli
Length of output: 637
🏁 Script executed:
# Check if mostro_core exists in workspace or other config files
find . -name "Cargo.toml" -o -name "Cargo.lock" | head -5Repository: MostroP2P/mostro-cli
Length of output: 89
🏁 Script executed:
# More complete Cargo.toml check
cat Cargo.tomlRepository: MostroP2P/mostro-cli
Length of output: 2641
🏁 Script executed:
# Search for all uses of premium in the entire codebase
rg -n "premium" --type=rust -B 2 -A 2Repository: MostroP2P/mostro-cli
Length of output: 8831
🏁 Script executed:
# Check nip33.rs to see how order_from_tags works and what premium becomes
find . -name "*.rs" -path "*/nip33*" -o -name "nip33.rs"Repository: MostroP2P/mostro-cli
Length of output: 78
🏁 Script executed:
# Look for any documentation or examples of premium value formatting
rg -n "Premium|premium" --type=rs -C 3 | head -60Repository: MostroP2P/mostro-cli
Length of output: 90
🏁 Script executed:
# Check if there are any test files or examples showing premium values
find . -name "*test*" -o -name "*example*" | grep -E "\.(rs|toml)$"Repository: MostroP2P/mostro-cli
Length of output: 92
Add "%" formatting to premium display to match the header.
The header says "📊 Premium %" but the row displays single_order.premium.to_string() without the percent symbol. Format it as format!("{}%", single_order.premium) to match the header and be consistent with how premium is displayed elsewhere (e.g., in print_premium() and dispute info).
Also applies to line 276
Same issue at line 276.🤖 Prompt for AI Agents
In `@src/parser/orders.rs` around lines 217 - 219, The header Cell::new("📊
Premium %") expects the premium value to include a percent sign but the row
currently uses single_order.premium.to_string(); update the display logic for
the premium column (the code that renders single_order.premium in the rows —
also the similar occurrence later in the file) to format the value with a
trailing percent, e.g. use format!("{}%", single_order.premium) so it matches
the header and other places like print_premium() and dispute info.
Add Premium Column to Orders Table
Summary
Adds the premium percentage column to the listorders command output table for better visibility of order pricing.
Changes
Benefits
Testing
Summary by CodeRabbit
New Features
✏️ Tip: You can customize this high-level summary in your review settings.