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
c7fd48a0
Commit
c7fd48a0
authored
Jul 14, 2015
by
Tim Krones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add integration tests for pagination.
parent
6ee520a0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
204 additions
and
17 deletions
+204
-17
problem_builder/public/js/student_answers_dashboard.js
+19
-8
problem_builder/tests/integration/test_student_answers_dashboard.py
+185
-9
No files found.
problem_builder/public/js/student_answers_dashboard.js
View file @
c7fd48a0
...
@@ -18,9 +18,16 @@ function StudentAnswersDashboardBlock(runtime, element) {
...
@@ -18,9 +18,16 @@ function StudentAnswersDashboardBlock(runtime, element) {
model
:
Result
,
model
:
Result
,
getCurrentPage
:
function
()
{
getCurrentPage
:
function
(
object
)
{
var
currentPage
=
this
.
state
.
currentPage
;
var
currentPage
=
this
.
state
.
currentPage
;
return
this
.
getPage
(
currentPage
);
if
(
object
)
{
return
this
.
getPage
(
currentPage
);
}
return
currentPage
;
},
getTotalPages
:
function
()
{
return
this
.
state
.
totalPages
;
}
}
});
});
...
@@ -28,9 +35,9 @@ function StudentAnswersDashboardBlock(runtime, element) {
...
@@ -28,9 +35,9 @@ function StudentAnswersDashboardBlock(runtime, element) {
var
ResultsView
=
Backbone
.
View
.
extend
({
var
ResultsView
=
Backbone
.
View
.
extend
({
render
:
function
()
{
render
:
function
()
{
this
.
_insertRecords
(
this
.
collection
.
getCurrentPage
());
this
.
_insertRecords
(
this
.
collection
.
getCurrentPage
(
true
));
this
.
_updateControls
();
this
.
_updateControls
();
this
.
$
(
'#total-pages'
).
text
(
this
.
collection
.
state
.
totalPages
);
this
.
$
(
'#total-pages'
).
text
(
this
.
collection
.
getTotalPages
()
||
0
);
return
this
;
return
this
;
},
},
...
@@ -47,7 +54,11 @@ function StudentAnswersDashboardBlock(runtime, element) {
...
@@ -47,7 +54,11 @@ function StudentAnswersDashboardBlock(runtime, element) {
});
});
tbody
.
append
(
row
);
tbody
.
append
(
row
);
},
this
);
},
this
);
this
.
$
(
'#current-page'
).
text
(
this
.
collection
.
state
.
currentPage
);
if
(
this
.
collection
.
getTotalPages
())
{
this
.
$
(
'#current-page'
).
text
(
this
.
collection
.
getCurrentPage
());
}
else
{
this
.
$
(
'#current-page'
).
text
(
0
);
}
},
},
events
:
{
events
:
{
...
@@ -82,8 +93,8 @@ function StudentAnswersDashboardBlock(runtime, element) {
...
@@ -82,8 +93,8 @@ function StudentAnswersDashboardBlock(runtime, element) {
},
},
_updateControls
:
function
()
{
_updateControls
:
function
()
{
var
currentPage
=
this
.
collection
.
state
.
currentPage
,
var
currentPage
=
this
.
collection
.
getCurrentPage
()
,
totalPages
=
this
.
collection
.
state
.
totalPages
,
totalPages
=
this
.
collection
.
getTotalPages
()
,
firstPage
=
'#first-page'
,
firstPage
=
'#first-page'
,
prevPage
=
'#prev-page'
,
prevPage
=
'#prev-page'
,
nextPage
=
'#next-page'
,
nextPage
=
'#next-page'
,
...
@@ -91,7 +102,7 @@ function StudentAnswersDashboardBlock(runtime, element) {
...
@@ -91,7 +102,7 @@ function StudentAnswersDashboardBlock(runtime, element) {
all
=
[
firstPage
,
prevPage
,
nextPage
,
lastPage
],
all
=
[
firstPage
,
prevPage
,
nextPage
,
lastPage
],
backward
=
[
firstPage
,
prevPage
],
backward
=
[
firstPage
,
prevPage
],
forward
=
[
nextPage
,
lastPage
];
forward
=
[
nextPage
,
lastPage
];
if
(
totalPages
===
1
)
{
if
(
!
totalPages
||
totalPages
===
1
)
{
this
.
_disable
(
all
);
this
.
_disable
(
all
);
}
else
{
}
else
{
if
(
currentPage
===
1
)
{
if
(
currentPage
===
1
)
{
...
...
problem_builder/tests/integration/test_student_answers_dashboard.py
View file @
c7fd48a0
This diff is collapsed.
Click to expand it.
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