Real Hours Week?

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

Real Hours Week?

Postby rizzobox » Mon Jun 15, 2009 6:53 am

I've been trying to make a report that sums up my weekly play, I downloaded the "WeekMonthYear" script from the repository, and it all works well until I try to make it display Real Hours played.

If I choose "real hours day" it breaks down every day making the report useless.

[ img ]

If I choose "real hours month" it looks like this.

[ img ]


I guess I need to write a "Real Hours Week" stat, but I have no idea whatsoever how to even start, anyone who would like to help me?
rizzobox
 
Posts: 27
Joined: Sat Jul 19, 2008 3:01 pm

Re: Real Hours Week?

Postby kraada » Mon Jun 15, 2009 10:17 am

Yes you'd need to create Real Hours Week.

I think you might be able to do it by duplicating cnt_minutes_real_day (see the variables tab) and changing date_played_day to date_played_week and date_played_month to date_played_week_month and date_played_year to date_played_week_year. Then create the corresponding stat. I haven't gotten a chance to test this for myself yet, though.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Real Hours Week?

Postby rizzobox » Mon Jun 15, 2009 11:47 am

That almost worked, what it did was getting the real hours for every monday, and if no hands was played on a monday, the value became 0.02. I'm pretty clueless about these sorts of things so maybe I messed up somewhere.
rizzobox
 
Posts: 27
Joined: Sat Jul 19, 2008 3:01 pm

Re: Real Hours Week?

Postby kraada » Mon Jun 15, 2009 12:34 pm

Okay this gets a little funky, because you can't add date intervals into variables apparently.

You'll need to create 6 new columns:
date_played_week_tuesday: dateextract_day[date_trunc('week', datefix_fromutc[holdem_table_session_summary.date_start]) + interval '1 day']
date_played_week_wednesday: dateextract_day[date_trunc('week', datefix_fromutc[holdem_table_session_summary.date_start]) + interval '2 days']
...
date_played_week_sunday: dateextract_day[date_trunc('week', datefix_fromutc[holdem_table_session_summary.date_start]) + interval '6 days']

Then create cnt_real_minutes_week in the variables section as:
lookup_realminutes_day(id_player,date_played_week, date_played_week_month, date_played_week_year) + lookup_realminutes_day(id_player,date_played_week_tuesday, date_played_week_month, date_played_week_year) + lookup_realminutes_day(id_player,date_played_week_wednesday, date_played_week_month, date_played_week_year) + ... + lookup_realminutes_day(id_player,date_played_week_sunday, date_played_week_month, date_played_week_year)

Then you create the stat using the variable as normal.

I think that should work. (This is all a workaround as we don't have lookup_realminutes_week() . . .)
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Real Hours Week?

Postby rizzobox » Mon Jun 15, 2009 12:57 pm

I could create the columns/variable/stat, but when I ran the report I got this error.
I really appreciate your help, but I don't want you to waste your time on me, because I guess you have more important stuff to do :)

[ img ]
rizzobox
 
Posts: 27
Joined: Sat Jul 19, 2008 3:01 pm

Re: Real Hours Week?

Postby kraada » Mon Jun 15, 2009 2:47 pm

You need to check the 'group by' boxes in the columns you built. Try doing that and see if it works after that.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Real Hours Week?

Postby rizzobox » Mon Jun 15, 2009 4:01 pm

It's working now, but the numbers don't match. If a week spans between two months, only the days from the starting month are counted. And on some places, that also seems to be on weeks spanning months it adds hours that I can't find the source of. If it cuts hours from weeks that spans between two months the week-report summary should show less hours than the winnings tab. But it shows a few hours more.

Maybe this project have to wait until we can get a standard real_week stat :)
rizzobox
 
Posts: 27
Joined: Sat Jul 19, 2008 3:01 pm

Re: Real Hours Week?

Postby kraada » Mon Jun 15, 2009 5:11 pm

Yeah this one in particular is quite tricky; I'll have to do some more investigating.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 2 guests