mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-20 10:03:43 +03:00
Use FIELD_IDS
instead of hardcoding for DRYness.
This commit is contained in:
parent
fac9c24310
commit
24a73b6324
|
@ -71,11 +71,11 @@ function get_aggregate_contributor_data_for_pledge( $pledge_id ) {
|
||||||
|
|
||||||
$aggregate_data = array_reduce( $data, function( $carry, $item ) {
|
$aggregate_data = array_reduce( $data, function( $carry, $item ) {
|
||||||
switch ( $item['field_id'] ) {
|
switch ( $item['field_id'] ) {
|
||||||
case 29: // Hours.
|
case FIELD_IDS['hours_per_week']:
|
||||||
$carry['hours'] += absint( $item['value'] );
|
$carry['hours'] += absint( $item['value'] );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 30: // Teams.
|
case FIELD_IDS['team_names']:
|
||||||
$value = (array) maybe_unserialize( $item['value'] );
|
$value = (array) maybe_unserialize( $item['value'] );
|
||||||
$carry['teams'] = array_merge( $carry['teams'], $value );
|
$carry['teams'] = array_merge( $carry['teams'], $value );
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue