Classroom alerts parser & update Classroom private activity parser. solves #304 #396
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Classroom alerts/activity parser (updates)
This pr reverts commit d93c9a4.
the commits reverted in that commit were intended to be the contents of this PR. When cleaning up my workspace in my IDE, it seems that I accidentally linked to https://github.com/TimMcCool/scratchattach/ instead of https://github.com/faretek1/scratchattach/
site.classroom.Classroom.activity
The parser for the private classroom activity has been updated to more accurately match the scratch website's HTML, since the 'empty' cases actually just relay onto the case below them.
site.session.Session.classroom_alerts
(solves #304)
The main feature of this PR is the implementation of the Classroom alert parser. The function for requesting to the scratch api was already implemented in #294, but the
site.classroom.Classroom.activity
would just return a list of JSON objects, which is not very helpful for the user.This is done with an edit to
enums.py
,classroom.py
, and a new filealerts.py
.Classroom alerts are implemented as the
EducatorAlert
dataclass,, with 9 attributes. These also have 3 getter methods:alert_type
for parsing/looking-up the 'type' attribute using an enum. This enum is used internally in themessage
gettermessage
for emulating Scratch's own display of the alert, e.g."Blockly by TimMcCool was censored"
target_object_title
for getting the title of the linked project/studio (if it's a comment or other stuff, returns None): used bymessage
appendix
there are still a few more things to do:
there are also a few
# todo: <...>
comments within the code, which cannot be done until certain conditions are met: