REopt_API
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.
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"]