Support » Plugin: Greenhouse Job Board » Group by Department Issue

  • Hi,

    We have a job that isn’t assigned to any department which cause the sort functions to error. I just sorta hacked it but there’s probably a better fix
    Line 665

     	//group/sort this sucker
    	json.jobs.sort(function(a, b){
    		//sort depending on group value
    		if ( group === 'department' ) {
    			if ( a.departments.length == 0 ) return 1;
    			if ( b.departments.length == 0 ) return -1;
    			if ( a.departments[0].name < b.departments[0].name ) return -1;
    			if ( a.departments[0].name > b.departments[0].name ) return 1;
    		} else if ( group === 'office' ) {
    			if ( a.offices.length == 0) return 1;
    			if ( b.offices.length == 0) return -1;
    			if ( a.offices[0].name < b.offices[0].name ) return -1;
    			if ( a.offices[0].name > b.offices[0].name ) return 1;
    		} else if ( group === 'location' ) {
    			if ( a.location.name < b.location.name ) return -1;
    			if ( a.location.name > b.location.name ) return 1;
    		}		
    		//do nothing
    		return 0;
    	});

    and then arround 883:

         		if ( group_headline ) {
         			//get this group headline
         			if ( group === 'department' ) {
    	     			if( json.jobs[i].departments.length == 0 ){
    		     			this_group = '';
    	     			}else{
         					this_group = json.jobs[i].departments[0].name;
         				}
         			} else if ( group === 'office' ) {
         				this_group = json.jobs[i].offices[0].name;
         			} else if ( group === 'location' ) {
         				this_group = json.jobs[i].location.name;
         			}

    Thanks,
    Colin

Viewing 1 replies (of 1 total)
  • Plugin Contributor Evan Mullins

    (@circlecube)

    Thanks & props Colin, we’ll take a look at this and try to work it into our next release. Good case we hadn’t considered.

Viewing 1 replies (of 1 total)
  • The topic ‘Group by Department Issue’ is closed to new replies.