Skip to content
This repository has been archived by the owner on Jan 11, 2022. It is now read-only.

Commit

Permalink
Reverted the deleted code which was throwing exception following form…
Browse files Browse the repository at this point in the history
…atting changes
  • Loading branch information
mohammedanas committed Oct 11, 2018
1 parent ec40ad8 commit b794eb6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/app/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class SearchComponent implements OnInit {
}

applyFilter(filter): void {
console.log("Apply filter", filter);
const paginationParams = {};
const searchParams = {};

Expand Down
23 changes: 13 additions & 10 deletions src/app/shared/search/search-result.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,15 @@ export class SearchResultComponent implements OnChanges {
draftsCount: number;

constructor(searchResultViewItemComparatorFactory: SearchResultViewItemComparatorFactory,
appConfig: AppConfig,
private activityService: ActivityService,
private caseReferencePipe: CaseReferencePipe) {
appConfig: AppConfig,
private activityService: ActivityService,
private caseReferencePipe: CaseReferencePipe) {
this.searchResultViewItemComparatorFactory = searchResultViewItemComparatorFactory;
this.paginationPageSize = appConfig.getPaginationPageSize();
this.hideRows = false;
}

ngOnChanges(changes: SimpleChanges): void {
// console.log("ONCHANGES", changes['resultView']);
if (changes['resultView']) {
this.hideRows = false;

Expand All @@ -100,7 +99,7 @@ export class SearchResultComponent implements OnChanges {
this.resultView.columns = this.resultView.columns.sort((a: SearchResultViewColumn, b: SearchResultViewColumn) => {
return a.order - b.order;
});
console.log(this.resultView.columns);

this.draftsCount = this.draftsCount ? this.draftsCount : this.numberOfDrafts();
}
if (changes['page']) {
Expand All @@ -109,7 +108,6 @@ export class SearchResultComponent implements OnChanges {
}

goToPage(page): void {
console.log("GOTOOO");
this.hideRows = true;
this.selected.init = false;
this.selected.jurisdiction = this.jurisdiction;
Expand Down Expand Up @@ -170,21 +168,26 @@ export class SearchResultComponent implements OnChanges {

let isAscending = true;
let isDescending = true;
//console.log("this.resultView.results.length", this.resultView.results.length);
for (let i = 0; i < this.resultView.results.length - 1; i++) {

for (let i = 0; i < this.resultView.results.length - 1; i++) {
let comparison = this.comparator(column).compare(this.resultView.results[i], this.resultView.results[i + 1]);
isDescending = isDescending && comparison <= 0;
isAscending = isAscending && comparison >= 0;
if (!isAscending && !isDescending) {
break;
}
}
return isAscending ? SortOrder.ASCENDING : isDescending ? SortOrder.DESCENDING : SortOrder.UNSORTED;
}

getFirstResult(): number {
const currentPage = (this.selected.page ? this.selected.page : 1);
return ((currentPage - 1) * this.paginationPageSize) + 1 + this.getDraftsCountIfNotPageOne(currentPage);
return ( (currentPage - 1) * this.paginationPageSize ) + 1 + this.getDraftsCountIfNotPageOne(currentPage);
}

getLastResult(): number {
const currentPage = (this.selected.page ? this.selected.page : 1);
return ((currentPage - 1) * this.paginationPageSize) + this.resultView.results.length + this.getDraftsCountIfNotPageOne(currentPage);
return ( (currentPage - 1) * this.paginationPageSize ) + this.resultView.results.length + this.getDraftsCountIfNotPageOne(currentPage);
}

getTotalResults(): number {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { SearchResultViewColumn } from '../search-result-view-column.model';
import { SearchResultViewItemComparator } from './search-result-view-item-comparator';
import { SearchResultViewItem } from '../search-result-view-item.model';
Expand All @@ -9,7 +8,6 @@ import { isUndefined } from 'util';
export class SearchResultViewItemComparatorFactory {

createSearchResultViewItemComparator(column: SearchResultViewColumn): SearchResultViewItemComparator {
console.log(column);
let fieldId = column.case_field_id;
switch (column.case_field_type.type) {
case ('MultiSelectList'): {
Expand Down

0 comments on commit b794eb6

Please sign in to comment.