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
afd42fc1
Commit
afd42fc1
authored
Jan 30, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some image okay problems
parent
f3572c71
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
7 deletions
+15
-7
common/lib/xmodule/xmodule/combined_open_ended_module.py
+1
-1
common/lib/xmodule/xmodule/open_ended_image_submission.py
+12
-5
common/lib/xmodule/xmodule/openendedchild.py
+2
-1
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
afd42fc1
...
@@ -39,7 +39,7 @@ MAX_SCORE = 1
...
@@ -39,7 +39,7 @@ MAX_SCORE = 1
MAX_SCORE_ALLOWED
=
3
MAX_SCORE_ALLOWED
=
3
IS_SCORED
=
False
IS_SCORED
=
False
ACCEPT_FILE_UPLOAD
=
Tru
e
ACCEPT_FILE_UPLOAD
=
Fals
e
#Contains all reasonable bool and case combinations of True
#Contains all reasonable bool and case combinations of True
TRUE_DICT
=
[
"True"
,
True
,
"TRUE"
,
"true"
]
TRUE_DICT
=
[
"True"
,
True
,
"TRUE"
,
"true"
]
...
...
common/lib/xmodule/xmodule/open_ended_image_submission.py
View file @
afd42fc1
...
@@ -86,12 +86,19 @@ class ImageProperties(object):
...
@@ -86,12 +86,19 @@ class ImageProperties(object):
@param rgb: RGB tuple
@param rgb: RGB tuple
@return: Boolean true false
@return: Boolean true false
"""
"""
r
,
g
,
b
=
rgb
colors_okay
=
False
try
:
r
=
rgb
[
0
]
g
=
rgb
[
1
]
b
=
rgb
[
2
]
check_r
=
(
r
>
60
)
check_r
=
(
r
>
60
)
check_b
=
(
r
*
0.4
)
<
b
<
(
r
*
0.85
)
check_g
=
(
r
*
0.4
)
<
g
<
(
r
*
0.85
)
check_g
=
(
r
*
0.2
)
<
g
<
(
r
*
0.7
)
check_b
=
(
r
*
0.2
)
<
b
<
(
r
*
0.7
)
colors_okay
=
check_r
and
check_b
and
check_g
except
:
pass
return
c
heck_r
and
check_b
and
check_g
return
c
olors_okay
def
get_skin_ratio
(
self
):
def
get_skin_ratio
(
self
):
"""
"""
...
@@ -118,7 +125,7 @@ class ImageProperties(object):
...
@@ -118,7 +125,7 @@ class ImageProperties(object):
try
:
try
:
image_is_okay
=
self
.
count_colors
()
and
self
.
get_skin_ratio
()
and
not
self
.
image_too_large
image_is_okay
=
self
.
count_colors
()
and
self
.
get_skin_ratio
()
and
not
self
.
image_too_large
except
:
except
:
pass
log
.
exception
(
"Could not run image tests."
)
return
image_is_okay
return
image_is_okay
...
...
common/lib/xmodule/xmodule/openendedchild.py
View file @
afd42fc1
...
@@ -286,6 +286,7 @@ class OpenEndedChild(object):
...
@@ -286,6 +286,7 @@ class OpenEndedChild(object):
"""
"""
success
=
False
success
=
False
s3_public_url
=
""
s3_public_url
=
""
image_ok
=
False
try
:
try
:
image_data
.
seek
(
0
)
image_data
.
seek
(
0
)
image_ok
=
open_ended_image_submission
.
run_image_tests
(
image_data
)
image_ok
=
open_ended_image_submission
.
run_image_tests
(
image_data
)
...
@@ -348,7 +349,7 @@ class OpenEndedChild(object):
...
@@ -348,7 +349,7 @@ class OpenEndedChild(object):
return
True
,
get_data
return
True
,
get_data
has_file_to_upload
,
uploaded_to_s3
,
image_ok
,
image_tag
=
self
.
check_for_image_and_upload
(
get_data
)
has_file_to_upload
,
uploaded_to_s3
,
image_ok
,
image_tag
=
self
.
check_for_image_and_upload
(
get_data
)
if
uploaded_to_s3
and
has_file_to_upload
:
if
uploaded_to_s3
and
has_file_to_upload
and
image_ok
:
get_data
[
'student_answer'
]
+=
image_tag
get_data
[
'student_answer'
]
+=
image_tag
overall_success
=
True
overall_success
=
True
elif
has_file_to_upload
and
not
uploaded_to_s3
and
image_ok
:
elif
has_file_to_upload
and
not
uploaded_to_s3
and
image_ok
:
...
...
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