Skip to content

Bug: the Closed/Open state is buggy/confusing #558

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

Closed
erikmd opened this issue Aug 12, 2023 · 1 comment · Fixed by #566, #561 or ocaml/opam-repository#24739
Closed

Bug: the Closed/Open state is buggy/confusing #558

erikmd opened this issue Aug 12, 2023 · 1 comment · Fixed by #566, #561 or ocaml/opam-repository#24739

Comments

@erikmd
Copy link
Member

erikmd commented Aug 12, 2023

Related user(s):

@erikmd, @AltGr

Related issue(s) or PR(s):

Related project scope(s):

teacher dashboard

Bug description:

cf. sync.zip

With this zipped sync folder, there are two issues in the teacher dashboard:

  1. if we click on the first exercise (demo) then on Open/Close once or several times, it's an unexpected no-op (the badge stays "Assigned", and after clicking on Apply, the sync/exercises.json file does not change either)
  2. the second exercise (demo2) is wrongly labelled "Assigned", while the exercise is not included in any assignment anymore.

FTR, here is the contents (pretty-printed with jq) of the file sync/exercises.json:

[
  {
    "learnocaml_version": "2",
    "id": "demo",
    "assignments": {
      "default": {
        "start": 1691877600,
        "stop": 1692482400
      },
      "token_map": {
        "KOK-W3L-NE1-SVY": "Open"
      }
    }
  },
  {
    "learnocaml_version": "2",
    "id": "demo2",
    "assignments": {
      "default": "Closed",
      "token_map": {
        "KOK-W3L-NE1-SVY": "Open"
      }
    }
  }
]

To reproduce:

Steps to reproduce the attached sync.zip

  1. Create an empty sync folder
  2. Run learn-ocaml build serve --repo=demo-repository from master branch
  3. Create a user "Bar"
  4. Create a user "Baz"
  5. Open the teacher dashboard
  6. Add an assignment including both exercises (demo, demo2) and only users (Bar, <any future students>)
  7. Click on Apply
  8. Click on the assignment, remove exercise demo2
  9. Click on Apply

Expected behavior:

No response

learn-ocaml --version

No response

git describe --long --always --abbrev=40 --tags

v0.14.1-39-g48583ba4d1376ad006227d7b5ee1b9cfaf9ad8f7

What OS do you use?

GNU/Linux

What OS version/distribution do you use?

Debian

What browser(s) do you use with learn-ocaml?

Firefox, Chromium

What browser(s) version did you used to reproduce the issue?

Firefox

Screenshots (if need be):

No response

Additional context:

No response

@erikmd erikmd self-assigned this Aug 12, 2023
@erikmd
Copy link
Member Author

erikmd commented Aug 12, 2023

Good news, I believe I fully fixed these bugs; I'll open a PR just now.

erikmd added a commit to pfitaxel/learn-ocaml that referenced this issue Aug 12, 2023
* Refactor "Open"/"OpenAssg"… display code,
  Add function `is_open_assg_globally` in `Learnocaml_data`
  returning [> `Open | `OpenAssg | `Assigned | `Closed]

* Make invariants explicit in OCaml comments

Close ocaml-sf#558
@erikmd erikmd added this to the learn-ocaml 0.15.0 milestone Aug 12, 2023
erikmd added a commit to pfitaxel/learn-ocaml that referenced this issue Aug 25, 2023
* Refactor and fix "Open"/"Closed"/… display code,
  Put function `is_open_or_assigned_globally` in `Learnocaml_data`, returning
  ( GloballyOpen | GloballyOpenOrAssigned
  | GloballyClosedOrAssigned | GloballyClosed )

* Make invariants explicit in OCaml comments

Close ocaml-sf#534
Close ocaml-sf#558
erikmd added a commit to pfitaxel/learn-ocaml that referenced this issue Aug 25, 2023
* Refactor and fix "Open"/"Closed"/… display code,
  Put function `is_open_or_assigned_globally` in `Learnocaml_data`, returning
  ( GloballyOpen | GloballyOpenOrAssigned
  | GloballyClosedOrAssigned | GloballyClosed )

* Make invariants explicit in OCaml comments

Close ocaml-sf#534
Close ocaml-sf#558
erikmd added a commit to pfitaxel/learn-ocaml that referenced this issue Aug 25, 2023
* Refactor and fix "Open"/"Closed"/… display code,
  Put function `is_open_or_assigned_globally` in `Learnocaml_data`, returning
  ( GloballyOpen | GloballyOpenOrAssigned
  | GloballyClosedOrAssigned | GloballyClosed )

* Make invariants explicit in OCaml comments

Close ocaml-sf#534
Close ocaml-sf#558
erikmd added a commit to pfitaxel/learn-ocaml that referenced this issue Aug 28, 2023
* Refactor and fix "Open"/"Closed"/… display code

* Add function `is_open_or_assigned_globally` in `Learnocaml_data` that returns
  ( GloballyOpen
  | GloballyOpenOrAssigned
  | GloballyClosedOrAssigned
  | GloballyClosed )

* Make invariants explicit in OCaml comments

* Add `check…` and `fix…` functions in `Learnocaml_data.Exercise.Status`
  to assert if the (assignments map, default) comply with the invariants
  (a false result means that there is at least one Open and one Closed)

Close ocaml-sf#534
Close ocaml-sf#558
erikmd added a commit to pfitaxel/learn-ocaml that referenced this issue Aug 28, 2023
* Refactor and fix "Open"/"Closed"/… display code

* Add function `is_open_or_assigned_globally` in `Learnocaml_data` that returns
  ( GloballyOpen
  | GloballyOpenOrAssigned
  | GloballyClosedOrAssigned
  | GloballyClosed )

* Make invariants explicit in OCaml comments

* Add `check…` and `fix…` functions in `Learnocaml_data.Exercise.Status`
  to assert if the (assignments map, default) comply with the invariants
  (a false result means that there is at least one Open and one Closed)

Close ocaml-sf#534
Close ocaml-sf#558
erikmd added a commit to pfitaxel/learn-ocaml that referenced this issue Sep 10, 2023
* Refactor and fix "Open"/"Closed"/… display code

* Add function `is_open_or_assigned_globally` in `Learnocaml_data` that returns
  ( GloballyOpen
  | GloballyOpenOrAssigned
  | GloballyClosedOrAssigned
  | GloballyClosed )

* Make invariants explicit in OCaml comments

* Add `check…` and `fix…` functions in `Learnocaml_data.Exercise.Status`
  to assert if the (assignments map, default) comply with the invariants
  (a false result means that there is at least one Open and one Closed)

Close ocaml-sf#534
Related: ocaml-sf#558
erikmd added a commit that referenced this issue Sep 15, 2023
fix(teacher_tab): partly fix Open/Close handling w.r.t. Assignments

Close #534
Related: #558
erikmd added a commit to pfitaxel/learn-ocaml that referenced this issue Oct 28, 2023
Following TDD: 4 test cases fail, reproducing ocaml-sf#558
erikmd added a commit to pfitaxel/learn-ocaml that referenced this issue Oct 28, 2023
Following TDD: 4 test cases fail, reproducing ocaml-sf#558
erikmd added a commit to pfitaxel/learn-ocaml that referenced this issue Oct 28, 2023
Following TDD: 4 test cases fail, reproducing ocaml-sf#558
erikmd added a commit to pfitaxel/learn-ocaml that referenced this issue Oct 28, 2023
Now, removing an exercise/student/future_students from an assignment
does not yield an exo with some GloballyInconsistent status anymore.

Close ocaml-sf#558
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment