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 budget deserialization for ideascale importer. #149

Open
wants to merge 1 commit into
base: catalyst-fund9
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions catalyst-toolbox/src/ideascale/models/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ fn deserialize_rewards<'de, D: Deserializer<'de>>(deserializer: D) -> Result<u64
let rewards_str = String::deserialize(deserializer)?;

// input is not standarized, hack an early return if it is just 0 ada
if rewards_str.starts_with("0 ada") {
if rewards_str.starts_with("0 ada") | rewards_str.is_empty() {
return Ok(0);
}
sscanf::scanf!(rewards_str.trim_end(), "{} in {}", String, String)
sscanf::scanf!(rewards_str.trim_end(), r"{/\$?/}{} {/(:?in )?/}{}", String, String, String, String)
// trim all . or , in between numbers
.map(|(mut amount, _currency)| {
.map(|(_, mut amount, _, _currency)| {
amount.retain(|c: char| c.is_numeric() && !(matches!(c, '.') || matches!(c, ',')));
amount
})
Expand Down