Skip to content

Commit edf14f5

Browse files
authored
Fixed building
1 parent 440a6bd commit edf14f5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/cls/community/post.cls

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Property Text As %String(MAXLEN = "");
3131

3232
Property Author As %String;
3333

34-
Property CommentsAmount As %Integer;
34+
Property CommentsAmount As %Integer [ Calculated, SqlComputeCode = { set {*} = ##class(community.post).GetCommentsAmount({Id})}, SqlComputed ];
3535

3636
Property PostType As %String(VALUELIST = ",Question,Article,Announcement,Digest,Discussion");
3737

@@ -50,6 +50,15 @@ Property Lang As %String;
5050

5151
Property Translated As %Boolean;
5252

53+
ClassMethod GetCommentsAmount(id) As %Integer
54+
{
55+
set result = 0
56+
set sql = "Select Count(Id) As CommentsAmount From community.comment Where Post = ? "
57+
set rs = ##class(%SQL.Statement).%ExecDirect(,sql, id)
58+
if rs.%Next() {set result = rs.CommentsAmount}
59+
Quit result
60+
}
61+
5362
Storage Default
5463
{
5564
<Data name="PostDefaultData">

0 commit comments

Comments
 (0)