Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug(partition-view): two implementation details are fragile #456

Open
erikmd opened this issue Nov 3, 2021 · 1 comment · May be fixed by #550
Open

Bug(partition-view): two implementation details are fragile #456

erikmd opened this issue Nov 3, 2021 · 1 comment · May be fixed by #550
Assignees

Comments

@erikmd
Copy link
Member

erikmd commented Nov 3, 2021

Related project scope(s): partition-view

Bug description

Regarding learnocaml_partition_view.ml, it seems two points would deserve to be improved after fixing #438:

  1. | Partition (token, eid, fid, prof) ->
    get ~token
    ["partition"; eid; fid; string_of_int prof]

    → this basically turn Partition("X-U1O-AB1-1FJ-ZOF", "demo", "times", 30) into an HTTP request to
    http://localhost:8080/partition/demo/times/30?token=X-U1O-AB1-1FJ-ZOF
    → I believe this is an issue if the exercise_id contains a /, e.g.: "fpottier/alpha_beta"
    → the URL should be changed to something like
    http://localhost:8080/partition/fpottier%2Falpha_beta/times/30?token=X-U1O-AB1-1FJ-ZOF
    or http://localhost:8080/partition/times/30?id=fpottier/alpha_beta&token=X-U1O-AB1-1FJ-ZOF
    → a bit like the already-existing URL http://localhost:8080/partition-view.html?id=demo&function=times&prof=30
    → Fortunately, changing this wouldn't impact the learn-ocaml-client-related backward-compatibility claim:
    Regarding the inevitable extensions of the API:
    - make sure we only add constructors to this [request] type,
    - and that their semantics does not change
    (or at least in a backward-compatible way;
    see PR https://github.com/ocaml-sf/learn-ocaml/pull/397
    for a counter-example);
    - but if a given entrypoint would need to be removed,
    add a [Compat.Upto] constraint (*<*) instead.
    *)

  2. let _win = window_open ("/student-view.html?token="^tok) "_blank" in

    → the "BASE_URL" should be prepended, similarly to:
    document.getElementById('chamo-img').src = learnocaml_config.baseUrl + '/icons/tryocaml_loading_' + n + '.gif';

    (Note to myself: this line of learnocaml_description_main.ml is also impacted ↓)
    (Printf.sprintf "/description/%s#%s=%s"

Current configuration

  • OS name (and version): GNU/Linux
  • Browser name (and version): Firefox
  • learn-ocaml --version: 0.13.1
@erikmd
Copy link
Member Author

erikmd commented May 3, 2023

Dear @Plictox,
I believe it would be natural for you to start investigating this bug report #456
as soon as you'll have pushed a first complete version of #548 for review (i.e. hopefully, before our upcoming meeting :)

@Plictox Plictox linked a pull request May 5, 2023 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants