1

I am creating a scoreboard website for fisherman that shows the sum of their top catches for the day. A custom content type allows the anglers to upload a photograph, fish type, and fish length numerical value (DONE). Anglers may upload as many catches per day (DONE) as they want. I have Views showing me all fish caught (DONE). I have Views_Calc showing me data about "all fish caught" per day (DONE).

However, I only want to calculate, display, and store in the database the SUM of the X longest fish an angler has caught that day.

So, I'm trying to build:

1) A View ranking anglers by the sum of their, say, 5 longest fish caught per day.

Consider that some anglers may have a tough day fishing and only be able to upload, say, 3 fish per day. Conversely (and this is the situation I am having trouble rendering) an angler may submit, say, 14 fish caught that day but I only want to display the sum of the 5 longest.

I would like the SUM to be a database entry so it is accessible via Views for other purposes.

The rendering may look like:

RANK   |  ANGLER NAME  |  5 LONGEST FISH
  1    |  John Smith   |   49.75 inches
  2    |  Joe Blow     |   47.25 inches
  3    |  Kevin Jones  |   42.50 inches
  4    |  Dave Craig   |   37.75 inches
...

Any pointers? Thanks in advance!

1 Answer 1

0

If you don't want to build a custom module I would think Rules is your best bet. Also install Conditional Rules as what you will be doing will requires logic a bit difficult to accomplish with Rules alone.

I will create a Result content type that will hold the aggregated result for the day per angler, as well as entity references to the fish content type. Then, after the angler uploaded a new entry, the rule will cycle through the related fish types and do the Maths and store the result in the result field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.