Whitespace, coding standards/conventions, etc.
This commit is contained in:
parent
5a0833aca7
commit
bd429d45dd
|
@ -46,7 +46,8 @@ function farm_livestock_weight($asset) {
|
|||
* The animal asset to get weight for.
|
||||
*
|
||||
* @return array
|
||||
* Returns an array of arrays with the following information from each weight log ('weight', value, units, label, log)
|
||||
* Returns an array of arrays with the following information from each weight log:
|
||||
* weight, value, units, label, log
|
||||
* Newest is the first, oldest last.
|
||||
*/
|
||||
function farm_livestock_weight_all($asset) {
|
||||
|
@ -64,12 +65,12 @@ function farm_livestock_weight_all($asset) {
|
|||
|
||||
// Check that there are some logs!
|
||||
if (!empty($logs)) {
|
||||
|
||||
foreach ($logs as $log) {
|
||||
|
||||
// Get weight quantity data from log.
|
||||
$data = farm_quantity_log_data($log, 'weight');
|
||||
foreach ($data as $quantity){
|
||||
if (!empty($quantity['value'])){
|
||||
foreach ($data as $quantity) {
|
||||
if (!empty($quantity['value'])) {
|
||||
|
||||
// Save the log with the quantity info.
|
||||
$quantity['log'] = $log;
|
||||
|
@ -109,10 +110,10 @@ function farm_livestock_weight_dlwg($asset) {
|
|||
$dlwg = array();
|
||||
|
||||
// At least 2 weights must be recorded to calculate Daily Liveweight gain.
|
||||
if (count($weights)>1){
|
||||
if (count($weights) > 1) {
|
||||
|
||||
// Make sure logs use the same units.
|
||||
if (($weights[0]['units']) == ($weights[1]['units'])){
|
||||
if ($weights[0]['units'] == $weights[1]['units']) {
|
||||
|
||||
// Save latest weight info.
|
||||
$latest_weight = $weights[0];
|
||||
|
|
|
@ -23,12 +23,13 @@ function farm_livestock_weight_individual_report(FarmAsset $farm_asset) {
|
|||
// Check if the asset has a weight recorded.
|
||||
if (empty($current_weight)) {
|
||||
$output .= '<p>' . t('No weight recorded for asset') . '</p>';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$output .= '<p><strong>' . t('Current weight') . ':</strong> ' . $current_weight['value'] . ' ' . $current_weight['units'] . '</p>';
|
||||
|
||||
// Load the daily live weight gain.
|
||||
$dlwg = farm_livestock_weight_dlwg($farm_asset);
|
||||
if (!empty($dlwg)){
|
||||
if (!empty($dlwg)) {
|
||||
// Add the dlwg markup.
|
||||
$output .= $dlwg['markup'];
|
||||
}
|
||||
|
@ -45,7 +46,7 @@ function farm_livestock_weight_individual_report(FarmAsset $farm_asset) {
|
|||
$header = array(t('Date'), t('Value'), t('Units'));
|
||||
$table_data = array();
|
||||
|
||||
foreach($weights as $key => $weight){
|
||||
foreach($weights as $key => $weight) {
|
||||
|
||||
// Save the log.
|
||||
$log = $weight['log'];
|
||||
|
|
Loading…
Reference in New Issue