dpinney / omf

The Open Modeling Framework for smart grid cost-benefit analysis.
https://omf.coop
GNU General Public License v2.0
112 stars 60 forks source link

New models with same name as existing results in data loss. #208

Closed dpinney closed 9 years ago

dpinney commented 10 years ago

TODO

POSSIBLE OPTIONS

dpinney commented 10 years ago

Good enough for now. Future event.

dpinney commented 10 years ago

@jinhw1989 doesn't need to worry about this.

dpinney commented 9 years ago

Mannan assigned.

mannanj commented 9 years ago

I think this is ready to go!

Error looks like: modelname

Made a change to the runButton in PVWatts ( as an example) so it runs the following javascript before submitting the form: (added to models.js since it will eventually be used in every model):

function checkModelName() {
    var newName = modelName.value
    $.ajax({
        url: "/uniqObjName/Model/" + currentUser + "/" + newName
    }).done(function (data) {
        if (data.exists) {
            alert("You already have a Model named " + newName)
        }
        else{   
            inputForm.submit()          
        }
    })  
}

runButton change:

<button id="runButton" type="button" class="preRun" onclick="javascript:checkModelName()">Run Model</button>
dpinney commented 9 years ago

Looks nice and clean.

If it tests okay with pvWatts, let's slap it on the models.

One change, for the error message:

alert("You already have a Model named '" + newName + "', please choose a different name.")
dpinney commented 9 years ago

Oh, and by the way, triple backticks on github put your code in fixed width font. I added that to your comment above.

mannanj commented 9 years ago

Oh that looks a lot better, thanks!

I'll update the rest of the models and commit.

mannanj commented 9 years ago

Now updated and closed.

mannanj commented 9 years ago

This was interfering with input validation, fixed this in commit 7ffc6e6cce40f4a9ede521224e3cae0f0997c46e

dpinney commented 9 years ago

Reopened.

dpinney commented 9 years ago

Fixed and production updated!

mannanj commented 9 years ago

The commit where this was fixed is 66155a5f6cc5d20d96afedc2b736619594d1c62a