moved the enforcing of some invariants to be done on save

This commit is contained in:
aaron-jack-manning
2022-09-10 16:14:05 +10:00
parent 5bb20e6166
commit 5361ea4630
4 changed files with 37 additions and 40 deletions

View File

@@ -85,10 +85,6 @@ pub fn edit_raw(id : Id, vault_folder : path::PathBuf, editor : &str, state : &m
if edited_task.data.id != task.data.id {
Err(error::Error::Generic(String::from("You cannot change the ID of a task in a direct edit")))
}
// Enforce non numeric name invariant.
else if edited_task.data.name.chars().all(|c| c.is_numeric()) {
Err(error::Error::Generic(String::from("Name must not be purely numeric")))
}
else {
// Dependencies were edited so the graph needs to be updated.
if edited_task.data.dependencies != task.data.dependencies {