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

Add annotation tool & migrate to JS in Thyme Player #533

Merged
merged 307 commits into from
Mar 31, 2024
Merged

Conversation

Frodo161
Copy link
Collaborator

@Frodo161 Frodo161 commented Aug 23, 2023

This branch adds the feature to add annotations to the video timeline. They can be used for giving feedback to the teacher, for getting help, for publishing something directly in the video comments or - simply - to make personal notes.

By default students can create annotations on the video timeline. Click on the button next to the speed control to open a dialogue.

image

Enter the text for your annotation (you can use Latex!), choose a color and select the category. You can publish the content directly as a comment and - if the teacher enabled this feature - make your annotation visible for the teacher. If the teacher entered an "emergency-link" (see below) and if you choose "content" as category and then "definition" the dialogue will give you a link for further help.

Markers will appear on the video timeline once you click on "Save". If you click on one of them their content will be shown in the interactive area on the right.

2

To see the annotations of students (which are marked as "visible for teacher") the teacher has to activate the emergency button on the lecture edit page (comments).

3

If it is (not) activated there is still the posibility to (de)activate it for each single video. By default the option "inherit from lecture" is selected.

4

Go again to the lecture edit page (preferences this time). There you can enter links (or select a lecture) which is shown to the students as "emergency-link", if they have problems with understanding a definition.

5

To see the feedback of the student, teachers now have the "feedback player" which can be accessed on the media edit page (where the video was uploaded). In this very simple player, the teacher sees all the annotations (that are marked as "visible for teacher") together with a heatmap. The teacher can (de)select the categories of annotations that are shown to him at the bottom of the video.

Mistake annotations are slightly bigger than other annotations and are not included in the calculation of the heatmap!

6

@Splines
Copy link
Member

Splines commented Aug 23, 2023

See my first review on the closed branch here: #512

Obsolete since I've copied the contents from the other branch over to here for transparency.

@codecov

This comment was marked as off-topic.

Copy link
Member

@Splines Splines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty cool to play around with the new feature. Some first remarks referring to the UI.

Note that I've copied this first review from here. Now, we have everything on this new PR and you can safely ignore the old one #512.

config/locales/en.yml Show resolved Hide resolved
config/locales/de.yml Outdated Show resolved Hide resolved
app/assets/stylesheets/thyme.scss Outdated Show resolved Hide resolved
app/views/annotations/_form.html.erb Outdated Show resolved Hide resolved
Copy link
Member

@Splines Splines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm by far not yet finished with the code review, here some more remarks as intermediate result. Please make sure you have rubocop locally installed, so that it can show you some code suggestions. Otherwise, it's tedious that I have to open my editor, see what rubocop says, and copy it in here as comment. Note it's only responsible for Ruby files, not .erb files, for those you can install an ERB linter (which is not working very well for me in VSCode, will have to experiment a bit more with that).

Locally, I've slightly changed the .rubocop.yml file, see it here. It just adds some more excludes, so that one can focus on relevant things.

pdfcomprezzor Outdated Show resolved Hide resolved
app/views/annotations/edit.coffee Outdated Show resolved Hide resolved
app/views/annotations/get_marker.coffee Outdated Show resolved Hide resolved
app/views/annotations/update.coffee Outdated Show resolved Hide resolved
app/views/layouts/feedback.html.erb Outdated Show resolved Hide resolved
app/views/media/feedback.html.erb Outdated Show resolved Hide resolved
config/locales/de.yml Outdated Show resolved Hide resolved
app/controllers/annotations_controller.rb Outdated Show resolved Hide resolved
app/controllers/annotations_controller.rb Outdated Show resolved Hide resolved
Copy link
Member

@Splines Splines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now, some parts a hard to review in this PR due to the conversion of coffeescript to JS (which I indeed asked you to do). However, this PR would be more manageable if just the annotation-tool-related coffeescript lines would be converted to JS. Note that I say "lines", not "files". For example thyme.js is pretty big right now and GitHub shows me that a lot of new lines have been added. It is difficult to distinguish between lines that are really new regarding the annotation tool or lines that are just "new" as they were converted by the online decaffeinater.

My proposal is as follows:

  • Keep the converted JS files somewhere on your PC locally for a later PR (or just save the commit hash right now, so we can jump back to these file later on).
  • ⚠Outsource your annotation-tool specific javascript code to new .js files, e.g. thyme_annotations.js. Restore the old .coffeescript files like thyme.coffeescript.
  • In a future PR named "Decaffeinate project (Coffeescript to JavaScript)", we can then bundle the annoying "get rid of CoffeeScript" changes together and fix things that the decaffeinater does not perfect manually, but in many files at once. This "de-clutters" this PR which should only consider things related to the annotation tool and not some old stuff from other files.

I know this is a bit extra-work, but I think it's worth it.

Note I also fell prey to decaffeination, e.g. here, however there it's really just one file with 24 lines of code, not huge files.

app/views/annotations/_form.html.erb Outdated Show resolved Hide resolved
app/views/annotations/_form.html.erb Show resolved Hide resolved
app/assets/javascripts/thyme.js Outdated Show resolved Hide resolved
app/assets/javascripts/thyme.js Outdated Show resolved Hide resolved
app/assets/javascripts/thyme.js Outdated Show resolved Hide resolved
@Splines Splines mentioned this pull request Aug 27, 2023
Splines added 21 commits March 19, 2024 23:53
Also fixed positioning of other elements on the bottom bar.
This is the new labeling:
-1: inherit from lecture
0: disabled
1: enabled

Beforehand it was:
-1: disabled
0: inherit from lecture
1: enabled

However, I think it makes more sense to have 0/1 for disabled/enabled
and leave the -1 for the "inherit" use case.

Also, the "share annotation with lecturer" feature is now enabled by
default for all lectures.
Copy link
Member

@Splines Splines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally, after a long ride, I approve this PR.

To be honest, +4,677 code additions and -1,116 code deletions have shown me why huge pull requests like this one are frowned upon. It's just not manageable. Even with a new feature, there's always a way to break things down into smaller pieces. And there's no need for one PR to equal one release, e.g. one strategy could have been to create smaller PRs and merge them into the annotation-tool branch one step at a time, then later have a big annotation-tool to dev PR, but you have already gone through all the code in smaller PRs.

Hindsight is easier than foresight, of course. But I hope we learn our lessons from this PR. It's a sign if even the GitHub UI takes years to load the Git diff in the Files changed tab.


Despite all this: the new annotation feature is great and I'm really thrilled to get it shipped soon. With such a beast of a PR, I wasn't able to review every single line of code. The bigger picture is fine with me, but I wouldn't stake my life on the annotation tool not including any bugs. For sure, there will be some, but I'm sure we can tackle them quickly. The new Ruby and JS linters also assure code quality and looking at the code, the new modularized thyme player is really a big step forward away from coffeescript, thanks a lot @Frodo161 for your efforts!

I will merge this PR soon into dev, the last stage before we hit production ;)

@Splines Splines changed the title Annotation tool Add annotation tool & use JS for thyme player Mar 30, 2024
@Splines Splines changed the title Add annotation tool & use JS for thyme player Add annotation tool & migrate to JS in Thyme Player Mar 30, 2024
@Splines Splines merged commit ac7808f into dev Mar 31, 2024
3 checks passed
@Splines Splines deleted the annotation-tool branch March 31, 2024 18:12
@Splines Splines mentioned this pull request Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants