Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Correct basic_formula so formula like f12/2 + rerun work #31

Merged
merged 4 commits into from
Jan 27, 2025

Conversation

alexandrecuer
Copy link
Contributor

@alexandrecuer alexandrecuer commented Jan 22, 2025

@TrystanLea :

  1. render possible to do f12/2.
  2. correct basic_formula so that edit and rerun work

should be merged into master to be tested asap by users at OEM forum !

thanks

cf https://community.openenergymonitor.org/t/display-temperature-in-fahrenheit/13652/15

previously it was possible to do f32+f12/2 but not f12/2.
this was really weird from the user side so this commit tries to correct things. Basic testing was done
Dont know why I did not go into that solution first so I am still not 100% sure. should be tested by users at OEM forum
@alexandrecuer alexandrecuer changed the title BUG CORRECTION - Improve basic_formula so you can make f12/2 alone [BUG] Improve basic_formula so you can make f12/2 alone Jan 24, 2025
without those tests, duplicates are generated when pressing run
@alexandrecuer alexandrecuer changed the title [BUG] Improve basic_formula so you can make f12/2 alone [BUG] Correct basic_formula so formula like f12/2 + rerun work Jan 24, 2025
from is not possible, it should be all but it is not needed
@@ -42,7 +42,7 @@ public function process($processitem)
// regexp for starting a formula with an operator or with nothing
$XSop="(?:-|\+|)";
// regexp for a basic formula, ie something like f12-f43 or 2.056*f42+f45
$Xbf="$XSop(?:$Xnbr$Xop)*$Xf(?:$Xop(?:$Xnbr$Xop)*$Xf(?:$Xop$Xnbr)*)*";
$Xbf="$XSop(?:$Xnbr$Xop)*$Xf(?:$Xop$Xnbr)*(?:$Xop(?:$Xnbr$Xop)*$Xf(?:$Xop$Xnbr)*)*";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to render possible things like f12/2.

@@ -61,9 +61,13 @@ public function process($processitem)
$original=$formula;

//checking the output feed
$fopen_mode='ab';
if ($processitem->process_mode=='all') {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to correct the behaviour when editing the formula and pressing run

@TrystanLea TrystanLea merged commit d4ebdcf into emoncms:master Jan 27, 2025
@TrystanLea
Copy link
Member

Thanks a lot @alexandrecuer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants