REopt_API icon indicating copy to clipboard operation
REopt_API copied to clipboard

Would be good to integrate two approaches to storing messages in database (Message and REoptjlMessageOutputs models), i.e. having just one model and handling messages from API and Julia consistently.

Open hdunham opened this issue 3 years ago • 1 comments

hdunham avatar Dec 27 '22 16:12 hdunham

What is currently being done:

in models.py:

  • Api messages are stored as individual instances of the Message model
  • Julia messages are stored all together in REoptjlMessageOutputs, which has an array for errors and an array for warnings

In save() in validators.py:

  • Message.create(meta=self.models["APIMeta"], message_type=msg_type, message=msg).save()

In process_results():

  • REoptjlMessageOutputs.create(meta=meta, **results["Messages"]).save()

In results view:

  • r["messages"][meta.Message.all().message_type] = msg.message
  • Does some processing of the values saved in REoptjlMessageOutputs and adds to r["messages"]

hdunham avatar Dec 27 '22 16:12 hdunham