Skip to content

Commit

Permalink
Metrics: Prune files and hide sections when fields disabled
Browse files Browse the repository at this point in the history
* Remove Metric Pages no longer used

* Allow metrics to be used with groups disabled or some fields no available
  • Loading branch information
corsacca authored Dec 16, 2024
1 parent 38300b7 commit 40813ab
Show file tree
Hide file tree
Showing 32 changed files with 153 additions and 2,459 deletions.
2 changes: 1 addition & 1 deletion dt-groups/groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$modules['groups_base'] = [
'name' => 'Groups',
'enabled' => true,
'locked' => true,
'locked' => false,
'prerequisites' => [ 'contacts_base' ],
'post_type' => 'groups',
'description' => 'Default group functionality'
Expand Down
2 changes: 1 addition & 1 deletion dt-mapping/mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ public function map_level_by_grid_id( $grid_id ) {
$results['children'][$index]['id'] = (int) $child['id'];
$results['children'][$index]['grid_id'] = (int) $child['grid_id'];
$results['children'][$index]['population'] = (int) $child['population'];
$results['children'][$index]['population_formatted'] = number_format( $child['population'] );
$results['children'][$index]['population_formatted'] = number_format( $child['population'] ?? 0 );
$results['children'][$index]['latitude'] = (float) $child['latitude'];
$results['children'][$index]['longitude'] = (float) $child['longitude'];
$results['children'][$index]['parent_id'] = empty( $child['parent_id'] ) ? null : (int) $child['parent_id'];
Expand Down
8 changes: 6 additions & 2 deletions dt-metrics/combined/hover-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ public function data( $force_refresh = false ) {
//get initial data
$data = DT_Mapping_Module::instance()->data();

$post_types = DT_Posts::get_post_types();

$data = $this->add_contacts_column( $data );
$data = $this->add_groups_column( $data );
$data = $this->add_churches_column( $data );
if ( in_array( 'groups', $post_types ) ) {
$data = $this->add_groups_column( $data );
$data = $this->add_churches_column( $data );
}
$data = $this->add_users_column( $data );

return $data;
Expand Down
7 changes: 5 additions & 2 deletions dt-metrics/combined/locations-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ public function list_scripts() {
public function data( $force_refresh = false ) {
//get initial data
$data = DT_Mapping_Module::instance()->data();
$post_types = DT_Posts::get_post_types();

$data = $this->add_contacts_column( $data );
$data = $this->add_groups_column( $data );
$data = $this->add_churches_column( $data );
if ( !empty( $post_types['groups'] ) ) {
$data = $this->add_groups_column( $data );
$data = $this->add_churches_column( $data );
}
$data = $this->add_users_column( $data );

return $data;
Expand Down
12 changes: 6 additions & 6 deletions dt-metrics/combined/site-links.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ public function scripts() {
'site_links_header' => __( 'Site Links', 'disciple_tools' ),
'site_links_none_header' => __( 'None Set', 'disciple_tools' ),
'totals_header' => _x( 'Contacts transferred during date range', 'Contacts transferred during date range', 'disciple_tools' ),
'status_created_header' => sprintf( _x( '%s of contacts created in date range', 'Seeker Path of contacts created in date range', 'disciple_tools' ), $field_settings['overall_status']['name'] ),
'seeker_path_created_header' => sprintf( _x( '%s of contacts created in date range', 'Seeker Path of contacts created in date range', 'disciple_tools' ), $field_settings['seeker_path']['name'] ),
'milestones_created_header' => sprintf( _x( '%s of contacts created in date range', 'Seeker Path of contacts created in date range', 'disciple_tools' ), $field_settings['milestones']['name'] ),
'status_changes_header' => sprintf( _x( '%s changes during date range', 'Seeker Path changes during date range', 'disciple_tools' ), $field_settings['overall_status']['name'] ),
'seeker_path_changes_header' => sprintf( _x( '%s changes during date range', 'Seeker Path changes during date range', 'disciple_tools' ), $field_settings['seeker_path']['name'] ),
'milestones_changes_header' => sprintf( _x( '%s changes during date range', 'Seeker Path changes during date range', 'disciple_tools' ), $field_settings['milestones']['name'] ),
'status_created_header' => sprintf( _x( '%s of contacts created in date range', 'Seeker Path of contacts created in date range', 'disciple_tools' ), $field_settings['overall_status']['name'] ?? __( 'Contact Status', 'disciple_tools' ) ),
'seeker_path_created_header' => sprintf( _x( '%s of contacts created in date range', 'Seeker Path of contacts created in date range', 'disciple_tools' ), $field_settings['seeker_path']['name'] ?? __( 'Seeker Path', 'disciple_tools' ) ),
'milestones_created_header' => sprintf( _x( '%s of contacts created in date range', 'Seeker Path of contacts created in date range', 'disciple_tools' ), $field_settings['milestones']['name'] ?? __( 'Faith Milestones', 'disciple_tools' ) ),
'status_changes_header' => sprintf( _x( '%s changes during date range', 'Seeker Path changes during date range', 'disciple_tools' ), $field_settings['overall_status']['name'] ?? __( 'Contact Status', 'disciple_tools' ) ),
'seeker_path_changes_header' => sprintf( _x( '%s changes during date range', 'Seeker Path changes during date range', 'disciple_tools' ), $field_settings['seeker_path']['name'] ?? __( 'Seeker Path', 'disciple_tools' ) ),
'milestones_changes_header' => sprintf( _x( '%s changes during date range', 'Seeker Path changes during date range', 'disciple_tools' ), $field_settings['milestones']['name'] ?? __( 'Faith Milestones', 'disciple_tools' ) ),
],
'general' => [
'no_data_msg' => __( 'No Data Available', 'disciple_tools' )
Expand Down
36 changes: 0 additions & 36 deletions dt-metrics/contacts/baptism-tree.js

This file was deleted.

142 changes: 0 additions & 142 deletions dt-metrics/contacts/baptism-tree.php

This file was deleted.

35 changes: 0 additions & 35 deletions dt-metrics/contacts/coaching-tree.js

This file was deleted.

Loading

0 comments on commit 40813ab

Please sign in to comment.