Warning: session_start(): open(/var/lib/php/sessions/sess_3786pqltm6t7n7gplhcjbq26fc, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
concept AppliedRule {
S ruleID;
S modifiedRule;
S outText;
S judgement;
S comments;
S varMap;
S matchedRuleStruct;
S intention, context;
}
cmodule AppliedRules > DynCRUD {
start {
dbIndexing(AppliedRule, 'ruleID);
for (AppliedRule r : list()) fixEntry(r);
dm_registerAs('gazelleFeedbackCRUD);
}
enhanceFrame { internalFrameIcon(f, gazelle_frameIcon()); }
void fixEntry(AppliedRule r) {
if (r.ruleID == null) {
S ruleID = "?";
pcall {
ruleID = gazelle_ruleIDFromMatchedRuleStruct(r.matchedRuleStruct);
}
cset(r, +ruleID);
}
if (r.varMap == null) {
S varMap = "";
pcall {
varMap = sfu(gazelle_varMapFromMatchedRuleStruct(r.matchedRuleStruct);
}
cset(r, +varMap);
}
if (r.outText == null) {
S outText = "";
pcall {
outText = gazelle_outTextFromMatchedRuleStruct(r.matchedRuleStruct);
}
cset(r, +outText);
}
if (r.modifiedRule == null) {
S modifiedRule = "";
pcall {
modifiedRule = gazelle_modifiedRuleFromMatchedRuleStruct(r.matchedRuleStruct);
}
cset(r, +modifiedRule);
}
}
// API
L feedbackForRule(S ruleID) {
ret conceptsWhere AppliedRule(+ruleID);
}
Map stats() {
ret multiSetToMap(collectMultiSet ruleID(concepts()));
}
Map statsByJudgement() {
new MultiSet ms;
for (AppliedRule r : concepts())
ms.add(r.ruleID + "/" + r.judgement);
ret multiSetToMap(ms);
}
AppliedRule uniqConcept(O... params) {
AppliedRule r = super.uniqConcept(params);
fixEntry(r);
ret r;
}
}