Skip to content

Commit

Permalink
0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
maksimryndin committed May 21, 2024
1 parent 9690ab7 commit c39c09c
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/google/datavalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,26 +405,26 @@ impl From<Datarow> for RuleApplicant {
"assert: sheet id should be initialized before the rule applicant transformation",
);
// convert datavalues into types supported by rules with O(1) access
let data =
data.into_iter()
.chain([(
DATETIME_COLUMN_NAME.to_string(),
Datavalue::Datetime(timestamp),
)])
.map(|(k, v)| {
let v = match v {
Text(t) | RedText(t) | OrangeText(t) | GreenText(t) => Text(t),
Number(n) => Number(n),
Integer(i) | IntegerID(i) => Integer(i),
Percent(p) | HeatmapPercent(p) => Number(p / 100.0),
Datetime(d) => Number(convert_datetime_to_spreadsheet_double(d)),
Bool(b) => Bool(b),
Size(s) => Number(s as f64), // Rounding errors are acceptable for Size datavalues
NotAvailable => NotAvailable,
};
(k, v)
})
.collect();
let data = data
.into_iter()
.chain([(
DATETIME_COLUMN_NAME.to_string(),
Datavalue::Datetime(timestamp),
)])
.map(|(k, v)| {
let v = match v {
Text(t) | RedText(t) | OrangeText(t) | GreenText(t) => Text(t),
Number(n) => Number(n),
Integer(i) | IntegerID(i) => Integer(i),
Percent(p) | HeatmapPercent(p) => Number(p / 100.0),
Datetime(d) => Number(convert_datetime_to_spreadsheet_double(d)),
Bool(b) => Bool(b),
Size(s) => Number(s as f64), // Rounding errors are acceptable for Size datavalues
NotAvailable => NotAvailable,
};
(k, v)
})
.collect();
RuleApplicant {
log_name,
data,
Expand Down

0 comments on commit c39c09c

Please sign in to comment.