Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check algorithm for calculating splits #46

Open
1 task
dahacouk opened this issue Sep 1, 2014 · 12 comments
Open
1 task

Check algorithm for calculating splits #46

dahacouk opened this issue Sep 1, 2014 · 12 comments
Assignees

Comments

@dahacouk
Copy link
Member

dahacouk commented Sep 1, 2014

The split calculation seems to go wrong when sampling tracks that include more than one part in the track timeline. Somehow parts not included in the sample range are included in the sample because they are part of the track. Where the track is a collection of parts. Also there's nothing to stop parts overlapping within one track. Perhaps the easiest thing to do right now is not allow multiple parts per track. Perhaps we'll solve that issue later?

To do

  • Make sure the calculations are used on the sample view.
@BBGuy
Copy link
Member

BBGuy commented Sep 15, 2014

@BBGuy
Copy link
Member

BBGuy commented Sep 15, 2014

We identified that this issue is on the sample page and it looks like once sampled the calculations are correct.
We need to make sure the calculations are used on the sample view

@dahacouk
Copy link
Member Author

We could make it look something like this...

kendra_hub_sample_algorithm_-_google_docs

Where first chart is for Rights, then next 3 for specific splits within each right and then aggregated.

@BBGuy
Copy link
Member

BBGuy commented Sep 16, 2014

The issue with the sample screen is as follows:

  1. The view filter is used to workout what tracks are to be shown according to the exposed filter (slider)
  2. The calculations of the included tracks use used start/end properties of their entity (same code as the entity page).
    To resolve this issue we need to be able to override the start end of the track with the values of the sliders, without breaking it for the asset page.
    I can easily get the values of the sliders in the view using PHP:
$view = views_get_current_view();
$debug = print_r($view->exposed_input, TRUE);
drupal_set_message($debug);

return:

Array ( [range] => Array ( [value] => 54 [value2] => 82 ) ) 

will review the code to find how this can be accomplished

@BBGuy
Copy link
Member

BBGuy commented Sep 16, 2014

To do

  • Finish testing code with more complex assets
  • Commit and update code
    Update the sample view admin/structure/views/view/asset_contributions/edit/sample_asset
  • Update Global: PHP (Points) field
  • Update Global: PHP (Suggested Split) dield

@BBGuy
Copy link
Member

BBGuy commented Sep 16, 2014

Code to use inside the view fields

Global: PHP (Points) field code

Value code:

if (module_exists('kendra_wf') && function_exists('kendra_wf_calc_points_value') ) {
  if (isset($view->exposed_input['range'])) {
    // If we have a filter provide the start and end points
    $start_p = $view->exposed_input['range']['value'];
    $end_p = $view->exposed_input['range']['value2'];
    return kendra_wf_calc_points_value($data->nid,  $static, $start_p, $end_p);
  }
  else {
    // If no filter applied use 0-100.
    return kendra_wf_calc_points_value($data->nid,  $static, 0, 100);    
  }
}
else {
  return '';
}

Output code:

<?php
  print $value;
?>

Global: PHP (Points) field code

Value code:

if (module_exists('kendra_wf') && function_exists('kendra_wf_calc_points_value') ) {
  if (isset($view->exposed_input['range'])) {
    // If we have a filter provide the start and end points
    $start_p = $view->exposed_input['range']['value'];
    $end_p = $view->exposed_input['range']['value2'];
    return kendra_wf_calc_points_value($data->nid,  $static, $start_p, $end_p);
  }
  else {
    // If no filter applied use 0-100.
    return kendra_wf_calc_points_value($data->nid,  $static, 0, 100);    
  }
}

Output code:

<?php
if (module_exists('kendra_wf') && function_exists('kendra_wf_calc_points_split') ) {
  print kendra_wf_calc_points_split($data->nid, $value, $static) . '%';
}
else {
 print '';
}
?>

BBGuy added a commit that referenced this issue Sep 16, 2014
…osed filter (also needs code update in php fields)
@BBGuy
Copy link
Member

BBGuy commented Sep 16, 2014

Live testing results

I have pushed all changes live.
I used the left right test that worked as expected see attached. However Sampling of the right side of Stairway to Heaven did not produce the same result as my local test did and doesn't look correct (see both local dev and live images below)

  • resolve issue

Left right test

live-left-right-test

Stairway to Heaven Local

local-swth-test

Stairway to Heaven Live

live-swth-test

@BBGuy
Copy link
Member

BBGuy commented Sep 16, 2014

Looks like the issue is that if a legal entities has more then one contribution, then contributions can override each other so out of the two vocal tracks by Robert Plant only one is picked up.
Will investigate the code.

BBGuy added a commit that referenced this issue Sep 16, 2014
@BBGuy
Copy link
Member

BBGuy commented Sep 16, 2014

I have fixed the issue on the Asset page, but still need to fix it on the sample page

@BBGuy
Copy link
Member

BBGuy commented Sep 16, 2014

Sample page was a small config issue. So all looking good see image
live-swth-fixed

@BBGuy
Copy link
Member

BBGuy commented Sep 16, 2014

Daniel can you please review and close if you are happy

@BBGuy BBGuy assigned dahacouk and unassigned BBGuy Sep 16, 2014
@BBGuy
Copy link
Member

BBGuy commented Sep 16, 2014

The above image to check calculations go with 90-100 that works out a clean 20%,20%,20%,40%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants