mirror of
https://github.com/odoo/runbot.git
synced 2025-03-26 21:05:49 +07:00

Initial model was a (build_id, key, value) where key is in fact a two part information: `category.key` (where key is usually a module) This means that for each module, we will have one entry per modules*category. We have between 200 and 400 modules per build * 4 keys -> around 1000 entries per build. The hudge amount of total entries lead to a fast overflow of the table sequence + this create important indexes. Also, most of the time, the js will manage the display of stats meaning that python will transform (build_id, category.key, value) into (build_id, {key: value}) for one category A new model makes use of a json field to store values for different modules in a json dict, on entry per category*build. (4 entry per build) The table will be renamed and migrate later
28 lines
754 B
Python
28 lines
754 B
Python
import logging
|
|
|
|
from odoo import models, fields, api, tools
|
|
from ..fields import JsonDictField
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
class BuildStat(models.Model):
|
|
_name = "runbot.build.stat"
|
|
_description = "Statistics"
|
|
_log_access = False
|
|
|
|
_sql_constraints = [
|
|
(
|
|
"build_config_key_unique",
|
|
"unique (build_id, config_step_id, category)",
|
|
"Build stats must be unique for the same build step",
|
|
)
|
|
]
|
|
|
|
build_id = fields.Many2one("runbot.build", "Build", index=True, ondelete="cascade")
|
|
config_step_id = fields.Many2one(
|
|
"runbot.build.config.step", "Step", ondelete="cascade"
|
|
)
|
|
category = fields.Char("Category", index=True)
|
|
values = JsonDictField("Value")
|