additional checks for when the faculty count is less than the default page size
This commit is contained in:
parent
06c7dcfabd
commit
71d21c4999
1 changed files with 10 additions and 1 deletions
|
@ -23,7 +23,13 @@ $(document).ready(function(){
|
||||||
var rowStart = Math.floor((Math.random()*facultyMemberCount)+1)-1;
|
var rowStart = Math.floor((Math.random()*facultyMemberCount)+1)-1;
|
||||||
var diff;
|
var diff;
|
||||||
var pageSize = 4; // the number of faculty to display on the home page
|
var pageSize = 4; // the number of faculty to display on the home page
|
||||||
|
|
||||||
|
if ( facultyMemberCount < 5 ) {
|
||||||
|
pageSize = facultyMemberCount;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pageSize = 4; // our default number; could have fewer than 4 in a test or dev environment
|
||||||
|
}
|
||||||
// in case the random number is equal to or within 3 of the facultyMemberCount
|
// in case the random number is equal to or within 3 of the facultyMemberCount
|
||||||
if ( (rowStart + (pageSize-1)) > facultyMemberCount ) {
|
if ( (rowStart + (pageSize-1)) > facultyMemberCount ) {
|
||||||
diff = (rowStart + (pageSize-1)) - facultyMemberCount;
|
diff = (rowStart + (pageSize-1)) - facultyMemberCount;
|
||||||
|
@ -34,6 +40,9 @@ $(document).ready(function(){
|
||||||
rowStart = rowStart - diff;
|
rowStart = rowStart - diff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( rowStart < 0 ) {
|
||||||
|
rowStart = 0;
|
||||||
|
}
|
||||||
|
|
||||||
var dataServiceUrl = urlsBase + "/dataservice?getRandomSolrIndividualsByVClass=1&vclassId=";
|
var dataServiceUrl = urlsBase + "/dataservice?getRandomSolrIndividualsByVClass=1&vclassId=";
|
||||||
var url = dataServiceUrl + encodeURIComponent("http://vivoweb.org/ontology/core#FacultyMember");
|
var url = dataServiceUrl + encodeURIComponent("http://vivoweb.org/ontology/core#FacultyMember");
|
||||||
|
|
Loading…
Add table
Reference in a new issue