Full backend implementation with custom Odoo modules: - encoach_api: Core API, user management, JWT auth - encoach_exam: Exam generation (reading, writing, listening, speaking) - encoach_evaluate: AI-powered evaluation (writing, speaking) - encoach_training: Training tips and walkthrough - encoach_storage: File storage management - encoach_payment: Stripe, PayPal, Paymob integration - encoach_mail: Email notifications Made-with: Cursor
46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
from odoo import models, fields
|
|
|
|
|
|
class EncoachEvaluation(models.Model):
|
|
_name = "encoach.evaluation"
|
|
_description = "EnCoach Evaluation Record"
|
|
|
|
user_id = fields.Many2one("res.users", string="User", ondelete="cascade")
|
|
session_id = fields.Integer(string="Session Reference")
|
|
exercise_id = fields.Char(string="Exercise ID")
|
|
exercise_type = fields.Selection(
|
|
[("writing", "Writing"), ("speaking", "Speaking")],
|
|
string="Exercise Type",
|
|
)
|
|
status = fields.Selection(
|
|
[
|
|
("pending", "Pending"),
|
|
("in_progress", "In Progress"),
|
|
("completed", "Completed"),
|
|
("error", "Error"),
|
|
],
|
|
default="pending",
|
|
)
|
|
result = fields.Json()
|
|
created_at = fields.Datetime(default=fields.Datetime.now)
|
|
completed_at = fields.Datetime()
|
|
legacy_id = fields.Char(index=True)
|
|
|
|
def to_encoach_dict(self):
|
|
self.ensure_one()
|
|
return {
|
|
"id": self.id,
|
|
"userId": self.user_id.id if self.user_id else None,
|
|
"sessionId": self.session_id,
|
|
"exerciseId": self.exercise_id or "",
|
|
"exerciseType": self.exercise_type or "",
|
|
"status": self.status,
|
|
"result": self.result,
|
|
"createdAt": (
|
|
self.created_at.isoformat() if self.created_at else None
|
|
),
|
|
"completedAt": (
|
|
self.completed_at.isoformat() if self.completed_at else None
|
|
),
|
|
}
|