Skip to content

Commit

Permalink
Fixes #17 - Clicking last page in pagination reverts to first page
Browse files Browse the repository at this point in the history
  • Loading branch information
“n15g” committed Oct 21, 2019
1 parent 2b3a0e9 commit dc2b427
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "badger",
"version": "0.3.0",
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down Expand Up @@ -31,7 +31,7 @@
"@types/shortid": "0.0.29",
"bootstrap": "^4.3.1",
"coh-content-db": "^1.1.4",
"coh-content-db-homecoming": "^0.5.0",
"coh-content-db-homecoming": "^1.0.0",
"jquery": "^3.4.1",
"js-base64": "^2.5.1",
"karma-coverage-istanbul-reporter": "^2.1.0",
Expand Down
6 changes: 5 additions & 1 deletion src/app/_changelog.ts
Expand Up @@ -25,5 +25,9 @@ export const Changelog: { [id: string]: string } = {
"* https://github.com/n15g/badger/issues/5 - Bulk select/deselect badges.\n" +
"* https://github.com/n15g/badger/issues/7 - Badge list doesn't remember the page number on refresh.\n" +
"* https://github.com/n15g/badger/issues/12 - Sort by map.\n" +
"* Removed some phantom table cells from the history badge display.\n"
"* Removed some phantom table cells from the history badge display.\n",

"1.0.0":
"* Update to `coh-content-db-homecoming@1.0.0`.\n" +
"* https://github.com/n15g/badger/issues/17 - Clicking last page in pagination reverts to first page.\n"
};
2 changes: 1 addition & 1 deletion src/app/badge/badge-list/badge-list.component.ts
Expand Up @@ -126,7 +126,7 @@ export class BadgeListComponent implements OnInit {

this.totalItems = badges.length;

if (this._page * this.itemsPerPage > this.totalItems) {
if ((this._page - 1) * this.itemsPerPage > this.totalItems) {
this._page = 1;
}

Expand Down
Expand Up @@ -138,7 +138,7 @@ export class CharacterBadgeChecklistComponent implements OnInit {

this.totalItems = badges.length;

if (this._page * this.itemsPerPage > this.totalItems) {
if ((this._page - 1) * this.itemsPerPage > this.totalItems) {
this._page = 1;
}

Expand Down

0 comments on commit dc2b427

Please sign in to comment.