Fix remaining controller serialization and model mismatches

- Replace all _serialize_group/exam/assignment/stat/session calls with _serialize
- Fix sessions controller to use exam_data JSON field instead of nonexistent columns
- Fix stats controller to use correct model fields (score_correct/total/missing, solutions)

Made-with: Cursor
This commit is contained in:
Talal Sharabi
2026-03-15 01:12:17 +04:00
parent bf3981028b
commit fa538a1f12
5 changed files with 42 additions and 40 deletions

View File

@@ -32,7 +32,7 @@ class ClassroomsController(EncoachMixin, http.Controller):
domain.append(('entity_id', '=', int(entity_id)))
groups = request.env['encoach.group'].sudo().search(domain, order='name asc')
return self._json_response([self._serialize_group(g) for g in groups])
return self._json_response([self._serialize(g) for g in groups])
except Exception:
_logger.exception("List groups error")
return self._error_response('Internal server error', 500)
@@ -61,7 +61,7 @@ class ClassroomsController(EncoachMixin, http.Controller):
vals['participant_ids'] = [(4, int(pid)) for pid in participant_ids]
group = request.env['encoach.group'].sudo().create(vals)
return self._json_response(self._serialize_group(group), status=201)
return self._json_response(self._serialize(group), status=201)
except Exception:
_logger.exception("Create group error")
return self._error_response('Internal server error', 500)
@@ -95,7 +95,7 @@ class ClassroomsController(EncoachMixin, http.Controller):
if vals:
group.write(vals)
return self._json_response(self._serialize_group(group))
return self._json_response(self._serialize(group))
except Exception:
_logger.exception("Update group error")
return self._error_response('Internal server error', 500)