Did ChatGPT mess up making my plugin, or am I dumb?

I’ve got a specific use case that I think I need to make a plugin for, so I used ChatGPT… It works fine if I run it outside of Bubble, but returns 0 in Bubble.

set_field is a list of Thing ‘set’ with attributes ‘daynumber’, ‘load’, and ‘duration’.
volumeSums is the exposed state, a list of numbers.

It might be better to use the Run Javascript action from Toolbox plugin rather than a plugin, which is highly dependent on a very specific structure.


Yeah I had tried a bunch of different ways - maybe my brain is just fried.

For overall context,
I have ‘sets’ with ‘duration’, ‘load’, and ‘daynumber’.

I want to calculate ‘volume’ per ‘daynumber’, which is the sum of each ( ‘sets’ * ‘load’ ) for each day.

However doing that with Toolbox, I would have to use group by day prior to doing the multiplication to get the same result.

Or using ListItemExpression, I theoretically could refer to the previous item in the list to check and see if the set is on the same day to sum, but ListItemExpression only looks at list items in isolation.

As for Run JS, the goal is to have this data feed into a graph that would change when data changes, and I can’t get it to update regularly.

Yup ChatGPT does not know Bubble. Right off the first line ChatGPT both fails to get the properties of list correct nor did it use idiomatic Javascript Array.reduce(). Also volumeSums is probably more clearly named dailySums:

const sets = properties.set_field && properties.set_field.length() ? 
    properties.set_field.get(0, properties.set_field.length()) :
const dailysums = sets.reduce(
    (a, v) => {
        return a[v.daynumber] += v.load * v.duration;

You will always need a senior human in the QA loop.

Thanks for the response, I’ve been playing around with it and trying to figure out Bubble syntax by looking at other plugins, but I’m missing something. Also not familiar enough with JS for .reduce

This is what I’ve got (much thanks btw), but it throws an error ‘sets is not defined’ - But it looks defined to me?

Also how do people test their code in this format outside of Bubble?

You’ll be interested in this video and my whole thread (but no, my training prompt for GPT4 isn’t available yet and you do still need to know what you’re doing, but I have created plugins using GPT4 as my co-developer):


Closing the loop,

I went with just using Toolbox’s JS to Bubble (Right now running every 5 sec, probably will change)

Looking forward having GPT4 ‘learn’ Bubble.