Warn if a specific class is missing
Use case example
You expect a certain class to always be present. If it's not warn.
In Diffgram
Search Warn Label Missing
let found_label_file_ids = []
let target_name = "replace_me"
let label_file = diffgram.label_list.find(
x=> {return x.label.name == target_name})
for (let instance of diffgram.instance_list){
if (instance.soft_delete == true) {continue}
if(instance.label_file_id != label_file.id) {continue}
found_label_file_ids.push(instance.label_file_id)
}
if (found_label_file_ids.length > 0) {
let message = "Found at least one " + target_name
diffgram.show_snackbar(message)
} else {
let message = "No instances of " + target_name + " found."
diffgram.show_snackbar(message)
}
Updated over 3 years ago