Hiya,

I found that because Studio fetches the course list from the modulestore,
there was no good way to filter out archived courses, and so there wasn't
any performance advantage to serving the archived courses asynchronously.

Sorry for getting everyone's hopes up about asynchronous course and library
listings :(

TL;DR In all but the first use case listed below, all courses that the user
has access to are fetched from the modulestore, and we can't efficiently
query mongo with a date range.

   - Global Staff
   
<https://github.com/edx/edx-platform/blob/1592ee2b152dc226039fa2665374702cb7e01508/cms/djangoapps/contentstore/views/course.py#L645-L647>
with
   an org filter
   
<https://github.com/edx/edx-platform/blob/1592ee2b152dc226039fa2665374702cb7e01508/cms/djangoapps/contentstore/views/course.py#L379-L380>
    in the query string
   
<https://github.com/edx/edx-platform/blob/1592ee2b152dc226039fa2665374702cb7e01508/cms/djangoapps/contentstore/views/course.py#L479>
get
   to use CourseOverview.get_all_courses(org=...)
   
<https://github.com/edx/edx-platform/blob/1592ee2b152dc226039fa2665374702cb7e01508/cms/djangoapps/contentstore/views/course.py#L380>
   .
   I could filter those prior to fetching, with an OR'd django query filter.
   - Global staff members without an org query string query the modulestore
   
<https://github.com/edx/edx-platform/blob/1592ee2b152dc226039fa2665374702cb7e01508/cms/djangoapps/contentstore/views/course.py#L645-L647>
to
   get a list of CourseSummary
   
<https://github.com/edx/edx-platform/blob/fb36c7df6c7a96a1fbb4a7776a814ce59f98fd76/common/lib/xmodule/xmodule/course_module.py#L1387>
    objects.
   This model will be updated to include the end date and a has_ended() method,
   so they can be filtered after they're fetched.
   - Normal users
   
<https://github.com/edx/edx-platform/blob/1592ee2b152dc226039fa2665374702cb7e01508/cms/djangoapps/contentstore/views/course.py#L650>
iterate
   through a list of courses_keys they have roles in
   
<https://github.com/edx/edx-platform/blob/1592ee2b152dc226039fa2665374702cb7e01508/cms/djangoapps/contentstore/views/course.py#L418-L449>,
   and fetch a CourseDescriptor
   
<https://github.com/edx/edx-platform/blob/master/common/lib/xmodule/xmodule/course_module.py#L872>
from
   the modulestore.
   These already have a has_ended() method, so I can filter them after
   they're fetched.

The upshot is, I decided to just synchronously split the courses into two
lists -- Courses, and Archived Courses -- and simply render them to the
template.

cf https://github.com/edx/edx-platform/pull/15431

Cheers,
 --
Jill
@OpenCraft <http://opencraft.com/>

--
Jill
@OpenCraft
<http://opencraft.com/>

On Tue, Jun 27, 2017 at 3:30 PM, <[email protected]> wrote:

> In my excitement to use proper search filtering, I think I'm getting off
> track of the original issue..  Sorry about that!
>
> There's a few fundamental things that need to remain true with the
> implementation:
>
>    1. The main Course list on the Studio home page needs to be in sync
>    with the contentstore.
>    How do we keep from introducing cache syncing issues that would
>    disrupt what Course Authors can see in the main list?
>
>    2. Our client wants the Archived (i.e., past end date) courses to be
>    excluded from this main list.
>    Can this be achieved by excluding courses where has_ended()
>    
> <https://github.com/edx/edx-platform/blob/fb36c7df6c7a96a1fbb4a7776a814ce59f98fd76/common/lib/xmodule/xmodule/course_module.py#L1049>
>    == True, like we currently do with in-progress courses
>    
> <https://github.com/edx/edx-platform/blob/54eb9e84b4153c3a29b6f7064fee9808b4fe22d7/cms/djangoapps/contentstore/views/course.py#L522>
>    ?
>
>    3. Archived courses should still be accessible from the Studio home
>    page, so they can be re-run and referenced.
>    What's the best way to represent this in the GUI?
>
>    4. Loading the list of Archived courses on demand requires an
>    asynchronous endpoint to be added to Studio.
>    What's the best way to implement this asynchronous endpoint?
>    Can I just add a /search url to Studio which reference edx-search's
>    search.urls
>    <https://github.com/edx/edx-search/blob/master/search/urls.py> like
>    the LMS does
>    <https://github.com/edx/edx-platform/blob/master/lms/urls.py#L62-L63>,
>    and just use the existing  /search/course_discovery endpoint
>    
> <https://github.com/edx/edx-search/blob/003e1fcbf695ac893a11399456ebd80143720b16/search/api.py#L68>?
>    It looks like it could be expanded to filter by the Availability
>    property
>    
> <https://github.com/edx/course-discovery/blob/master/course_discovery/apps/course_metadata/models.py#L575>
>  that
>    already exists in the course metadata.
>    Does this mean I can do it without actually running the
>    course-discovery service?
>
> Any advice you can offer is welcome!
>
> --
> Jill
> @OpenCraft <http://opencraft.com/>
>
> --
> You received this message because you are subscribed to the Google Groups
> "General Open edX discussion" group.
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/edx-code/ee46d6cf-b4b7-4fd7-a159-2522c6991adf%40googlegroups.com
> <https://groups.google.com/d/msgid/edx-code/ee46d6cf-b4b7-4fd7-a159-2522c6991adf%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"General Open edX discussion" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/edx-code/CAMZ1At%2Bb%3D93Qke3U0XYau1OF4TxWVHLD1hDjPtCsZT7ou0ZcQw%40mail.gmail.com.

Reply via email to