Fix: maproulette import flow

This commit is contained in:
Pieter Vander Vennet 2023-06-09 16:13:35 +02:00
parent f80054558f
commit 5f7cc351c9
18 changed files with 331 additions and 114 deletions

View file

@ -72,4 +72,23 @@ export default class Maproulette {
throw `Failed to close task: ${response.status}`
}
}
/**
* Converts a status text into the corresponding number
*
* Maproulette.codeToIndex("Created") // => 0
* Maproulette.codeToIndex("qdsf") // => undefined
*
*/
public static codeToIndex(code: string) : number | undefined{
if(code === "Created"){
return Maproulette.STATUS_OPEN
}
for (let i = 0; i < 9; i++) {
if(Maproulette.STATUS_MEANING[""+i] === code){
return i
}
}
return undefined
}
}