Coverage for control/cust/criteria_record.py : 55%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from config import Config as C, Names as N
2from control.html import HtmlElements as H
3from control.record import Record
6CW = C.web
7CT = C.tables
9CONSTRAINED = CT.constrained
11MESSAGES = CW.messages
14class CriteriaR(Record):
15 """Logic for criteria records.
17 A `wrapHelp` method is added which presents the criteria
18 in *legend* form, to be displayed as help info on a `criteriaEntry` record.
19 """
21 def __init__(self, *args, **kwargs):
22 super().__init__(*args, **kwargs)
24 def wrapHelp(self):
25 info = H.join(
26 self.field(field, readonly=True).wrap(action=N.view)
27 for field in [N.typeContribution, N.remarks]
28 if field != N.typeContribution
29 )
31 detailsObj = self.DetailsClass(self)
32 detailsObj.fetchDetails(N.score)
33 details = detailsObj.wrapDetail(
34 N.score,
35 expanded=True,
36 readonly=True,
37 wrapMethod=N.wrapHelp,
38 combineMethod=lambda x: [H.dl(x)],
39 )
41 return H.div(info + details, cls="criteriahelp")