rename stealattempt fields to raisefirstin and derive accordingly

This commit is contained in:
sqlcoder
2010-07-27 22:27:18 +01:00
parent acbe15fadd
commit 9c5581caf0
4 changed files with 154 additions and 68 deletions
+138 -56
View File
@@ -598,8 +598,8 @@ class Sql:
foldToOtherRaisedStreet3 BOOLEAN,
foldToOtherRaisedStreet4 BOOLEAN,
stealAttemptChance BOOLEAN,
stealAttempted BOOLEAN,
raiseFirstInChance BOOLEAN,
raisedFirstIn BOOLEAN,
foldBbToStealChance BOOLEAN,
foldedBbToSteal BOOLEAN,
foldSbToStealChance BOOLEAN,
@@ -714,8 +714,8 @@ class Sql:
foldToOtherRaisedStreet3 BOOLEAN,
foldToOtherRaisedStreet4 BOOLEAN,
stealAttemptChance BOOLEAN,
stealAttempted BOOLEAN,
raiseFirstInChance BOOLEAN,
raisedFirstIn BOOLEAN,
foldBbToStealChance BOOLEAN,
foldedBbToSteal BOOLEAN,
foldSbToStealChance BOOLEAN,
@@ -829,8 +829,8 @@ class Sql:
foldToOtherRaisedStreet3 INT,
foldToOtherRaisedStreet4 INT,
stealAttemptChance INT,
stealAttempted INT,
raiseFirstInChance INT,
raisedFirstIn INT,
foldBbToStealChance INT,
foldedBbToSteal INT,
foldSbToStealChance INT,
@@ -1025,8 +1025,8 @@ class Sql:
foldToOtherRaisedStreet3 INT,
foldToOtherRaisedStreet4 INT,
stealAttemptChance INT,
stealAttempted INT,
raiseFirstInChance INT,
raisedFirstIn INT,
foldBbToStealChance INT,
foldedBbToSteal INT,
foldSbToStealChance INT,
@@ -1125,8 +1125,8 @@ class Sql:
foldToOtherRaisedStreet3 INT,
foldToOtherRaisedStreet4 INT,
stealAttemptChance INT,
stealAttempted INT,
raiseFirstInChance INT,
raisedFirstIn INT,
foldBbToStealChance INT,
foldedBbToSteal INT,
foldSbToStealChance INT,
@@ -1224,8 +1224,8 @@ class Sql:
foldToOtherRaisedStreet3 INT,
foldToOtherRaisedStreet4 INT,
stealAttemptChance INT,
stealAttempted INT,
raiseFirstInChance INT,
raisedFirstIn INT,
foldBbToStealChance INT,
foldedBbToSteal INT,
foldSbToStealChance INT,
@@ -1364,8 +1364,18 @@ class Sql:
sum(hc.foldToOtherRaisedStreet4) AS f_freq_4,
sum(hc.wonWhenSeenStreet1) AS w_w_s_1,
sum(hc.wonAtSD) AS wmsd,
sum(hc.stealAttemptChance) AS steal_opp,
sum(hc.stealAttempted) AS steal,
sum(case hc.position
when 'S' then hc.raiseFirstInChance
when '0' then hc.raiseFirstInChance
when '1' then hc.raiseFirstInChance
else 0
) AS steal_opp,
sum(case hc.position
when 'S' then hc.raisedFirstIn
when '0' then hc.raisedFirstIn
when '1' then hc.raisedFirstIn
else 0
) AS steal,
sum(hc.foldSbToStealChance) AS SBstolen,
sum(hc.foldedSbToSteal) AS SBnotDef,
sum(hc.foldBbToStealChance) AS BBstolen,
@@ -1463,8 +1473,8 @@ class Sql:
sum(hc.foldToOtherRaisedStreet4) AS f_freq_4,
sum(hc.wonWhenSeenStreet1) AS w_w_s_1,
sum(hc.wonAtSD) AS wmsd,
sum(hc.stealAttemptChance) AS steal_opp,
sum(hc.stealAttempted) AS steal,
sum(hc.raiseFirstInChance) AS steal_opp,
sum(hc.raisedFirstIn) AS steal,
sum(hc.foldSbToStealChance) AS SBstolen,
sum(hc.foldedSbToSteal) AS SBnotDef,
sum(hc.foldBbToStealChance) AS BBstolen,
@@ -1589,8 +1599,8 @@ class Sql:
cast(hp2.foldToOtherRaisedStreet4 as <signed>integer) AS f_freq_4,
cast(hp2.wonWhenSeenStreet1 as <signed>integer) AS w_w_s_1,
cast(hp2.wonAtSD as <signed>integer) AS wmsd,
cast(hp2.stealAttemptChance as <signed>integer) AS steal_opp,
cast(hp2.stealAttempted as <signed>integer) AS steal,
cast(hp2.raiseFirstInChance as <signed>integer) AS steal_opp,
cast(hp2.raisedFirstIn as <signed>integer) AS steal,
cast(hp2.foldSbToStealChance as <signed>integer) AS SBstolen,
cast(hp2.foldedSbToSteal as <signed>integer) AS SBnotDef,
cast(hp2.foldBbToStealChance as <signed>integer) AS BBstolen,
@@ -1691,8 +1701,8 @@ class Sql:
cast(hp2.foldToOtherRaisedStreet4 as <signed>integer) AS f_freq_4,
cast(hp2.wonWhenSeenStreet1 as <signed>integer) AS w_w_s_1,
cast(hp2.wonAtSD as <signed>integer) AS wmsd,
cast(hp2.stealAttemptChance as <signed>integer) AS steal_opp,
cast(hp2.stealAttempted as <signed>integer) AS steal,
cast(hp2.raiseFirstInChance as <signed>integer) AS steal_opp,
cast(hp2.raisedFirstIn as <signed>integer) AS steal,
cast(hp2.foldSbToStealChance as <signed>integer) AS SBstolen,
cast(hp2.foldedSbToSteal as <signed>integer) AS SBnotDef,
cast(hp2.foldBbToStealChance as <signed>integer) AS BBstolen,
@@ -1794,8 +1804,8 @@ class Sql:
cast(hp2.foldToOtherRaisedStreet4 as <signed>integer) AS f_freq_4,
cast(hp2.wonWhenSeenStreet1 as <signed>integer) AS w_w_s_1,
cast(hp2.wonAtSD as <signed>integer) AS wmsd,
cast(hp2.stealAttemptChance as <signed>integer) AS steal_opp,
cast(hp2.stealAttempted as <signed>integer) AS steal,
cast(hp2.raiseFirstInChance as <signed>integer) AS steal_opp,
cast(hp2.raisedFirstIn as <signed>integer) AS steal,
cast(hp2.foldSbToStealChance as <signed>integer) AS SBstolen,
cast(hp2.foldedSbToSteal as <signed>integer) AS SBnotDef,
cast(hp2.foldBbToStealChance as <signed>integer) AS BBstolen,
@@ -2026,11 +2036,35 @@ class Sql:
,case when sum(cast(hp.street0_3Bchance as <signed>integer)) = 0 then -999
else 100.0*sum(cast(hp.street0_3Bdone as <signed>integer))/sum(cast(hp.street0_3Bchance as <signed>integer))
end AS pf3
,case when sum(cast(hp.stealattemptchance as <signed>integer)) = 0 then -999
else 100.0*sum(cast(hp.stealattempted as <signed>integer))/sum(cast(hp.stealattemptchance as <signed>integer))
,case when sum(cast(hp.raiseFirstInChance as <signed>integer)) = 0 then -999
else 100.0 * sum(cast(hp.raisedFirstIn as <signed>integer)) /
sum(cast(hp.raiseFirstInChance as <signed>integer))
end AS rfi
,case when sum(case hp.position
when 'S' then cast(hp.raiseFirstInChance as <signed>integer)
when '0' then cast(hp.raiseFirstInChance as <signed>integer)
when '1' then cast(hp.raiseFirstInChance as <signed>integer)
else 0
end
) = 0 then -999
else 100.0 *
sum(case hp.position
when 'S' then cast(hp.raisedFirstIn as <signed>integer)
when '0' then cast(hp.raisedFirstIn as <signed>integer)
when '1' then cast(hp.raisedFirstIn as <signed>integer)
else 0
end
) /
sum(case hp.position
when 'S' then cast(hp.raiseFirstInChance as <signed>integer)
when '0' then cast(hp.raiseFirstInChance as <signed>integer)
when '1' then cast(hp.raiseFirstInChance as <signed>integer)
else 0
end
)
end AS steals
,100.0*sum(cast(hp.street1Seen as <signed>integer))/count(1) AS saw_f
,100.0*sum(cast(hp.sawShowdown as <signed>integer))/count(1) AS sawsd
,100.0*sum(cast(hp.street1Seen as <signed>integer))/count(1) AS saw_f
,100.0*sum(cast(hp.sawShowdown as <signed>integer))/count(1) AS sawsd
,case when sum(cast(hp.street1Seen as <signed>integer)) = 0 then -999
else 100.0*sum(cast(hp.sawShowdown as <signed>integer))/sum(cast(hp.street1Seen as <signed>integer))
end AS wtsdwsf
@@ -2123,8 +2157,32 @@ class Sql:
,case when sum(cast(hp.street0_3Bchance as <signed>integer)) = 0 then -999
else 100.0*sum(cast(hp.street0_3Bdone as <signed>integer))/sum(cast(hp.street0_3Bchance as <signed>integer))
end AS pf3
,case when sum(cast(hp.stealattemptchance as <signed>integer)) = 0 then -999
else 100.0*sum(cast(hp.stealattempted as <signed>integer))/sum(cast(hp.stealattemptchance as <signed>integer))
,case when sum(cast(hp.raiseFirstInChance as <signed>integer)) = 0 then -999
else 100.0 * sum(cast(hp.raisedFirstIn as <signed>integer)) /
sum(cast(hp.raiseFirstInChance as <signed>integer))
end AS rfi
,case when sum(case hp.position
when 'S' then cast(hp.raiseFirstInChance as <signed>integer)
when '0' then cast(hp.raiseFirstInChance as <signed>integer)
when '1' then cast(hp.raiseFirstInChance as <signed>integer)
else 0
end
) = 0 then -999
else 100.0 *
sum(case hp.position
when 'S' then cast(hp.raisedFirstIn as <signed>integer)
when '0' then cast(hp.raisedFirstIn as <signed>integer)
when '1' then cast(hp.raisedFirstIn as <signed>integer)
else 0
end
) /
sum(case hp.position
when 'S' then cast(hp.raiseFirstInChance as <signed>integer)
when '0' then cast(hp.raiseFirstInChance as <signed>integer)
when '1' then cast(hp.raiseFirstInChance as <signed>integer)
else 0
end
)
end AS steals
,100.0*sum(cast(hp.street1Seen as <signed>integer))/count(1) AS saw_f
,100.0*sum(cast(hp.sawShowdown as <signed>integer))/count(1) AS sawsd
@@ -2221,8 +2279,32 @@ class Sql:
,case when sum(cast(hp.street0_3Bchance as <signed>integer)) = 0 then -999
else 100.0*sum(cast(hp.street0_3Bdone as <signed>integer))/sum(cast(hp.street0_3Bchance as <signed>integer))
end AS pf3
,case when sum(cast(hp.stealattemptchance as <signed>integer)) = 0 then -999
else 100.0*sum(cast(hp.stealattempted as <signed>integer))/sum(cast(hp.stealattemptchance as <signed>integer))
,case when sum(cast(hp.raiseFirstInChance as <signed>integer)) = 0 then -999
else 100.0 * sum(cast(hp.raisedFirstIn as <signed>integer)) /
sum(cast(hp.raiseFirstInChance as <signed>integer))
end AS rfi
,case when sum(case hp.position
when 'S' then cast(hp.raiseFirstInChance as <signed>integer)
when '0' then cast(hp.raiseFirstInChance as <signed>integer)
when '1' then cast(hp.raiseFirstInChance as <signed>integer)
else 0
end
) = 0 then -999
else 100.0 *
sum(case hp.position
when 'S' then cast(hp.raisedFirstIn as <signed>integer)
when '0' then cast(hp.raisedFirstIn as <signed>integer)
when '1' then cast(hp.raisedFirstIn as <signed>integer)
else 0
end
) /
sum(case hp.position
when 'S' then cast(hp.raiseFirstInChance as <signed>integer)
when '0' then cast(hp.raiseFirstInChance as <signed>integer)
when '1' then cast(hp.raiseFirstInChance as <signed>integer)
else 0
end
)
end AS steals
,100.0*sum(cast(hp.street1Seen as <signed>integer))/count(1) AS saw_f
,100.0*sum(cast(hp.sawShowdown as <signed>integer))/count(1) AS sawsd
@@ -2380,8 +2462,8 @@ class Sql:
,case when sum(street0_3Bchance) = 0 then '0'
else format(100.0*sum(street0_3Bdone)/sum(street0_3Bchance),1)
end AS pf3
,case when sum(stealattemptchance) = 0 then '-'
else format(100.0*sum(stealattempted)/sum(stealattemptchance),1)
,case when sum(raiseFirstInChance) = 0 then '-'
else format(100.0*sum(raisedFirstIn)/sum(raiseFirstInChance),1)
end AS steals
,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f
,format(100.0*sum(sawShowdown)/sum(HDs),1) AS sawsd
@@ -2485,8 +2567,8 @@ class Sql:
,case when sum(street0_3Bchance) = 0 then '0'
else to_char(100.0*sum(street0_3Bdone)/sum(street0_3Bchance),'90D0')
end AS pf3
,case when sum(stealattemptchance) = 0 then '-'
else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0')
,case when sum(raiseFirstInChance) = 0 then '-'
else to_char(100.0*sum(raisedFirstIn)/sum(raiseFirstInChance),'90D0')
end AS steals
,to_char(100.0*sum(street1Seen)/sum(HDs),'90D0') AS saw_f
,to_char(100.0*sum(sawShowdown)/sum(HDs),'90D0') AS sawsd
@@ -2608,8 +2690,8 @@ class Sql:
,case when sum(street0_3Bchance) = 0 then '0'
else format(100.0*sum(street0_3Bdone)/sum(street0_3Bchance),1)
end AS pf3
,case when sum(stealattemptchance) = 0 then '-'
else format(100.0*sum(stealattempted)/sum(stealattemptchance),1)
,case when sum(raiseFirstInChance) = 0 then '-'
else format(100.0*sum(raisedFirstIn)/sum(raiseFirstInChance),1)
end AS steals
,format(100.0*sum(street1Seen)/sum(HDs),1) AS saw_f
,format(100.0*sum(sawShowdown)/sum(HDs),1) AS sawsd
@@ -2742,8 +2824,8 @@ class Sql:
,case when sum(street0_3Bchance) = 0 then '0'
else to_char(100.0*sum(street0_3Bdone)/sum(street0_3Bchance),'90D0')
end AS pf3
,case when sum(stealattemptchance) = 0 then '-'
else to_char(100.0*sum(stealattempted)/sum(stealattemptchance),'90D0')
,case when sum(raiseFirstInChance) = 0 then '-'
else to_char(100.0*sum(raisedFirstIn)/sum(raiseFirstInChance),'90D0')
end AS steals
,to_char(round(100.0*sum(street1Seen)/sum(HDs)),'90D0') AS saw_f
,to_char(round(100.0*sum(sawShowdown)/sum(HDs)),'90D0') AS sawsd
@@ -2922,8 +3004,8 @@ class Sql:
,foldToOtherRaisedStreet2
,foldToOtherRaisedStreet3
,foldToOtherRaisedStreet4
,stealAttemptChance
,stealAttempted
,raiseFirstInChance
,raisedFirstIn
,foldBbToStealChance
,foldedBbToSteal
,foldSbToStealChance
@@ -3012,8 +3094,8 @@ class Sql:
,sum(foldToOtherRaisedStreet2)
,sum(foldToOtherRaisedStreet3)
,sum(foldToOtherRaisedStreet4)
,sum(stealAttemptChance)
,sum(stealAttempted)
,sum(raiseFirstInChance)
,sum(raisedFirstIn)
,sum(foldBbToStealChance)
,sum(foldedBbToSteal)
,sum(foldSbToStealChance)
@@ -3103,8 +3185,8 @@ class Sql:
,foldToOtherRaisedStreet2
,foldToOtherRaisedStreet3
,foldToOtherRaisedStreet4
,stealAttemptChance
,stealAttempted
,raiseFirstInChance
,raisedFirstIn
,foldBbToStealChance
,foldedBbToSteal
,foldSbToStealChance
@@ -3193,8 +3275,8 @@ class Sql:
,sum(CAST(foldToOtherRaisedStreet2 as integer))
,sum(CAST(foldToOtherRaisedStreet3 as integer))
,sum(CAST(foldToOtherRaisedStreet4 as integer))
,sum(CAST(stealAttemptChance as integer))
,sum(CAST(stealAttempted as integer))
,sum(CAST(raisedFirstInChance as integer))
,sum(CAST(raisedFirstIn as integer))
,sum(CAST(foldBbToStealChance as integer))
,sum(CAST(foldedBbToSteal as integer))
,sum(CAST(foldSbToStealChance as integer))
@@ -3284,8 +3366,8 @@ class Sql:
,foldToOtherRaisedStreet2
,foldToOtherRaisedStreet3
,foldToOtherRaisedStreet4
,stealAttemptChance
,stealAttempted
,raiseFirstInChance
,raisedFirstIn
,foldBbToStealChance
,foldedBbToSteal
,foldSbToStealChance
@@ -3374,8 +3456,8 @@ class Sql:
,sum(CAST(foldToOtherRaisedStreet2 as integer))
,sum(CAST(foldToOtherRaisedStreet3 as integer))
,sum(CAST(foldToOtherRaisedStreet4 as integer))
,sum(CAST(stealAttemptChance as integer))
,sum(CAST(stealAttempted as integer))
,sum(CAST(raiseFirstInChance as integer))
,sum(CAST(raisedFirstIn as integer))
,sum(CAST(foldBbToStealChance as integer))
,sum(CAST(foldedBbToSteal as integer))
,sum(CAST(foldSbToStealChance as integer))
@@ -3465,8 +3547,8 @@ class Sql:
foldToOtherRaisedStreet4,
wonWhenSeenStreet1,
wonAtSD,
stealAttemptChance,
stealAttempted,
raiseFirstInChance,
raisedFirstIn,
foldBbToStealChance,
foldedBbToSteal,
foldSbToStealChance,
@@ -3554,8 +3636,8 @@ class Sql:
foldToOtherRaisedStreet4=foldToOtherRaisedStreet4+%s,
wonWhenSeenStreet1=wonWhenSeenStreet1+%s,
wonAtSD=wonAtSD+%s,
stealAttemptChance=stealAttemptChance+%s,
stealAttempted=stealAttempted+%s,
raiseFirstInChance=raiseFirstInChance+%s,
raisedFirstIn=raisedFirstIn+%s,
foldBbToStealChance=foldBbToStealChance+%s,
foldedBbToSteal=foldedBbToSteal+%s,
foldSbToStealChance=foldSbToStealChance+%s,
@@ -3873,8 +3955,8 @@ class Sql:
foldToOtherRaisedStreet2,
foldToOtherRaisedStreet3,
foldToOtherRaisedStreet4,
stealAttemptChance,
stealAttempted,
raiseFirstInChance,
raisedFirstIn,
foldBbToStealChance,
foldedBbToSteal,
foldSbToStealChance,