Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
9542b0a8
Commit
9542b0a8
authored
Sep 23, 2014
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Puts course listings in a sane order"
This reverts commit 1955aade36675289bdbc01554b6f74242754a746.
parent
45512442
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
59 deletions
+17
-59
common/djangoapps/student/tests/test_course_listing.py
+0
-1
common/djangoapps/student/views.py
+8
-18
common/test/acceptance/pages/lms/dashboard.py
+2
-2
common/test/acceptance/tests/test_lms.py
+6
-6
lms/djangoapps/courseware/models.py
+0
-6
lms/static/sass/multicourse/_dashboard.scss
+0
-22
lms/templates/dashboard.html
+1
-4
No files found.
common/djangoapps/student/tests/test_course_listing.py
View file @
9542b0a8
...
...
@@ -88,7 +88,6 @@ class TestCourseListing(ModuleStoreTestCase):
courses_list
=
list
(
get_course_enrollment_pairs
(
self
.
student
,
None
,
[]))
self
.
assertEqual
(
courses_list
,
[])
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
def
test_course_listing_errored_deleted_courses
(
self
):
"""
Create good courses, courses that won't load, and deleted courses which still have
...
...
common/djangoapps/student/views.py
View file @
9542b0a8
"""
Student Views
"""
import
datetime
import
logging
import
re
import
uuid
import
time
import
json
from
collections
import
defaultdict
from
datetime
import
datetime
from
pytz
import
UTC
from
django.conf
import
settings
...
...
@@ -42,7 +42,6 @@ from edxmako.shortcuts import render_to_response, render_to_string
from
mako.exceptions
import
TopLevelLookupException
from
course_modes.models
import
CourseMode
from
student.models
import
(
Registration
,
UserProfile
,
PendingNameChange
,
PendingEmailChange
,
CourseEnrollment
,
unique_id_for_user
,
...
...
@@ -65,7 +64,6 @@ from collections import namedtuple
from
courseware.courses
import
get_courses
,
sort_by_announcement
from
courseware.access
import
has_access
from
courseware.models
import
course_modified_times
from
django_comment_common.models
import
Role
...
...
@@ -228,7 +226,7 @@ def single_course_reverification_info(user, course, enrollment): # pylint: disa
ReverifyInfo: (course_id, course_name, course_number, date, status)
OR, None: None if there is no re-verification info for this enrollment
"""
window
=
MidcourseReverificationWindow
.
get_window
(
course
.
id
,
datetime
.
now
(
UTC
))
window
=
MidcourseReverificationWindow
.
get_window
(
course
.
id
,
datetime
.
datetime
.
now
(
UTC
))
# If there's no window OR the user is not verified, we don't get reverification info
if
(
not
window
)
or
(
enrollment
.
mode
!=
"verified"
):
...
...
@@ -246,8 +244,6 @@ def get_course_enrollment_pairs(user, course_org_filter, org_filter_out_set):
Get the relevant set of (Course, CourseEnrollment) pairs to be displayed on
a student's dashboard.
"""
pairs
=
[]
for
enrollment
in
CourseEnrollment
.
enrollments_for_user
(
user
):
course
=
modulestore
()
.
get_course
(
enrollment
.
course_id
)
if
course
and
not
isinstance
(
course
,
ErrorDescriptor
):
...
...
@@ -261,18 +257,12 @@ def get_course_enrollment_pairs(user, course_org_filter, org_filter_out_set):
elif
course
.
location
.
org
in
org_filter_out_set
:
continue
pairs
.
append
((
course
,
enrollment
)
)
yield
(
course
,
enrollment
)
else
:
log
.
error
(
"User {0} enrolled in {2} course {1}"
.
format
(
user
.
username
,
enrollment
.
course_id
,
"broken"
if
course
else
"non-existent"
))
## Sort pairs in order of courseware access. If I am actively using a course, it should bubble up to the top.
modified_times_map
=
course_modified_times
(
user
,
[
p
[
0
]
.
scope_ids
.
usage_id
for
p
in
pairs
])
def
key_function
(
x
):
return
modified_times_map
.
get
(
unicode
(
x
[
0
]
.
scope_ids
.
usage_id
),
datetime
.
min
)
pairs
.
sort
(
key
=
key_function
,
reverse
=
True
)
return
pairs
def
_cert_info
(
user
,
course
,
cert_status
):
"""
...
...
@@ -439,7 +429,7 @@ def complete_course_mode_info(course_id, enrollment):
mode_info
[
'show_upsell'
]
=
True
# if there is an expiration date, find out how long from now it is
if
modes
[
'verified'
]
.
expiration_datetime
:
today
=
datetime
.
now
(
UTC
)
.
date
()
today
=
datetime
.
datetime
.
now
(
UTC
)
.
date
()
mode_info
[
'days_for_upsell'
]
=
(
modes
[
'verified'
]
.
expiration_datetime
.
date
()
-
today
)
.
days
return
mode_info
...
...
@@ -1177,7 +1167,7 @@ def disable_account_ajax(request):
context
[
'message'
]
=
_
(
"Unexpected account status"
)
return
JsonResponse
(
context
,
status
=
400
)
user_account
.
changed_by
=
request
.
user
user_account
.
standing_last_changed_at
=
datetime
.
now
(
UTC
)
user_account
.
standing_last_changed_at
=
datetime
.
datetime
.
now
(
UTC
)
user_account
.
save
()
return
JsonResponse
(
context
)
...
...
@@ -1562,7 +1552,7 @@ def create_account(request, post_override=None): # pylint: disable-msg=too-many
if
do_external_auth
:
eamap
.
user
=
new_user
eamap
.
dtsignup
=
datetime
.
now
(
UTC
)
eamap
.
dtsignup
=
datetime
.
datetime
.
now
(
UTC
)
eamap
.
save
()
AUDIT_LOG
.
info
(
"User registered with external_auth
%
s"
,
post_vars
[
'username'
])
AUDIT_LOG
.
info
(
'Updated ExternalAuthMap for
%
s to be
%
s'
,
post_vars
[
'username'
],
eamap
)
...
...
@@ -1990,7 +1980,7 @@ def confirm_email_change(request, key): # pylint: disable=unused-argument
meta
=
u_prof
.
get_meta
()
if
'old_emails'
not
in
meta
:
meta
[
'old_emails'
]
=
[]
meta
[
'old_emails'
]
.
append
([
user
.
email
,
datetime
.
now
(
UTC
)
.
isoformat
()])
meta
[
'old_emails'
]
.
append
([
user
.
email
,
datetime
.
datetime
.
now
(
UTC
)
.
isoformat
()])
u_prof
.
set_meta
(
meta
)
u_prof
.
save
()
# Send it to the old email...
...
...
@@ -2110,7 +2100,7 @@ def accept_name_change_by_id(uid):
meta
=
u_prof
.
get_meta
()
if
'old_names'
not
in
meta
:
meta
[
'old_names'
]
=
[]
meta
[
'old_names'
]
.
append
([
u_prof
.
name
,
pnc
.
rationale
,
datetime
.
now
(
UTC
)
.
isoformat
()])
meta
[
'old_names'
]
.
append
([
u_prof
.
name
,
pnc
.
rationale
,
datetime
.
datetime
.
now
(
UTC
)
.
isoformat
()])
u_prof
.
set_meta
(
meta
)
u_prof
.
name
=
pnc
.
new_name
...
...
common/test/acceptance/pages/lms/dashboard.py
View file @
9542b0a8
...
...
@@ -20,8 +20,8 @@ class DashboardPage(PageObject):
return
self
.
q
(
css
=
'section.my-courses'
)
.
present
@property
def
courses_text
(
self
):
text_items
=
self
.
q
(
css
=
'section#my-courses
span.my-courses-title-label
'
)
.
text
def
c
urrent_c
ourses_text
(
self
):
text_items
=
self
.
q
(
css
=
'section#my-courses'
)
.
text
if
len
(
text_items
)
>
0
:
return
text_items
[
0
]
else
:
...
...
common/test/acceptance/tests/test_lms.py
View file @
9542b0a8
...
...
@@ -77,10 +77,10 @@ class LanguageTest(UniqueCourseTest):
self
.
dashboard_page
=
DashboardPage
(
self
.
browser
)
self
.
test_new_lang
=
'eo'
# This string is unicode for "ÇØÜRSÉS", which should appear in our Dummy Esperanto page
# This string is unicode for "Ç
ÜRRÉNT Ç
ØÜRSÉS", which should appear in our Dummy Esperanto page
# We store the string this way because Selenium seems to try and read in strings from
# the HTML in this format. Ideally we could just store the raw ÇÜRRÉNT ÇØÜRSÉS string here
self
.
c
ourses_text
=
u'
\xc7\xd6\xdc
RS
\xc9
S'
self
.
c
urrent_courses_text
=
u'
\xc7\xdc
RR
\xc9
NT
\xc7\xd6\xdc
RS
\xc9
S'
self
.
username
=
"test"
self
.
password
=
"testpass"
...
...
@@ -92,10 +92,10 @@ class LanguageTest(UniqueCourseTest):
# Change language to Dummy Esperanto
self
.
dashboard_page
.
change_language
(
self
.
test_new_lang
)
changed_text
=
self
.
dashboard_page
.
courses_text
changed_text
=
self
.
dashboard_page
.
c
urrent_c
ourses_text
# We should see the dummy-language text on the page
self
.
assertIn
(
self
.
courses_text
,
changed_text
)
self
.
assertIn
(
self
.
c
urrent_c
ourses_text
,
changed_text
)
def
test_language_persists
(
self
):
auto_auth_page
=
AutoAuthPage
(
self
.
browser
,
username
=
self
.
username
,
password
=
self
.
password
,
email
=
self
.
email
,
course_id
=
self
.
course_id
)
...
...
@@ -113,10 +113,10 @@ class LanguageTest(UniqueCourseTest):
self
.
dashboard_page
.
visit
()
changed_text
=
self
.
dashboard_page
.
courses_text
changed_text
=
self
.
dashboard_page
.
c
urrent_c
ourses_text
# We should see the dummy-language text on the page
self
.
assertIn
(
self
.
courses_text
,
changed_text
)
self
.
assertIn
(
self
.
c
urrent_c
ourses_text
,
changed_text
)
class
HighLevelTabTest
(
UniqueCourseTest
):
...
...
lms/djangoapps/courseware/models.py
View file @
9542b0a8
...
...
@@ -93,12 +93,6 @@ class StudentModule(models.Model):
return
unicode
(
repr
(
self
))
def
course_modified_times
(
user
,
ids
):
''' Returns the times when a given studentmodule was last modified.
'''
results
=
StudentModule
.
objects
.
filter
(
student
=
user
,
module_state_key__in
=
ids
)
.
values_list
(
'module_state_key'
,
'modified'
)
return
dict
(
results
)
class
StudentModuleHistory
(
models
.
Model
):
"""Keeps a complete history of state changes for a given XModule for a given
Student. Right now, we restrict this to problems so that the table doesn't
...
...
lms/static/sass/multicourse/_dashboard.scss
View file @
9542b0a8
...
...
@@ -308,28 +308,6 @@
margin-bottom
:
30px
;
}
// my courses title
.my-courses-title
{
@include
clearfix
();
}
.my-courses-title-label
{
display
:
inline-block
;
vertical-align
:
middle
;
width
:
flex-grid
(
6
,
9
);
}
.my-courses-title-description
{
@extend
%t-title7
;
display
:
inline-block
;
vertical-align
:
middle
;
width
:
flex-grid
(
3
,
9
);
text-transform
:
lowercase
;
text-align
:
right
;
letter-spacing
:
0
;
color
:
$lighter-base-font-color
;
}
.empty-dashboard-message
{
padding
:
60px
0px
;
text-align
:
center
;
...
...
lms/templates/dashboard.html
View file @
9542b0a8
...
...
@@ -291,10 +291,7 @@
<section
class=
"my-courses"
id=
"my-courses"
>
<header>
<h2
class=
"my-courses-title"
>
<span
class=
"my-courses-title-label"
>
${_("Courses")}
</span>
<span
class=
"my-courses-title-description"
>
${_("ordered by recent activity")}
</span>
</h2>
<h2>
${_("Current Courses")}
</h2>
</header>
% if len(course_enrollment_pairs) > 0:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment