Open BBGuy opened 10 years ago
The committed code collects all the contributors buy recursively traversing the embedded contributions
(Clip A CTU x W) / (Clip A CTU x W) + (Clip B CTU x W) + ... (Clip X CTU x W) * 100
Key: CTU: Combined Target Usage (add up field_cont_target_usage) W: Usage weight (field_cont_usage_weight) CP: contribution percentage
Cycle all contributions and for each
Calculate: CP for each and store in array['cp'][source nid][cp %]
['cp'][source nid]['legel entity'] = Is Contributor a legal entity (True/False)
if Is Contributor a legal entity ['cp'][source nid]['legel entity name'] = legal entity name
else
load all the contribution records that full into the source start end
cycle for each
calculate the CP
multiple the CP by the percentage that fulls into the source start end and updatye the CP
['CP'][1][LE] = 1 ['CP'][1][LE name] = David bowie ['CP'][1][percent] = 0.5
['CP'][2][LE] = 0 ['CP'][2][percent] = 0.5
['CP'][2]['CP'][LE] = 1 ['CP'][2]['CP'][LE name] = Freddie mercury ['CP'][2]['CP'][percent] = 0.5 ...
David bowie = 0.5 x 100 = 50% Freddie mercury = 0.5 x 0.5 x 100 = 25% ...
committed a proposed data structure and functionality but can do with a second opinion on this.
changed my mind about the above commit. Will use simple one hit recursive logic
kendra_e_resolve_asset('Under pressure', 0 , 100)
function kendra_e_resolve_asset($asset, $start, $end) {
// Get all contributions within start end.
// Cycle contributions:
// Calculate percentage :(Clip A CTU x W) / (Clip A CTU x W) + (Clip B CTU x W) + ... (Clip X CTU x W) * 100
// If an contributions is comes from an asset?
kendra_e_resolve_asset($subasset, $subasset->source_start, $subasset->source_end)
// If contributions is comes from a legal entity?
// Multiply the Calculate percentage by all parent Calculate percentages.
}
I have committed the initial code for the recessive functionality the method chosen was to run a number of recessive functions each handling a single process. The controlling function is kendra_e_resolve_asset_rights() The function is a prototype only as it dosent do the following two things:
Array(
[David Bowie] = Array
(
[contributions] = Array
(
[0] = 23.113752682846
[1] = 10.049457688194
[2] = 23.671497584541
[3] = 8.695652173913
)
[percentage] = 65.530360129494
)
[Freddie Mercury] = Array
(
[contributions] = Array
(
[0] = 0.45222559596873
[1] = 33.816425120773
)
[percentage] = 34.268650716742
)
[John Deacon] = Array
(
[contributions] = Array
(
[0] = 0.20098915376388
)
[percentage] = 0.20098915376388
)
)
This is now working and pushed to the blue-bag server see http://hub2.kendra.org/content/song-2 where changing usage and the suggested split in both the song 2 track or in the sampled under pressure will update the table. We need to test the calculations
Testing calculations is very very low priority right now. The most important thing is that there is an algorithm that can be demonstrated and spits out something – and that is there. Well done!
Change priority to low as dahacouk is happy with it as is at this stage.
This table will show all the names and how the percentage of the earning they will get and possibly listing of their contributions maybe role only. This will be controlled by a block that gives the percentage of each right type: Composition: 40% Performance: 60% At the first stage we will only collect the names and finish this functionality when time allows.