-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
LibraryContent - Display content from a library in a course (SOL-5, SOL-6, SOL-7, SOL-8, SOL-117) #6155
LibraryContent - Display content from a library in a course (SOL-5, SOL-6, SOL-7, SOL-8, SOL-117) #6155
Conversation
Thanks for the pull request, @e-kolpakov! I've created OSPR-260 to keep track of it in JIRA. JIRA is a place for product owners to prioritize feature reviews by the engineering development teams. Feel free to add as much of the following information to the ticket:
All technical communication about the code itself will still be done via the Github pull request interface. As a reminder, our process documentation is here. |
This is a WIP for some time as there are some improvements to be done (e.g. bokchoy tests), so submitting for preliminary review and a place to host conversations regarding. |
|
||
|
||
@XBlock.wants('user') | ||
class LibraryContentDescriptor(LibraryContentFields, MakoModuleDescriptor, XmlDescriptor, StudioEditableDescriptor): |
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.
@cpennington this library content block is implemented as an XModule now, since it was initially implemented like so. I've tried converting it to a XBlock and had some difficulties, mainly due to high coupling to XModule ecosystem (MakoModuleDescriptor
, StudioEditableDescriptor
)
So the questions are:
- Are there any existing helpers similar to
MetadataOnlyEditingDescriptor
for XBlocks? As of now this LibraryContentModule does not use it directly, but essentially do exactly the same thing. - If it's not, what is an expected way to handle studio edits? I believe having custom js +
studio_submit
XBlock.handler
is a common practice, but it looks tedious to reimplement it for every single XBlock. Are there any shortcuts?
|
||
library_container.save_settings() | ||
|
||
self.assertIn(expected_text, library_container.header_text) |
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 don't like the way how assertion is done here. It's better tested if assertion against XBlock extracted from modulestore is done. But this would couple acceptance tests to modulestore, which is not the case now (or at least it looks like acceptance tests are abstracted from modulestore concept).
So, if it's ok to couple tests to modulestore and it's possible to use modulestore from tests level - this test can (and should) be rewritten to assert against XBlock instance, rather than displayed text.
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 don't think acceptance tests should be coupled to the modulestore. The point is to test the whole workflow "as a user". I would expect testing of xblock internal state to occur at the unit test level.
Yes, the test will change if the error text changes. But it should-- the point is to test what the user is seeing.
bac6ee5
to
e508ae4
Compare
from django.utils.translation import ugettext as _ | ||
from django.core.urlresolvers import reverse | ||
%> | ||
<div class="xblock-header-secondary"> |
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 can check in with @andy-armstrong in person, but my understanding was that there already is an existing .xblock-header / .xblock-message area we could reuse for this message? Just in case we do I wanted to add a comment while skimming through this.
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.
Sorry, I just checked the sandbox to see where this is located. There may be another pull request to resolve this, but our tentative plan was to move in the "up to date" and "updates" messages into the editor modal ( reference: http://invis.io/9X1PRVSGV) and validation messages to use the latest Studio patterns (reference: http://invis.io/BK1RLKQAX).
If there is another pull request feel free to ignore this comment! Thanks!
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.
Yep, we have another PR coming soon that will address those changes (I think it's based on our internal PR 19).
b7c340b
to
c87b2ac
Compare
e508ae4
to
9bac8cb
Compare
c87b2ac
to
72e0c2c
Compare
7afa32e
to
f85f962
Compare
This is rebased and is ready for a review. Please note the "Author Concerns" in the description before reviewing. All tests/quality should be passing, but something is wrong with Jenkins at the moment, and it is showing everything failing due to @cpennington Can you review the XBlock? @explorerleslie @cahrens Can you review the Studio editing portion of the XBlock? CC @antoviaque |
Sandbox updated with the latest code from the branch: http://content-libraries.sandbox.opencraft.com:18010/ |
Need to define a user-friendly display name on the library block (not library_content). Can just a default value for the display_name property. Note also that the messages you are showing (not configured, out of date, etc.) are not consistent with how our validation messages are shown. Use the existing validation framework (I linked to an example below). |
from django.core.urlresolvers import reverse | ||
%> | ||
<div class="xblock-header-secondary"> | ||
% if library_status == LibraryStatus.OK: |
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.
Use the existing validation framework. All you need to do is extend "validate" and return messages. The rendering will be done for you in a way that is consistent with other xblocks.
For an example, see https://github.com/edx/edx-platform/blob/master/common/lib/xmodule/xmodule/split_test_module.py#L523
I would prefer you not check in this HTML and then remove it. So if you have a separate PR that does the validation (I just finally saw the comments above...), go ahead and combine it with this PR. That is, combine the notification part of the PR only. Note that even the "This component is out of date" message can be replaced by a notification message-- you can register actions.
When you first specify the library, you get the message "This component is out of date". Why? It should sync up immediately with what is in the library, and I would expect to only get that message later if the library subsequently changes. |
Have you verified that Preview of draft content works properly? I don't think your sandbox is properly configured for Preview. |
Have you verified (or do you have a story for it) that grading works properly? That is, that the student is only graded on the problems he/she sees? |
@@ -32,6 +32,10 @@ class StudentModule(models.Model): | |||
MODULE_TYPES = (('problem', 'problem'), | |||
('video', 'video'), | |||
('html', 'html'), | |||
('course', 'course'), |
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.
Why adding course, chapter, and sequential? Is there any performance hit?
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 added those types because I saw that in practice, they were already present in StudentModule
anyways (to store the position
field). This has no performance impact and only fixes the UI in the Django admin app.
BTW, the LMS team may want to just remove this enum completely, as it seems that almost any type of module is now stored in StudentModule and this enum is perhaps vestigial 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.
Yeah, we should just remove this list.
Thanks @cptvitamin. BTW for now we are just merging to a feature branch and I believe we will have another chance to review everything when the feature branch gets merged to master. |
@bradenmacdonald - Looked great to me, thanks for all the updates! Very glad we added in the library location ID section to the sidebar as well! (cc'ed @catong) 👍 from me. |
@bradenmacdonald Nice work! Thanks for switching over to use the existing warning patterns and adding in the Library ID block in the sidebar. I had a few UX level questions, which may be out of the scope of this work, but I think it would be good to make these changes in the near future if possible:
None of these are blockers, but I think if we can do any of these, it will help the users. 👍 |
@@ -334,6 +342,45 @@ def children(self): | |||
return [descendant for descendant in descendants if descendant.locator not in grand_locators] | |||
|
|||
@property | |||
def has_validation_message(self): |
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.
Thanks for the heads up!
@frrrances Thanks for the feedback. The third thing has already been implemented and we will be opening a PR and merging it soon. The first two things are outside the scope of this PR, but I will add them to our list - they are both easy changes. |
82b7bb8
to
0cc3b33
Compare
…course-block LibraryContent - Display content from a library in a course (SOL-5, SOL-6, SOL-7, SOL-8, SOL-117)
Rebased and merged. Thanks to everyone who helped review and improve this PR! |
@frrrances - Just as a follow up, the first item in your list is currently scheduled for inclusion in https://openedx.atlassian.net/browse/SOL-80, which should be merged in the coming week or more. The second "+ Add Component" scroll to is something I can create a backlog story for now (https://openedx.atlassian.net/browse/SOL-195), though I'm hopeful in the short term that the pagination and expand/collapse functionality lessens the scrolling issue. Thanks for your review and feedback on this! (Also thanks to @bradenmacdonald and @e-kolpakov!) |
…course-block LibraryContent - Display content from a library in a course (SOL-5, SOL-6, SOL-7, SOL-8, SOL-117)
Instructions to test:
"library_content"
to advanced_modules.library-v1:ProblemX+PR0B
. (It's in the URL when you go to the library in studio). Hit Save.Author concerns: