Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
f4611071
Commit
f4611071
authored
Mar 27, 2014
by
Alan Boudreault
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix student data is per mentoring, not shared
parent
b3d47cb7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
3 deletions
+55
-3
mentoring/light_children.py
+2
-1
mentoring/mentoring.py
+8
-1
mentoring/migrations/0005_auto__chg_field_lightchild_name.py
+44
-0
mentoring/models.py
+1
-1
No files found.
mentoring/light_children.py
View file @
f4611071
...
@@ -302,11 +302,12 @@ class LightChild(Plugin, LightChildrenMixin):
...
@@ -302,11 +302,12 @@ class LightChild(Plugin, LightChildrenMixin):
student_id
=
self
.
xmodule_runtime
.
anonymous_student_id
student_id
=
self
.
xmodule_runtime
.
anonymous_student_id
course_id
=
self
.
xmodule_runtime
.
course_id
course_id
=
self
.
xmodule_runtime
.
course_id
url_name
=
"
%
s-
%
s"
%
(
self
.
xblock_container
.
url_name
,
name
)
lightchild_data
,
created
=
LightChildModel
.
objects
.
get_or_create
(
lightchild_data
,
created
=
LightChildModel
.
objects
.
get_or_create
(
student_id
=
student_id
,
student_id
=
student_id
,
course_id
=
course_id
,
course_id
=
course_id
,
name
=
name
,
name
=
url_
name
,
)
)
return
lightchild_data
return
lightchild_data
...
...
mentoring/mentoring.py
View file @
f4611071
...
@@ -179,12 +179,19 @@ class MentoringBlock(XBlockWithLightChildren):
...
@@ -179,12 +179,19 @@ class MentoringBlock(XBlockWithLightChildren):
xml_content
=
submissions
[
'xml_content'
]
xml_content
=
submissions
[
'xml_content'
]
try
:
try
:
etree
.
parse
(
StringIO
(
xml_content
))
xml
=
etree
.
parse
(
StringIO
(
xml_content
))
root
=
xml
.
getroot
()
self
.
url_name
=
root
.
attrib
[
'url_name'
]
except
etree
.
XMLSyntaxError
as
e
:
except
etree
.
XMLSyntaxError
as
e
:
response
=
{
response
=
{
'result'
:
'error'
,
'result'
:
'error'
,
'message'
:
e
.
message
'message'
:
e
.
message
}
}
except
KeyError
as
e
:
response
=
{
'result'
:
'error'
,
'message'
:
'mentoring "url_name" attribute is missing'
}
else
:
else
:
response
=
{
response
=
{
'result'
:
'success'
,
'result'
:
'success'
,
...
...
mentoring/migrations/0005_auto__chg_field_lightchild_name.py
0 → 100644
View file @
f4611071
# -*- coding: utf-8 -*-
import
datetime
from
south.db
import
db
from
south.v2
import
SchemaMigration
from
django.db
import
models
class
Migration
(
SchemaMigration
):
def
forwards
(
self
,
orm
):
# Changing field 'LightChild.name'
db
.
alter_column
(
'mentoring_lightchild'
,
'name'
,
self
.
gf
(
'django.db.models.fields.CharField'
)(
max_length
=
100
))
def
backwards
(
self
,
orm
):
# Changing field 'LightChild.name'
db
.
alter_column
(
'mentoring_lightchild'
,
'name'
,
self
.
gf
(
'django.db.models.fields.CharField'
)(
max_length
=
50
))
models
=
{
'mentoring.answer'
:
{
'Meta'
:
{
'unique_together'
:
"(('student_id', 'course_id', 'name'),)"
,
'object_name'
:
'Answer'
},
'course_id'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'50'
,
'db_index'
:
'True'
}),
'created_on'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now_add'
:
'True'
,
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified_on'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now'
:
'True'
,
'blank'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'50'
,
'db_index'
:
'True'
}),
'student_id'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'32'
,
'db_index'
:
'True'
}),
'student_input'
:
(
'django.db.models.fields.TextField'
,
[],
{
'default'
:
"''"
,
'blank'
:
'True'
})
},
'mentoring.lightchild'
:
{
'Meta'
:
{
'unique_together'
:
"(('student_id', 'course_id', 'name'),)"
,
'object_name'
:
'LightChild'
},
'course_id'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'50'
,
'db_index'
:
'True'
}),
'created_on'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now_add'
:
'True'
,
'blank'
:
'True'
}),
'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'modified_on'
:
(
'django.db.models.fields.DateTimeField'
,
[],
{
'auto_now'
:
'True'
,
'blank'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
,
'db_index'
:
'True'
}),
'student_data'
:
(
'django.db.models.fields.TextField'
,
[],
{
'default'
:
"''"
,
'blank'
:
'True'
}),
'student_id'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'32'
,
'db_index'
:
'True'
})
}
}
complete_apps
=
[
'mentoring'
]
\ No newline at end of file
mentoring/models.py
View file @
f4611071
...
@@ -61,7 +61,7 @@ class LightChild(models.Model):
...
@@ -61,7 +61,7 @@ class LightChild(models.Model):
app_label
=
'mentoring'
app_label
=
'mentoring'
unique_together
=
((
'student_id'
,
'course_id'
,
'name'
),)
unique_together
=
((
'student_id'
,
'course_id'
,
'name'
),)
name
=
models
.
CharField
(
max_length
=
5
0
,
db_index
=
True
)
name
=
models
.
CharField
(
max_length
=
10
0
,
db_index
=
True
)
student_id
=
models
.
CharField
(
max_length
=
32
,
db_index
=
True
)
student_id
=
models
.
CharField
(
max_length
=
32
,
db_index
=
True
)
course_id
=
models
.
CharField
(
max_length
=
50
,
db_index
=
True
)
course_id
=
models
.
CharField
(
max_length
=
50
,
db_index
=
True
)
student_data
=
models
.
TextField
(
blank
=
True
,
default
=
''
)
student_data
=
models
.
TextField
(
blank
=
True
,
default
=
''
)
...
...
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