amtgard / ORK3

Version 3 of the Online Record Keeper
Other
23 stars 12 forks source link

Unique sign-ins report #95

Open Tyedye opened 8 years ago

Tyedye commented 8 years ago

A request for new reports, including unique sign ins per month per park. Thread with details is https://www.facebook.com/groups/189406377888489/permalink/545616325600824/

BenOvermyer commented 8 years ago

Relevant bits of the aforementioned discussion:

Is there a way to run reports on my park's attendance? When I'm on the attendance screen and I click the report link in the top left it just gives me a blank screen that says reports. It looks like there should be stuff on the page but there isn't.

What report are you trying to run? If you go to the parks page, and open the reports tab, it will have an option under attendance to display graphs for various amounts of time (past week, ect)

I saw someone posted a graph of local vs visitor sign ins. Also unique monthly sign ins would be a good report to have.

The only graph is the attendance graph, which has lines for average and standard deviation.

I have a Script which scrapes the ORK for unique sign in info because the Goldenvale Corpora requires it quarterly. I run the script from time to time for the PMs of the parks so they don't have to do it by hand

What is the definition of "unique sign-in"?

Unique person. Duplicates of the same person per month is not counted more than once

And it has to be generated for 1-15th of month, 16-end of month, and whole month. A & B attend beginning of month is 2 people, A & C attend during 2nd half of month is 2 people. For the whole month it's 3 unique people

For reference, this SQL seems to do the trick:

select p.park_id, p.name, count(s.mundane_id), year(s.`date`), month(s.`date`) from 
(select * from ork_attendance where kingdom_id = 1 and year(`date`) > 2014 group by park_id, mundane_id, year(`date`), month(`date`), day(`date`) between 1 and 15, day(`date`) between 16 and 31 order by year(`date`), month(`date`)) s

left join ork_park p on s.park_id = p.park_id

group by s.park_id, year(s.`date`), month(s.`date`), day(s.`date`) between 1 and 15, day(s.`date`) between 16 and 31
order by year(`date`), month(`date`), p.park_id