crowwoods1
Forum Replies Created
-
Hi,
Thanks for the suggestion! I see that I wasn’t clear that the dropdowns I have trouble with are in my Signup form, and not in the top menu. The dropdown fields, Team, Organization and Country, are created in Participant Database. It works on the computer. The dropdown fields on the mobile even show the options from my parameters, just not from the database. I was told it may have something to do with the cache.
Forum: Plugins
In reply to: [Participants Database] Numeric CalculationYay!!!! It worked.
Forum: Plugins
In reply to: [Participants Database] Numeric CalculationThanks for being patient!
So I had calculations.php write the values for:
template ->calc_body – looks great
replacement data – looks great
calc_list – nope, that’s what’s in the databaseSo I went back to the custom_calc_field.php, the replacement value there looks good too. So maybe my problem is instead of using $record_data for all the calculations, I just need to use $replacement_data for them. What do you think?
- This reply was modified 2 years, 8 months ago by crowwoods1.
Forum: Plugins
In reply to: [Participants Database] Numeric CalculationThanks! Looking at calculation.php, line 84 seems to indicate that replacement data is based on $post.
abstract protected function replacement_data( $post );Then line 192 seems to be setting the submission data as something that requires the field to be checked for signup.
public function set_submission_value( $post ) { foreach( $this->field_list() as $field ) { if ( $field->is_signup() && isset( $post[$field->name()] ) ) { $this->set_field( $field->name() ); $post[$field->name()] = $this->dynamic_value($post); } } return $post; }
Most of my fields are not checked for signup. Ironically ‘role’ is the only field that’s indicated for signup. Is that a problem?
Forum: Plugins
In reply to: [Participants Database] Numeric CalculationI think if I can debug the file for numeric calculation, the one that calls this filter, I can see if it’s at least reading the template. What is the name of the file, and where can I find it?
Thanks!
Forum: Plugins
In reply to: [Participants Database] Numeric CalculationIf I want to debug it, what file(s) should I be looking at?
Forum: Plugins
In reply to: [Participants Database] Numeric Calculationok, I deactivated my Google analytics, and the [?integer] is now working. Not sure if that’s related. The only other 2 plugins are Elementor and Calculated Fields Form.
I know that when I first used the Echo (probably 2 upgrades ago), it was picking up the right data. It’s just that I couldn’t see the Echo unless I went back a screen. Now 2 upgrades later, I can’t even read in the right data.
Does it have to do with this? I’m reading the record, not something just submitted and not gone into the record.
$record_data = Participants_Db::get_participant( $field->record_id );Also, the Calculated Fields Form plugin allows for dynamic updating of the points field. As one updates the actions, the points update right away. No button to press. Unfortunately I can’t get it to write to the database. Can something like that be done with Participant Database?
Forum: Plugins
In reply to: [Participants Database] Numeric CalculationIt doesn’t work and this is what I put into one of the templates.
[change_led] + [test_drive] + [plant_tree] + [local_csa] + [volunteer] + [paperless] + [rain_barrels] + [aerators] + [microplastics] + [shower_heads] + [running_toilets] =[?unformatted]
Now I put =[?integer] in at the end but every time I save, it adds [?unformatted] to the end. So I removed =[?integer]
Does that cause it not to work?Forum: Plugins
In reply to: [Participants Database] Numeric CalculationNope! I put all the related fields in the templates but it’s still the same.
Forum: Plugins
In reply to: [Participants Database] Numeric CalculationI see, so I would have to have all 43 fields in the calculation template for regular_points. That seems doable.
Is it a problem since role is not a numeric field?
Forum: Plugins
In reply to: [Participants Database] Numeric CalculationRoland,
I used echo and I found the culprit, yay! But I don’t know how to fix it.
It looks like the $record_data[‘role’] is pulling in the role before the update. So how do I get it to pick up the one that’s after the update?
Ivy
Forum: Plugins
In reply to: [Participants Database] Numeric CalculationI put in an error_log right before the role_points return but it didn’t show up in the log.
error_log(“result for role_points: $result and replacement data: $replacement_data”);
Also, are the $result and $replacement_data supposed to be the same? Where is $replacement data set?
Forum: Plugins
In reply to: [Participants Database] Numeric CalculationI simplified the code so that it’s clear which calculated fields is doing what but the result is the same.
Now the only thing in the debugging log between each of the updates is:
PDb_Participant_Cache::refresh_cache: Refreshing Participants Database cache for cache group 0Could this have something to do with it?
Forum: Plugins
In reply to: [Participants Database] Numeric CalculationIncidentally, if I don’t redo all the calculations for role points, one time points and regular points in the program, the total points would be zero. That tells me that even though each of those 3 calculation $result is returned before calculating total points, it is not saved to the database right away. They all sit somewhere and get updated together. So the question is what is the signal that allows them to be updated. I think that signal has to be outside my program.
Forum: Plugins
In reply to: [Participants Database] Numeric CalculationWhat kind of error_log do you suggest? As I mentioned before, I had echo statements in there for the $result originally, and it’s calculating correctly. It’s just that what was in the echo was not posted to the database immediately. Back then I can step back a page, and the echo would be there, like they’re sitting in the back waiting to be updated.
I have to say that total points are always in sync with the other 3 points. It posts the total of role points, one time points and regular points, whether those are from a prior time or this time.
How do you mean to simplify the program? Like this?
if ( $field->name() == ‘role_points’){}
elseif ( $field->name() == ‘one_time_points’){}
elseif ( $field->name() == ‘regular_points’){}
elseif ( $field->name() == ‘total_points’){}That’s how I had it originally, but my non-php programmer friend thought that it’s not good because the total points section has to repeat all the calculations for the other 3 points, adding to the number of lines in the program. If you think my original way is better, I’ll switch back. I don’t think that’s the problem though.