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
3118a5de
Commit
3118a5de
authored
Dec 04, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1852 from cpennington/more-db-error-fixes
Add recovery command
parents
c7ac4100
b9926a2f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
106 additions
and
0 deletions
+106
-0
common/djangoapps/student/management/commands/recover_truncated_anonymous_ids.py
+69
-0
common/djangoapps/student/migrations/0030_auto__chg_field_anonymoususerid_anonymous_user_id.py
+2
-0
lms/templates/instructor/staff_grading.html
+7
-0
lms/templates/open_ended_problems/combined_notifications.html
+7
-0
lms/templates/open_ended_problems/open_ended_flagged_problems.html
+7
-0
lms/templates/open_ended_problems/open_ended_problems.html
+7
-0
lms/templates/peer_grading/peer_grading.html
+7
-0
No files found.
common/djangoapps/student/management/commands/recover_truncated_anonymous_ids.py
0 → 100644
View file @
3118a5de
"""
Generate sql commands to fix truncated anonymous student ids in the ORA database
"""
import
sys
from
django.core.management.base
import
NoArgsCommand
from
student.models
import
AnonymousUserId
,
anonymous_id_for_user
class
Command
(
NoArgsCommand
):
help
=
__doc__
def
handle_noargs
(
self
,
**
options
):
"""
Reads a list of ids (newline separated) from stdin, and
dumps sql queries to run on the ORA database to fix those ids
from their truncated form to the full 32 character change.
The following query will generate the list of ids needed to be fixed
from the ORA database:
SELECT student_id FROM peer_grading_calibrationhistory WHERE LENGTH(student_id) = 16
UNION SELECT student_id FROM controller_submission WHERE LENGTH(student_id) = 16
UNION SELECT student_id FROM metrics_timing WHERE LENGTH(student_id) = 16
UNION SELECT student_id FROM metrics_studentcourseprofile WHERE LENGTH(student_id) = 16
UNION SELECT student_id FROM metrics_studentprofile WHERE LENGTH(student_id) = 16;
"""
ids
=
[
line
.
strip
()
for
line
in
sys
.
stdin
]
old_ids
=
AnonymousUserId
.
objects
.
raw
(
"""
SELECT *
FROM student_anonymoususerid_temp_archive
WHERE anonymous_user_id IN ({})
"""
.
format
(
','
.
join
([
'
%
s'
]
*
len
(
ids
))),
ids
)
for
old_id
in
old_ids
:
new_id
=
anonymous_id_for_user
(
old_id
.
user
,
old_id
.
course_id
)
for
table
in
(
'peer_grading_calibrationhistory'
,
'controller_submission'
,
'metrics_timing'
):
self
.
stdout
.
write
(
"UPDATE {} "
"SET student_id = '{}' "
"WHERE student_id = '{}';
\n
"
.
format
(
table
,
new_id
,
old_id
.
anonymous_user_id
,
)
)
self
.
stdout
.
write
(
"DELETE FROM metrics_studentcourseprofile "
"WHERE student_id = '{}' "
"AND problems_attempted = 0;
\n
"
.
format
(
old_id
.
anonymous_user_id
)
)
self
.
stdout
.
write
(
"DELETE FROM metrics_studentprofile "
"WHERE student_id = '{}' "
"AND messages_sent = 0 "
"AND messages_received = 0 "
"AND average_message_feedback_length = 0 "
"AND student_is_staff_banned = 0 "
"AND student_cannot_submit_more_for_peer_grading = 0;
\n
"
.
format
(
old_id
.
anonymous_user_id
)
)
common/djangoapps/student/migrations/0030_auto__chg_field_anonymoususerid_anonymous_user_id.py
View file @
3118a5de
...
...
@@ -27,6 +27,8 @@ class Migration(SchemaMigration):
# Changing field 'AnonymousUserId.anonymous_user_id'
db
.
alter_column
(
'student_anonymoususerid'
,
'anonymous_user_id'
,
self
.
gf
(
'django.db.models.fields.CharField'
)(
max_length
=
16
,
unique
=
True
))
db
.
execute
(
"DROP TABLE student_anonymoususerid_temp_archive"
)
models
=
{
'auth.group'
:
{
'Meta'
:
{
'object_name'
:
'Group'
},
...
...
lms/templates/instructor/staff_grading.html
View file @
3118a5de
...
...
@@ -30,6 +30,13 @@
"to restore their visibility. Rest assured, no student "
"data has been lost.")}
</b>
<br>
<b>
${_("We have recovered the majority of student responses. "
"Those responses submitted while the issue was active are "
"temporarily unavailable, but we are working on restoring "
"them, and they should be visible again shortly.")}
</b>
</div>
<br>
<hr>
...
...
lms/templates/open_ended_problems/combined_notifications.html
View file @
3118a5de
...
...
@@ -24,6 +24,13 @@
"to restore their visibility. Rest assured, no student "
"data has been lost.")}
</b>
<br>
<b>
${_("We have recovered the majority of student responses. "
"Those responses submitted while the issue was active are "
"temporarily unavailable, but we are working on restoring "
"them, and they should be visible again shortly.")}
</b>
</div>
<br>
<hr>
...
...
lms/templates/open_ended_problems/open_ended_flagged_problems.html
View file @
3118a5de
...
...
@@ -27,6 +27,13 @@
"to restore their visibility. Rest assured, no student "
"data has been lost.")}
</b>
<br>
<b>
${_("We have recovered the majority of student responses. "
"Those responses submitted while the issue was active are "
"temporarily unavailable, but we are working on restoring "
"them, and they should be visible again shortly.")}
</b>
</div>
<br>
<hr>
...
...
lms/templates/open_ended_problems/open_ended_problems.html
View file @
3118a5de
...
...
@@ -24,6 +24,13 @@
"to restore their visibility. Rest assured, no student "
"data has been lost.")}
</b>
<br>
<b>
${_("We have recovered the majority of student responses. "
"Those responses submitted while the issue was active are "
"temporarily unavailable, but we are working on restoring "
"them, and they should be visible again shortly.")}
</b>
</div>
<br>
<hr>
...
...
lms/templates/peer_grading/peer_grading.html
View file @
3118a5de
...
...
@@ -23,6 +23,13 @@ criteria.{end_li_tag}
"to restore their visibility. Rest assured, no student "
"data has been lost.")}
</b>
<br>
<b>
${_("We have recovered the majority of student responses. "
"Those responses submitted while the issue was active are "
"temporarily unavailable, but we are working on restoring "
"them, and they should be visible again shortly.")}
</b>
</div>
<br>
<hr>
...
...
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