10-factor decision help

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

10-factor decision help

Keith M. Rettig
So this post is not an emergency as I know a perfectly fine way to do it, but I suspect there is a much cooler way to do it out there, so I am asking.

Folks can use promotional codes at our kiosks.  The kiosk queries the server with the entered promo code and the kiosk identifier.  The server takes those two values to perform [currently] ten separate tests to validate the code and the kiosk.  For instance, some of the factors are; is the code available for use given the date and time, is the code correct, is the code for unlimited or limited use, if limited use has it been used equal or greater number of times than that limit, is the location approved to use that code, is the region that kiosk is in approved to use that code, is the region that kiosk is in specifically not approved to use that code, etc.

So for each factor, I have a field that does the correct lookup or relational query and scores the result either a positive number (could be right for multiple reasons), a negative number (could be wrong for multiple reasons), or a 10 (for no answer; as in this factor was not specified for the promo code so it doesn’t matter).  I did this so that I could easily know the reason for the rejection/acceptance and could use that value to communicate to the kiosk as to why.  My plan was to simply multiply the ten numbers and if it was negative (since each factor is a positive question), then the code would be rejected.   But of course, what if there were an even number of negative numbers.  Math.

So a perfectly fine way to do it is a Case statement and put the factors in the order of most likely to be negative.
Also perfectly fine is to use MIN (factor01, factor02, factor03…) function.  I am assuming MIN be faster for most of the time but the Case could be faster if the reason was early in the list.

Any cooler ways to do it?
Would be neat if I could tell which factor was the negative number in the response.  Or if there were multiple reasons, which factors.  Though it seems more prudent to have two results; approved_or_rejected and why_rejected.

Thanks,
Keith.
_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au
Reply | Threaded
Open this post in threaded view
|

Re: 10-factor decision help

Richard DeShong
Well, starting at the end of your query, it appears you want to know:

    Approved or Rejected

And then if Rejected, you want a Reason.

This means that you do not need to know how bad it failed (your math
thing), but just that it failed.

So put the test in a "most important" order and run through them.  As
soon as you get a Reject, stop there are return an appropriate
response.  If you make it through all tests then return "Approved".


On 5/10/2017 10:37 AM, Keith M. Rettig wrote:

> So this post is not an emergency as I know a perfectly fine way to do it, but I suspect there is a much cooler way to do it out there, so I am asking.
>
> Folks can use promotional codes at our kiosks.  The kiosk queries the server with the entered promo code and the kiosk identifier.  The server takes those two values to perform [currently] ten separate tests to validate the code and the kiosk.  For instance, some of the factors are; is the code available for use given the date and time, is the code correct, is the code for unlimited or limited use, if limited use has it been used equal or greater number of times than that limit, is the location approved to use that code, is the region that kiosk is in approved to use that code, is the region that kiosk is in specifically not approved to use that code, etc.
>
> So for each factor, I have a field that does the correct lookup or relational query and scores the result either a positive number (could be right for multiple reasons), a negative number (could be wrong for multiple reasons), or a 10 (for no answer; as in this factor was not specified for the promo code so it doesn’t matter).  I did this so that I could easily know the reason for the rejection/acceptance and could use that value to communicate to the kiosk as to why.  My plan was to simply multiply the ten numbers and if it was negative (since each factor is a positive question), then the code would be rejected.   But of course, what if there were an even number of negative numbers.  Math.
>
> So a perfectly fine way to do it is a Case statement and put the factors in the order of most likely to be negative.
> Also perfectly fine is to use MIN (factor01, factor02, factor03…) function.  I am assuming MIN be faster for most of the time but the Case could be faster if the reason was early in the list.
>
> Any cooler ways to do it?
> Would be neat if I could tell which factor was the negative number in the response.  Or if there were multiple reasons, which factors.  Though it seems more prudent to have two results; approved_or_rejected and why_rejected.
>
> Thanks,
> Keith.
> _______________________________________________
> FMPexperts mailing list
> [hidden email]
> http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au

--
Richard DeShong
Logic Tools
510-642-5123 office
925-285-1088 cell

_______________________________________________
FMPexperts mailing list
[hidden email]
http://lists.ironclad.net.au/listinfo.cgi/fmpexperts-ironclad.net.au