EllisLab text mark
Advanced Search
2 of 2
2
   
New plugins: Will Hunting (math), and Count Entries.
Posted: 22 January 2011 07:25 PM   [ Ignore ]   [ # 19 ]   [ Rating: 0 ]
Avatar
Joined: 2007-11-16
70 posts

Hi Airways,

trying the single tag currently installed:

this being the only code in the complete template:

12 * 3 = {exp:will_hunting solve=“12 * 3”}

12 + 3 = {exp:will_hunting solve=“12 + 3”}

rund(12.92 + 5) = {exp:will_hunting solve=“round(12.92 + 5)”}

12 / 3 = {exp:will_hunting solve=“12 / 3”}


returns:

12 * 3 = 36
12 + 3 = 15
rund(12.92 + 5) = 18
12 / 3 = 12

Maybe I am missing something. If you can’t reproduce this I will post a bug report as you mentioned in your prior post.

airways - 22 January 2011 11:42 PM

Well I haven’t been able to find a problem with division. The following test works:

{exp:will_hunting}
{$n=2} {$n}<br />
{$n=2} {$n}<br />
{$n=2} {$n}<br />
{$n=2} {$n}<br />
{/exp:will_hunting} 

I would say double check your tying and if you do still have an issue, post a Bug Report with the offending code at the support forum for the plugin: http://devot-ee.com/add-ons/support/will-hunting/viewforum/1354/

Good luck!

 
Posted: 22 January 2011 08:29 PM   [ Ignore ]   [ # 20 ]   [ Rating: 0 ]
Avatar
Joined: 2009-02-16
155 posts

Okay well, I did finally recreate this in EE 1.7. Doesn’t occur in 2.0, so I am suspecting that it’s a weird parsing error in the Template class… might take awhile, but I will try to track it down.

 Signature 

@airways ::: MetaSushi, LLC
ProForm - EE’s first drag & drop form builder ::: CacheCracker - steroids for EE performance ::: Will Hunting - advanced math
Snippet Sync - edit snippets as files ::: Spyglass - advanced text search

 
Posted: 22 January 2011 08:44 PM   [ Ignore ]   [ # 21 ]   [ Rating: 0 ]
Avatar
Joined: 2007-11-16
70 posts

Hi Airways,

I have clients that hire me to just find bugs smile, for some reason I have a talent finding them! If there is a bug, I find it, HA!

Thanks for looking into this. Keep me updated on the status ... Have a great weekend!

airways - 23 January 2011 01:29 AM

Okay well, I did finally recreate this in EE 1.7. Doesn’t occur in 2.0, so I am suspecting that it’s a weird parsing error in the Template class… might take awhile, but I will try to track it down.

 
Posted: 22 January 2011 08:49 PM   [ Ignore ]   [ # 22 ]   [ Rating: 0 ]
Avatar
Joined: 2009-02-16
155 posts

Found it! Actually, I’ve seen this one before. EE 1.x has a habit of changing / into an HTML entity for some reason. This should have occurred to me before, it’s caused more than a few bugs in custom code we’ve written in the past. Anyway, fixed version now up at http://devot-ee.com/site/download/?file=will_hunting-2_3.zip

This version also brings back single template tags if you need them, with a slightly updated syntax:

{exp:will_hunting:solve exp="round(12.92 * 1234)" store="x"}
{exp:will_hunting:get var="x"
 Signature 

@airways ::: MetaSushi, LLC
ProForm - EE’s first drag & drop form builder ::: CacheCracker - steroids for EE performance ::: Will Hunting - advanced math
Snippet Sync - edit snippets as files ::: Spyglass - advanced text search

 
Posted: 22 January 2011 09:03 PM   [ Ignore ]   [ # 23 ]   [ Rating: 0 ]
Avatar
Joined: 2007-11-16
70 posts

Nice job mate! A++!

airways - 23 January 2011 01:49 AM

Found it! Actually, I’ve seen this one before. EE 1.x has a habit of changing / into an HTML entity for some reason. This should have occurred to me before, it’s caused more than a few bugs in custom code we’ve written in the past. Anyway, fixed version now up at http://devot-ee.com/site/download/?file=will_hunting-2_3.zip

This version also brings back single template tags if you need them, with a slightly updated syntax:

{exp:will_hunting:solve exp="round(12.92 * 1234)" store="x"}
{exp:will_hunting:get var="x"
 
Posted: 23 January 2011 10:54 PM   [ Ignore ]   [ # 24 ]   [ Rating: 0 ]
Avatar
Joined: 2007-11-16
70 posts

Hi Airways,

I was missing the Modulus (division remainder) operator. As a token of my appreciation for your quick replies and solution, I added ‘%’ support to Will Hunting. Feel free to check it out and integrate it into the next update of Will Hunting.
I have added a readme.txt file along with the file and it can be downloaded at:

pi.will_hunting_pg_231.zip

thanks again for your quick help yesterday, Airways!

airways - 23 January 2011 01:49 AM

Found it! Actually, I’ve seen this one before. EE 1.x has a habit of changing / into an HTML entity for some reason. This should have occurred to me before, it’s caused more than a few bugs in custom code we’ve written in the past. Anyway, fixed version now up at http://devot-ee.com/site/download/?file=will_hunting-2_3.zip

This version also brings back single template tags if you need them, with a slightly updated syntax:

{exp:will_hunting:solve exp="round(12.92 * 1234)" store="x"}
{exp:will_hunting:get var="x"
 
Posted: 09 March 2011 11:14 AM   [ Ignore ]   [ # 25 ]   [ Rating: 0 ]
Joined: 2009-07-22
40 posts

Nice plugin - but how can you set the deminal places of the result?

I am using this to calculate the TAX on an item and need to set deminal place to 2 points

{exp:will_hunting solve="({cart_subtotal} + {cart_shipping} - {cart_discount}) * 0.16666666"
 
Posted: 09 March 2011 11:21 AM   [ Ignore ]   [ # 26 ]   [ Rating: 0 ]
Joined: 2009-07-22
40 posts

Don’t worry - just modified the plugin file adding in this :

/**
     *  Evaluate an expression, returning the value
     */
    
function evaluate($expr{

        $this
->expr $expr;
        
$this->tokenize();
        
$this->pos 0;
        
$this->err = array();

        
$value number_format($this->eval_expr(),2); //this line was added to format the result as we are only using it for Tax purposes you might need to modify it more if you want to be able to select whether to use this output or not

        
return $value;
    
 
Posted: 09 March 2011 11:49 AM   [ Ignore ]   [ # 27 ]   [ Rating: 0 ]
Avatar
Joined: 2009-02-16
155 posts

Good ideas, I’ll see about adding similar options to the next release.

 Signature 

@airways ::: MetaSushi, LLC
ProForm - EE’s first drag & drop form builder ::: CacheCracker - steroids for EE performance ::: Will Hunting - advanced math
Snippet Sync - edit snippets as files ::: Spyglass - advanced text search

 
2 of 2
2