Skip to content

Browse all challenges#12

Open
thoelze1 wants to merge 7 commits intotimvisher:masterfrom
thoelze1:browse-all-challenges
Open

Browse all challenges#12
thoelze1 wants to merge 7 commits intotimvisher:masterfrom
thoelze1:browse-all-challenges

Conversation

@thoelze1
Copy link
Copy Markdown

This branch adds the ability to browse all pages of challenges. Before this branch, only the first page of challenges is available.

There are at most a couple of design choices to mention. First, bounds checking is performed by parsing the last page number from the HTML navigation panel during the first call to url-retrieve. I prefer this method over trial-and-error (i.e. don't store a last page number: always try to get the next page, and if no challenges can be parsed then go back) because it is simple. Second, we don't verify that the regex used for parsing the last page number actually succeeds with a match (which is also true of the challenge parsing).

Also, I removed a TODO about using an API to browse challenges. As I mention in the relevant commit, I am fairly certain there is no such API based on the VimGolf docs and CLI code.

@timvisher we emailed about this feature in 2019. Here it is :) Thanks and all the best

This felt simpler than rebasing, plus I wanted to preserve my commit
from years ago.
The number gets parsed from the HTML only once. This keeps things
simple, even though it is possible that the total number of pages
could change during browse, resulting in unreachable pages until
vimgolf.el is reloaded.

To ensure all pages are reachable, we could make the request without
storing/checking an upper bound. If the request yields no challenges
parsed, then we retain the previous page results.
There is no checking that the number of the last page is
non-nil. Parsing could fail silently and we wouldn't know here. We
could raise an error here, or leave it as is.
I am fairly certain there is no API for browsing all of the
challenges. The vimgolf docs say to use your browser to pick a
challenge. I could find no functionality to browse challenges in the
official CLI.
@timvisher
Copy link
Copy Markdown
Owner

Thanks this looks great. :)

@timvisher
Copy link
Copy Markdown
Owner

@thoelze1 Could you rebase the branch and clean up the history a bit. After that I'm happy to merge and release this.

@timvisher
Copy link
Copy Markdown
Owner

Also I think we should cut 0.11.0 with this. Can you make the final two commits first the 0.11.0 cut and then the 0.11.1-SNAPSHOT change?

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.

2 participants