Skip to content

Don't allow entry of non-recognised species#6

Draft
svenddpc wants to merge 10 commits into
SimonCarryer:masterfrom
svenddpc:master
Draft

Don't allow entry of non-recognised species#6
svenddpc wants to merge 10 commits into
SimonCarryer:masterfrom
svenddpc:master

Conversation

@svenddpc

Copy link
Copy Markdown
Contributor

When checking if entered answers are correct, first check if the entered value is a species at all. If not, show a text explaining that it is not a species. This avoids failing people for spelling, odd spaces, etc.

Null is treated as a "wrong answer", rather than an incorrect answer, however, it is not possible to submit null, only "", which is currently treated as an invalid answer, so if that isn't changed, maybe we'd need a "give up" or "skip" button, instead of having to enter some random species if you have no idea (and not just "pigeon") :P

A better solution would possibly be to use the set of names (in all_bird_names.json) for an autocomple feature when entering text. I might give this a go at some point, if I find the time:

https://www.w3schools.com/howto/howto_js_autocomplete.asp

svenddpc and others added 7 commits April 20, 2022 10:30
This fixes an issue where an answer is rated as wrong if it has whitespace on either end.
This happens when entering words on a mobile using auto-complete.
…me. Use the return type constants properly instead of a mix of bools and InvalidAnswer.
Because got_it_right is now an int and "correct" is 0, but got_it_right was being evaluated as a bool, 0 would evaluate to false. Now it's correctly comparing to constant value.
@svenddpc svenddpc marked this pull request as draft May 23, 2022 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant