-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Feature generalized tips #1072
Feature generalized tips #1072
Conversation
end | ||
|
||
def assistant | ||
Mumukit::Assistant.parse(assistance_rules) |
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.
May cache this variable
middle_2: Also, %{tip}. | ||
ending_0: Finally, %{tip}. | ||
ending_1: Finally, %{tip}. | ||
ending_2: Finally, %{tip}. |
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 need to fix those newlines.
middle_2: Also, %{tip}. | ||
ending_0: Finally, %{tip}. | ||
ending_1: Finally, %{tip}. | ||
ending_2: Finally, %{tip}. |
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.
Also, a pt translation is missing
|
||
require_relative './assistant/rule' | ||
require_relative './assistant/message' | ||
require_relative './assistant/narrator' |
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.
This should be extracted to a gem, so that is can be used in bibliotheca to validate the rules format.
Also, validation methods are missing.
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.
BibliothecaApi should use those methods
when :submission_errored then Mumukit::Assistant::Rule::SubmissionErrored.new(message) | ||
when :submission_failed then Mumukit::Assistant::Rule::SubmissionFailed.new(message) | ||
when :submission_passed_with_warnings then Mumukit::Assistant::Rule::SubmissionPassedWithWarnings.new(message) | ||
else raise "Unsupported rule #{w}" |
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.
Code may be simplified with a little metaprogramming
def matches?(submission) | ||
submission.status.errored? | ||
end | ||
end |
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.
This should be split into several files.
@@ -25,6 +25,10 @@ | |||
teacher_info: 'an info', | |||
language: 'gobstones', | |||
solution: 'foo', | |||
assistance_rules: [ | |||
{when: :content_empty, then: 'remember to copy the code in the editor!'}, |
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.
We need to also add an editor for those rules in bibliotheca. Otherwise, this PR is pointless.
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.
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.
LGTM
lib/mumuki/laboratory/status/base.rb
Outdated
@@ -27,8 +27,10 @@ def errored? | |||
false | |||
end | |||
|
|||
# False if and only if this status | |||
# is `Mumuki::Laboratory::Status` |
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.
::Passed * ?
spec/models/assistant_spec.rb
Outdated
}, | ||
{ | ||
when: { error_contains: 'Unrecognized token %' }, | ||
then: 'Remeber you have to use `mod`, not `%`' |
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.
typo in Remember
lib/mumukit/assistant.rb
Outdated
@rules = rules | ||
end | ||
|
||
# Provides tips for the studen for the given submission, |
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.
@julian-berbel studen
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.
👏 👏 👏
In some point would it be useful to add one that checks if the solution contains certain words? Like the common typos?
spec/models/narrator_spec.rb
Outdated
let(:tips) { [ | ||
'check you have not mispelled `product`', | ||
'check that you are using composition', | ||
'remeber that `sum` must work with both `Int`s and `Float`s' |
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.
remeber again
app/helpers/application_helper.rb
Outdated
@@ -27,6 +27,14 @@ def corollary_box(with_corollary) | |||
end | |||
end | |||
|
|||
def assistance_box(assignment) | |||
if assignment.tips.present? | |||
%Q{<div class="mu-tips-box"> |
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.
@julian-berbel missing indentation
0da218d
to
5c1146c
Compare
4a5b051
to
6bce5b3
Compare
I like that! |
Fixes mumuki/mumuki-platform#318
Fixes #952
Fixes #358
Supersedes #961
Screenshot pending
Final rules spec is here: mumuki/mumuki-platform#318 (comment)