Skip to content

Commit

Permalink
Meetup Status Report: Fix the 'all' view.
Browse files Browse the repository at this point in the history
  • Loading branch information
dd32 committed Jan 8, 2025
1 parent 3e198be commit a7c6e08
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class Meetup_Status extends Base_Status {
* @param string $status
* @param array $options
*/
public function __construct( $start_date, $end_date, $status = '', array $options = array() ) {
public function __construct( $start_date, $end_date, $status = 'any', array $options = array() ) {

parent::__construct( $options );

Expand All @@ -119,7 +119,19 @@ public function __construct( $start_date, $end_date, $status = '', array $option
$e->getMessage()
);
}
$this->status = $status;

if ( $status && 'any' !== $status ) {
$statuses = \Meetup_Admin::get_post_statuses();

if ( isset( $statuses[ $status ] ) ) {
$this->status = $status;
} else {
$this->error->add(
self::$slug . '-status-error',
'Invalid status provided.'
);
}
}
}

/**
Expand Down Expand Up @@ -303,10 +315,6 @@ public static function render_public_page() {
$year = $params['year'];
$status = $params['status'];

if ( $status && ! isset( $statuses[ $status ] ) ) {
$status = null;
}

if ( ! empty( $params ) && isset( $params['range'] ) ) {
$report = new self( $params['range']->start, $params['range']->end, $status, $params['options'] );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</table>

<?php foreach ( $meetups as $meetup ) : ?>
<p><strong class="active-camp"><?php echo esc_html( $meetup['name'] ); ?></strong> &ndash; <?php echo esc_html( $statuses[ $meetup['latest_status'] ] ); ?></p>
<p><strong class="active-camp"><?php echo esc_html( $meetup['name'] ); ?></strong> &ndash; <?php echo esc_html( $statuses[ $meetup['latest_status'] ] ?? 'Unknown' ); ?></p>
<ul class="status-log ul-disc">
<?php foreach ( $meetup['logs'] as $log ) : ?>
<li><?php
Expand Down

0 comments on commit a7c6e08

Please sign in to comment.