Skip to content

Commit 3991996

Browse files
committed
feat(lab): return first resource if no translation
1 parent 6e230ce commit 3991996

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/model.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ impl Query {
4545
let resource = language
4646
.map(|lang| lab.resources.iter().find(|resource| resource.lang == lang))
4747
.flatten()
48-
.ok_or(QueryError::NotFoundError("translation".to_string()).extend())?;
48+
.or(lab.resources.first())
49+
.ok_or(QueryError::NotFoundError("resource".to_string()).extend())?;
4950

5051
let mut result: LabInstance = LabInstance {
5152
lang: resource.lang.clone(),

0 commit comments

Comments
 (0)