WordPress.org

Support

Support » Plugins and Hacks » [Resolved] rounds in ascending and descending games possible?

[Resolved] rounds in ascending and descending games possible?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author AntoineH
    Participant

    @antoineh

    If I understand correctly you want to display the match types (Jornada) in descending order and the matches in ascending order. This is not possible without a change in the code.

    If you change the get_match_sorting_method function in classes\class-football-pool-matches.php to the code as shown below it should work:

    public function get_match_sorting_method() {
    	$order = Football_Pool_Utils::get_fp_option( 'match_sort_method', FOOTBALLPOOL_MATCH_SORT, 'int' );
    	switch ( $order ) {
    		case 1:
    			$order = 'matchtype DESC, m.play_date DESC, m.id DESC';
    			break;
    		case 0:
    		default:
    			$order = 'matchtype DESC, m.play_date ASC, m.id ASC';
    	}
    
    	return $order;
    }

    I will add the new sorting option to the next version of the plugin.

    Thank you very much for your reply

    When overriding public function get_match_sorting_method all matches also disappear.
    http://www.pixhost.org/show/5005/18166051_01255.jpg

    this is what is in classes\class-football-pool-matches.php

    public function get_match_sorting_method() {
    		$order = Football_Pool_Utils::get_fp_option( 'match_sort_method', FOOTBALLPOOL_MATCH_SORT, 'int' );
    		switch ( $order ) {
    			case 1:
    				$order = 'm.playDate DESC, m.nr DESC';
    				break;
    			case 0:
    			default:
    				$order = 'm.playDate ASC, m.nr ASC';
    		}
    
    		return $order;
    	}

    I am using the 2.2.5 version of the plugin

    Thanks!

    Plugin Author AntoineH
    Participant

    @antoineh

    Whoops, sorry 🙂 I based the code on my development branch. And that branch has some changes in column names.

    Try this:

    public function get_match_sorting_method() {
    	$order = Football_Pool_Utils::get_fp_option( 'match_sort_method', FOOTBALLPOOL_MATCH_SORT, 'int' );
    	switch ( $order ) {
    		case 1:
    			$order = 'matchtype DESC, m.playDate DESC, m.nr DESC';
    			break;
    		case 0:
    		default:
    			$order = 'matchtype DESC, m.playDate ASC, m.nr ASC';
    	}
    
    	return $order;
    }

    Thank you very much for your help now I worked great
    I had tried changing that line before asking for support but I could not.

    Thank you for your wonderful plugin
    A couple of days ago I sent him a donation
    was not a huge amount (many euros)
    since even I am starting my website

    Sorry for my English
    I’m using google translator

    Greetings from Mexico!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] rounds in ascending and descending games possible?’ is closed to new replies.