-
Notifications
You must be signed in to change notification settings - Fork 289
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
🪲Only show programs that has been modified in Overview of programs per adventure #5162
Conversation
…o adventures_save
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jpelay , great work!! I had the following error with a teacher adventure, but after resetting local db, it worked again.
I just wanna share my thoughts on the code. All works fine and all for loops are plausible. Just the one that you go through each charecter within the code is a bit of a hassle! And if the code is long, you can imagine the time complexity of this nested for loop would grow exponentially! So, why not doing it with reg?
Another suggestion is about how you decide whether there's a difference! Your decision is based on the charecter level and if there's 10 chars different, then you say they can modify. What if they just changed the line orders without adding anything new for instance? Do you know https://docs.python.org/3/library/difflib.html? Especially the sequenceMatcher! This way instead of relying on chars being changed from position, we rely on similarity score!
Hi! I did it this way in case there was weird nesting inside the adventures, I did it this way to make sure we parse it properly.
I think this a worth suggestion!!! I implemented it and turned to be a lot better that just doing char diffs! I put an arbitrary value of 0.95 that I don't know if is too strict or not. Perhaps should we include a clause that says that if the original snippet had a underscore and the student filled them, it should be saved? |
I like that idea, but I am not sure it is worth the hassle of implementing it. Shall we open an issue and discuss it separately? (we can ask a teacher too). |
We agreed in the meeting to try to implement the underscore check into this PR after all! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be merged if we add the underscore check
Ready for review again! |
website/statistics.py
Outdated
can_save = False | ||
return can_save | ||
|
||
def has_placeholder(code): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your forgot self!
website/statistics.py
Outdated
@@ -267,10 +268,14 @@ def is_program_modified(self, program, full_adventures, teacher_adventures): | |||
can_save = True | |||
for snippet in adventure_snippets: | |||
seq_match = SequenceMatcher(None, snippet, student_code) | |||
if seq_match.ratio() > 0.95: | |||
# Allowing a difference of more than 10% or the student filled the placeholders | |||
if seq_match.ratio() > 0.95 or (not self.has_placeholder(student_code) and self.has_placeholder(snippet)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i tested it with the restaurant adventure in level 1, and i can't seem the sutdent's progress still! The function is returning False for both snippets!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right!! It should work now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool and it does:)
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork). |
Modifies the way we choose if a program is suitable for having a tick mark in the Overview of programs per adventure table.
The process is basically this:
Fixes #5161
How to test