Link to "Football Pool Software suggestions"

Message board links from 2010 as taken from the Internet Wayback Machine pages.
Post Reply
User avatar
admin
Site Admin
Posts: 159
Joined: Mon Aug 26, 2013 3:47 pm

Re: Link to "Football Pool Software suggestions"

Post by admin »

08-19-2009 7:07 AM
Spooky
Top 10 Contributor
Joined on 08-19-2009
Denver CO
Posts 49

Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

It would be really nice to have a configuration setting that forces players to have sufficient positive account balance before they can submit picks for any given week. I've had issues in the past where players have made the picks and then never got around to paying for them. I handled it by invalidating their picks and disabling the accounts... but it always left a bad taste in the mouth of the other players who were expecting the pot to be a certain amount.

Last year I made a few modifications in the code to prevent it from happening again, but my solution was a bit crude because it only verified that they had enough balance "at that moment" to make the picks. Since the balance is not adjusted until the game locks, a player "could" make several future weeks picks while only having enough positive balance for a single week. I will probably be doing my bailing wire/duct tape fix again this year... but would love to have a more elegant solution.

-Spook
08-19-2009 4:24 PM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 456

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

That may not be too hard. There are existing functions to check if a player has an entry in each pool. If you want to count every entry made (including ones for future weeks) the code would look like this:

function GetAvailableFunds(username)

dim sql, rs
dim credits, fees

GetAvailableFunds = 0

'Get credits.
credits = 0
sql = "SELECT SUM(Amount) AS Total FROM Credits WHERE Username = '" & SqlEscape(username) & "'"
set rs = DbConn.Execute(sql)
if not rs.EOF then
credits = credits + rs.Fields("Total").Value
end if

'Get fees.
fees = 0

'Count each weekly entry.
dim week, numWeeks
numWeeks = GetWeekCount()
for week = 1 to numWeeks
if InWeeklyPool(username, week) then
fees = fees + WEEKLY_ENTRY_FEE
end if
next

'Add the side pool entry (if used).
if InSidePool(username) then
fees = fees + SIDE_ENTRY_FEE
end if

GetAvailableFunds = credits - fees

end function

This ignores the playoffs pools, but you could include them as well. Then for any pool entry, check the available funds vs. the entry fee and decide if you want to allow it or not.
08-26-2009 11:42 AM In reply to
Spooky
Top 10 Contributor
Joined on 08-19-2009
Denver CO
Posts 49

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

Thanks Mike. I got this working just the way I wanted with your help.

For anyone else wanting to do the same, here is exactly what I did:

I added the following code to common.asp ... just stick it in anywhere between (but not inside) the other functions:

P.S. I took out the if InSidePool portion because it was giving me an error and I didn't look into the error because it didn't apply to my pool


'--------------------------------------------------------------------------
' Returns the amount of available funds for the user
'--------------------------------------------------------------------------
function GetAvailableFunds(username)

dim sql, rs
dim credits, fees

GetAvailableFunds = 0

'Get credits.
credits = 0
sql = "SELECT SUM(Amount) AS Total FROM Credits WHERE Username = '" & SqlEscape(username) & "'"
set rs = DbConn.Execute(sql)
if not rs.EOF then
credits = credits + rs.Fields("Total").Value
end if

'Get fees.
fees = 0

'Count each weekly entry.
dim week, numWeeks
numWeeks = GetWeekCount()
for week = 1 to numWeeks
if InWeeklyPool(username, week) then
fees = fees + WEEKLY_ENTRY_FEE
end if
next

GetAvailableFunds = credits - fees

end function



Then insert this code into weeklyEntry.asp somewhere around line 189... Make it the last elseif before the else in the 'Process an update request block of code.


elseif GetAvailableFunds(username) < WEEKLY_ENTRY_FEE then
call DisplayErrorMessage("Error: Your account does not have sufficient funds to make <br />these picks, Changes Not Accepted.")



Filed under: customization
08-26-2009 11:56 AM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 456

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

Very nice, that should take care of the deadbeats :)

I suspect the error you were getting with InSidePool could be fixed by adding <!-- #include file="includes/side.asp" --> to the weeklyEntry.asp file (side.asp contains the InSidePool function).

09-15-2009 11:44 AM In reply to
Spooky
Top 10 Contributor
Joined on 08-19-2009
Denver CO
Posts 49

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

Hey Mike... I noticed a slight glitch in the way this is working.

If the user does not have enough positive balance for another week he can not modify his current weeks picks, neither can the admin account for that matter, unless I add funds to his account and then take them away again post modification.

Can you think of easy ways to address those issues?

I'm thinking this change to weeklyEntry.asp will address the user's issue... but I'm not certain how best to address the Admin's inability to modify picks... but maybe that is not all that important.



'Process an update request.
elseif Request.Form("submit") = "Update" then

'Prevent entries by the Admin.
if username = ADMIN_USERNAME then
call DisplayErrorMessage("Error: User '" & ADMIN_USERNAME & "' may not make picks.")

'If the user is disabled, prevent the entry.
elseif IsDisabled() then
call DisplayErrorMessage("Error: Your account has been disabled, changes not accepted.<br />Please contact the Administrator.")

'If all games have been locked, prevent any updates (except by the Admin).
elseif not IsAdmin() and allLocked then
call DisplayErrorMessage("Error: All games for this week have been locked, changes not<br />accepted.")

'If the player does not have sufficient funds, do not allow the picks
elseif GetAvailableFunds(username) < WEEKLY_ENTRY_FEE and NOT hasEntry then
call DisplayErrorMessage("Error: Your account does not have sufficient funds to make <br />these picks, Changes Not Accepted.")

'Otherwise, process the request.


09-15-2009 12:41 PM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 456

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

I think you need to adjust the available funds depending on whether the player has an entry for the current week or not. I'd add this near the top of the script:

'Determine if the user has an entry for the given week (so we can display
'the Delete button).
dim hasEntry
hasEntry = false
if username <> "" and InWeeklyPool(username, week) then
hasEntry = true
end if

'Get the user's available funds.
dim availFunds
availFunds = GetAvailableFunds(username, week)
if hasEntry then
availFunds = availFunds + WEEKLY_ENTRY_FEE
end if

That basically gives them back credit for the current week since they've already paid for it.

Then you can adjust your if statement:

elseif not IsAdmin() and availFunds < 0 then
call DisplayErrorMessage("Error: Your account does not have sufficient funds to make <br />these picks, Changes Not Accepted.")

the "not IsAdmin()" part will let the admin update it no matter what.
09-15-2009 1:24 PM In reply to
Spooky
Top 10 Contributor
Joined on 08-19-2009
Denver CO
Posts 49

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

Looks like I have that working with just a couple changes:

mikehall:


'Get the user's available funds.
dim availFunds
availFunds = GetAvailableFunds(username)
if hasEntry then
availFunds = availFunds + WEEKLY_ENTRY_FEE
end if

That basically gives them back credit for the current week since they've already paid for it.

Then you can adjust your if statement:

elseif not IsAdmin() and availFunds < WEEKLY_ENTRY_FEE then
call DisplayErrorMessage("Error: Your account does not have sufficient funds to make <br />these picks, Changes Not Accepted.")

the "not IsAdmin()" part will let the admin update it no matter what.



GetAvailableFunds only takes the single input (gave me an error initially)

WEEKLY_ENTRY_FEE instead of 0 for the requirement (0 allowed players to pick 1 extra week)
09-15-2009 2:05 PM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 456

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

My bad, you're right on both points.
09-15-2009 7:13 PM In reply to
sportstalk
Top 10 Contributor
Joined on 09-15-2009
Georgia
Posts 98

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

ok so has this section been settled? Somehow to where the funds have to be available in order to make picks? but what about the adjustments to picks?



I've added the first section to common.asp and to weeklyEntry line 189(or close to it.). but i never changed anything after that post. So is there still a problem with the editing picks even though thats been added?
09-15-2009 7:28 PM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 456

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

Go with Spook's last post above, that should work for the initial entry and any later editing:

'Get the user's available funds.
dim availFunds
availFunds = GetAvailableFunds(username)
if hasEntry then
availFunds = availFunds + WEEKLY_ENTRY_FEE
end if
...

elseif not IsAdmin() and availFunds < WEEKLY_ENTRY_FEE then
call DisplayErrorMessage("Error: Your account does not have sufficient funds to make <br />these picks, Changes Not Accepted.")


09-16-2009 7:04 AM In reply to
Spooky
Top 10 Contributor
Joined on 08-19-2009
Denver CO
Posts 49

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

To summarize all changes for making this mod work:

[snip]

see the newer summary on the next page of this thread..
09-16-2009 7:14 AM In reply to
Spooky
Top 10 Contributor
Joined on 08-19-2009
Denver CO
Posts 49

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

[snip]
see the newer summary on the next page of this thread..
09-16-2009 10:06 AM In reply to
sportstalk
Top 10 Contributor
Joined on 09-15-2009
Georgia
Posts 98

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

ok so this code in the previous posts at the top isnt the right one to add to the bottom of weeklyEntry.asp?

Spooky:


elseif GetAvailableFunds(username) < WEEKLY_ENTRY_FEE then
call DisplayErrorMessage("Error: Your account does not have sufficient funds to make <br />these picks, Changes Not Accepted.")







I followed the directions you just gave in the last 2 posts you made. im updating now to test it out. thx for your help.
10-01-2009 7:36 PM In reply to
sportstalk
Top 10 Contributor
Joined on 09-15-2009
Georgia
Posts 98

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

ok i just redone the code for verifing funds but for some reason it is still letting people pick without payments..
11-29-2009 8:59 PM In reply to
vardog
Top 50 Contributor
Joined on 11-30-2009
Posts 10

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

Same here. I've inserted the scripts exactly as posted, but no luck. People still can select lineups while "in the hole". I started this pool a couple of weeks ago, would starting on week 10 have any effect on this?

Maybe Mike will consider implementing this feature in the future for people like myself who can't figure out why this won't work.

Page 1 of 2 (21 items) 1 2 Next >
User avatar
admin
Site Admin
Posts: 159
Joined: Mon Aug 26, 2013 3:47 pm

Re: Link to "Football Pool Software suggestions"

Post by admin »

11-30-2009 10:09 AM In reply to
Spooky
Top 10 Contributor
Joined on 08-19-2009
Denver CO
Posts 49

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

If you follow the instructions in the two summary posts I made about 5 posts back in this thread, and then make sure you push the new files out to your website, it should all work. It is possible you might have the old files cached, so closing all browser windows before testing may be necessary.
Starting mid season should not make any difference. I've been using the code on my pool, so I am certain it works. What other modifications have you made, if any?
12-01-2009 9:41 PM In reply to
vardog
Top 50 Contributor
Joined on 11-30-2009
Posts 10

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

Thanks Spooky, it worked. A brain-fart on my part with the cached files.

Bottoms up! Beer
08-19-2010 9:55 AM In reply to
Spooky
Top 10 Contributor
Joined on 08-19-2009
Denver CO
Posts 49

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

Mike,

I'm wondering if this modification will still function in the 4.0 Beta "as-is" or if further modification are needed.



-Spooky



Spooky:

To summarize all changes for making this mod work:

Start with adding this function to common.asp

function GetAvailableFunds(username)

dim sql, rs
dim credits, fees

GetAvailableFunds = 0

'Get credits.
credits = 0
sql = "SELECT SUM(Amount) AS Total FROM Credits WHERE Username = '" & SqlEscape(username) & "'"
set rs = DbConn.Execute(sql)
if not rs.EOF then
credits = credits + rs.Fields("Total").Value
end if


if not IsNumeric(credits) then
credits = 0
end if



'Get fees.
fees = 0

'Count each weekly entry.
dim week, numWeeks
numWeeks = GetWeekCount()
for week = 1 to numWeeks
if InWeeklyPool(username, week) then
fees = fees + WEEKLY_ENTRY_FEE
end if
next

'Add the side pool entry (if used).
if InSidePool(username) then
fees = fees + SIDE_ENTRY_FEE
end if

GetAvailableFunds = credits - fees

end function



See Next Post






Spooky:
Next, open up weeklyEntry.asp and add this at the top along with the other #includes:

<!-- #include file="includes/side.asp" -->



Now scroll down until you find the hasEntry section and add the bolded text below

'Determine if the user has an entry for the given week (so we can display
'the Delete button).
dim hasEntry
hasEntry = false
if username <> "" and InWeeklyPool(username, week) then
hasEntry = true
end if

'Get the user's available funds.
dim availFunds
availFunds = GetAvailableFunds(username)
if hasEntry then
availFunds = availFunds + WEEKLY_ENTRY_FEE
end if



Now, scroll down again until you come to the "Process an update request" section and add the bold text

'Process an update request.
elseif Request.Form("submit") = "Update" then

'Prevent entries by the Admin.
if username = ADMIN_USERNAME then
call DisplayErrorMessage("Error: User '" & ADMIN_USERNAME & "' may not make picks.")

'If the user is disabled, prevent the entry.
elseif IsDisabled() then
call DisplayErrorMessage("Error: Your account has been disabled, changes not accepted.<br />Please contact the Administrator.")

'If all games have been locked, prevent any updates (except by the Admin).
elseif not IsAdmin() and allLocked then
call DisplayErrorMessage("Error: All games for this week have been locked, changes not<br />accepted.")

'If the player does not have sufficient funds, do not allow the picks
elseif not IsAdmin() and availFunds < WEEKLY_ENTRY_FEE then
call DisplayErrorMessage("Error: Your account does not have sufficient funds to make <br />these picks, Changes Not Accepted.")


That should do it, just save the files and update your website.





(edited post to include a small fix for users with no transactions yet)
08-23-2010 6:50 PM In reply to
mikehall
Top 10 Contributor
Joined on 08-09-2009
Chandler, AZ
Posts 456

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

Those instructions should still work, there are no new pools or fees and the affected files are all still there with the same names.
10-17-2010 12:53 PM In reply to
blueyes
Top 100 Contributor
Joined on 10-17-2010
Posts 1

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

I finally got around to adding this in to my code because people playing and not paying is disturbing but it does not seem to be working. I've restarted the browser and even used another one but it still lets me do picks with an insufficient fund. Any other thoughts?

And in case it matters I'm still using v3, tks
10-19-2010 8:29 AM In reply to
Spooky
Top 10 Contributor
Joined on 08-19-2009
Denver CO
Posts 49

Re: Football Pool Software suggestion... sufficient positive ballance required to make picks
Reply Contact

Make sure you are using the code from my last summary in this thread (just a few posts back). There was a slight bug fix in the common.asp code that deals with what might be your issue.



-Spooky

Page 2 of 2 (21 items) < Previous 1 2
Post Reply