add a few more ftl type hints

This commit is contained in:
Damien Elmes 2021-03-29 15:55:15 +10:00
parent 6ca690a14c
commit 0a5222c400

View file

@ -163,7 +163,7 @@ impl From<String> for Variable {
let kind = match name.as_str() { let kind = match name.as_str() {
"cards" | "notes" | "count" | "amount" | "reviews" | "total" | "selected" "cards" | "notes" | "count" | "amount" | "reviews" | "total" | "selected"
| "kilobytes" | "daysStart" | "daysEnd" | "days" | "secs-per-card" | "remaining" | "kilobytes" | "daysStart" | "daysEnd" | "days" | "secs-per-card" | "remaining"
| "hourStart" | "hourEnd" | "correct" => VariableKind::Int, | "hourStart" | "hourEnd" | "correct" | "decks" => VariableKind::Int,
"average-seconds" | "cards-per-minute" => VariableKind::Float, "average-seconds" | "cards-per-minute" => VariableKind::Float,
"val" | "found" | "expected" | "part" | "percent" | "day" | "number" | "up" "val" | "found" | "expected" | "part" | "percent" | "day" | "number" | "up"
| "down" | "seconds" | "megs" => VariableKind::Any, | "down" | "seconds" | "megs" => VariableKind::Any,
@ -171,6 +171,8 @@ impl From<String> for Variable {
let term = term.to_ascii_lowercase(); let term = term.to_ascii_lowercase();
if term.ends_with("count") { if term.ends_with("count") {
VariableKind::Int VariableKind::Int
} else if term.starts_with("num") {
VariableKind::Any
} else { } else {
VariableKind::String VariableKind::String
} }