Skip to content

Commit 3a25649

Browse files
committed
Groups were moved to tags
1 parent 46824a9 commit 3a25649

17 files changed

Lines changed: 81 additions & 29 deletions

src/cls/BI/Comment.cls

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
Include Community
2+
13
///
24
Class BI.Comment Extends %DeepSee.CubeDefinition [ DependsOn = Community.Comment, ProcedureBlock ]
35
{
46

57
/// Cube definition from Architect.
68
XData Cube [ XMLNamespace = "http://www.intersystems.com/deepsee" ]
79
{
8-
<cube xmlns="http://www.intersystems.com/deepsee" name="Comment" displayName="Comment" disabled="false" abstract="false" sourceClass="Community.Comment" countMeasureName="%COUNT" bucketSize="8" bitmapChunkInMemory="false" precompute="0" disableListingGroups="false">
10+
<cube xmlns="http://www.intersystems.com/deepsee" name="Comment" displayName="Comment" disabled="false" abstract="false" sourceClass="Community.Comment" buildRestriction="Post-&gt;Deleted = 0 and Post-&gt;Published = 1 " countMeasureName="%COUNT" bucketSize="8" bitmapChunkInMemory="false" precompute="0" disableListingGroups="false">
911
<dimension name="Post" disabled="false" hasAll="false" allCaption="All Post" allDisplayName="Post" type="data" hidden="false" showHierarchies="default">
1012
<hierarchy name="H1" disabled="false" hidden="false">
1113
<level name="AuthorName" disabled="false" sourceProperty="Post.Author.Name" list="false" useDisplayValue="true" useAsFilter="true" hidden="false">
@@ -22,9 +24,9 @@ XData Cube [ XMLNamespace = "http://www.intersystems.com/deepsee" ]
2224
</dimension>
2325
<dimension name="Group" disabled="false" hasAll="false" allCaption="All %ID" allDisplayName="%ID" type="data" calendar="gregorian" iKnowType="entity" hidden="false" showHierarchies="default">
2426
<hierarchy name="H1" disabled="false" hidden="false">
25-
<level name="GroupName" disabled="false" sourceExpression="%cube.GetGroupName(%source.Post.%ID,&quot;Name&quot;)" list="false" useDisplayValue="true" useAsFilter="true" hidden="false">
27+
<level name="GroupName" disabled="false" sourceExpression="%cube.GetGroupName(%source.Post.%ID,&quot;Name&quot;)" list="true" listDelimiter="," useDisplayValue="true" useAsFilter="true" hidden="false">
2628
</level>
27-
<level name="PostName" disabled="false" sourceProperty="Post.Name" list="false" useDisplayValue="true" useAsFilter="true" hidden="false">
29+
<level name="PostName" disabled="true" sourceProperty="Post.Name" list="false" useDisplayValue="true" useAsFilter="true" hidden="false">
2830
</level>
2931
</hierarchy>
3032
</dimension>
@@ -113,12 +115,21 @@ ClassMethod GetAddedPercent(date)
113115
ClassMethod GetGroupName(postId, prop As %String) As %String
114116
{
115117
set result = ""
116-
set sql = "Select GroupClass->"_prop_" As GroupProp From Community.GroupPost Where Post = ?"
118+
/*set sql = "Select GroupClass->"_prop_" As GroupProp From Community.GroupPost Where Post = ?"
117119
set rs = ##class(%SQL.Statement).%ExecDirect(,sql, postId)
118120
while rs.%Next(){
119121
if result = "" {set result = rs.GroupProp}
120122
else{set result = result_","_rs.GroupProp}
121-
}
123+
}*/
124+
for i=1:1:$l($$$MainTags,",") set intag($p($$$MainTags,",",i))=""
125+
&sql(select tags into :tags from Community.Post where id = :postId)
126+
for i=1:1:$l(tags, ",") {
127+
set tag = $p(tags, ",", i)
128+
if $d(intag(tag)) {
129+
if result = "" {set result = tag}
130+
else{set result = result_","_tag}
131+
}
132+
}
122133
Quit result
123134
}
124135

src/cls/BI/CommentCopy.cls

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
Include Community
2+
13
///
24
Class BI.CommentCopy Extends %DeepSee.CubeDefinition [ DependsOn = (Community.Comment, Community.Post), ProcedureBlock ]
35
{
46

57
/// Cube definition from Architect.
68
XData Cube [ XMLNamespace = "http://www.intersystems.com/deepsee" ]
79
{
8-
<cube xmlns="http://www.intersystems.com/deepsee" name="CommentCopy" displayName="CommentCopy" disabled="false" abstract="false" sourceClass="Community.Comment" countMeasureName="COMCOUNT" bucketSize="8" bitmapChunkInMemory="false" precompute="0" disableListingGroups="false">
10+
<cube xmlns="http://www.intersystems.com/deepsee" name="CommentCopy" displayName="CommentCopy" disabled="false" abstract="false" sourceClass="Community.Comment" buildRestriction="Post-&gt;Deleted = 0" countMeasureName="COMCOUNT" bucketSize="8" bitmapChunkInMemory="false" precompute="0" disableListingGroups="false">
911
<dimension name="AuthorName" disabled="false" sharesFrom="Post" hasAll="false" allCaption="All AuthorName" allDisplayName="AuthorName" type="data" hidden="false" showHierarchies="default">
1012
</dimension>
1113
<measure name="Comments" disabled="false" sourceProperty="Id" aggregate="COUNT" type="number" scale="0" hidden="false" searchable="false">
@@ -42,12 +44,21 @@ ClassMethod IsNonOwnPostComment(commentLink)
4244
ClassMethod GetGroupName(postId, prop As %String) As %String
4345
{
4446
set result = ""
45-
set sql = "Select GroupClass->"_prop_" As GroupProp From Community.GroupPost Where Post = ?"
47+
/*set sql = "Select GroupClass->"_prop_" As GroupProp From Community.GroupPost Where Post = ?"
4648
set rs = ##class(%SQL.Statement).%ExecDirect(,sql, postId)
4749
while rs.%Next(){
4850
if result = "" {set result = rs.GroupProp}
4951
else{set result = result_","_rs.GroupProp}
50-
}
52+
}*/
53+
for i=1:1:$l($$$MainTags,",") set intag($p($$$MainTags,",",i))=""
54+
&sql(select tags into :tags from Community.Post where id = :postId)
55+
for i=1:1:$l(tags, ",") {
56+
set tag = $p(tags, ",", i)
57+
if $d(intag(tag)) {
58+
if result = "" {set result = tag}
59+
else{set result = result_","_tag}
60+
}
61+
}
5162
Quit result
5263
}
5364

src/cls/BI/PC.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///
2-
Class BI.PC Extends %DeepSee.SubjectArea [ CompileAfter = (BI.Post, BI.CommentCopy, BI.ViewsHistoryCopy), DependsOn = (BI.Post, BI.CommentCopy, BI.ViewsHistoryCopy), ProcedureBlock ]
2+
Class BI.PC Extends %DeepSee.SubjectArea [ DependsOn = (BI.Post, BI.CommentCopy, BI.ViewsHistoryCopy), ProcedureBlock ]
33
{
44

55
/// SubjectArea definition from Architect.

src/cls/BI/Post.cls

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Include Community
2+
13
///
24
Class BI.Post Extends %DeepSee.CubeDefinition [ DependsOn = Community.Post, ProcedureBlock ]
35
{
@@ -125,6 +127,12 @@ XData Cube [ XMLNamespace = "http://www.intersystems.com/deepsee" ]
125127
</level>
126128
</hierarchy>
127129
</dimension>
130+
<dimension name="Author" disabled="false" hasAll="false" allCaption="All Author1" allDisplayName="Author1" type="data" calendar="gregorian" iKnowType="entity" hidden="false" showHierarchies="default">
131+
<hierarchy name="H1" disabled="false" hidden="false">
132+
<level name="Author" disabled="false" sourceProperty="Author.Name" list="false" useDisplayValue="true" useAsFilter="true" hidden="false">
133+
</level>
134+
</hierarchy>
135+
</dimension>
128136
<measure name="CommentsAmount" disabled="false" sourceProperty="CommentsAmount" aggregate="SUM" type="number" hidden="false" searchable="false">
129137
</measure>
130138
<measure name="Posts" disabled="false" sourceProperty="%ID" aggregate="COUNT" type="number" hidden="false" searchable="false" formatString="#">
@@ -179,12 +187,21 @@ ClassMethod GetAddedPercent(date)
179187
ClassMethod GetGroupName(postId, prop As %String) As %String
180188
{
181189
set result = ""
182-
set sql = "Select GroupClass->"_prop_" As GroupProp From Community.GroupPost Where Post = ?"
190+
/*set sql = "Select GroupClass->"_prop_" As GroupProp From Community.GroupPost Where Post = ?"
183191
set rs = ##class(%SQL.Statement).%ExecDirect(,sql, postId)
184192
while rs.%Next(){
185193
if result = "" {set result = rs.GroupProp}
186194
else{set result = result_","_rs.GroupProp}
187-
}
195+
}*/
196+
for i=1:1:$l($$$MainTags,",") set intag($p($$$MainTags,",",i))=""
197+
&sql(select tags into :tags from Community.Post where id = :postId)
198+
for i=1:1:$l(tags, ",") {
199+
set tag = $p(tags, ",", i)
200+
if $d(intag(tag)) {
201+
if result = "" {set result = tag}
202+
else{set result = result_","_tag}
203+
}
204+
}
188205
Quit result
189206
}
190207

src/cls/Community/Comment.cls

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Include Community
2+
13
Class Community.Comment Extends %Persistent [ DependsOn = (Community.Member, Community.Post) ]
24
{
35

@@ -19,7 +21,7 @@ Relationship Author As Community.Member [ Cardinality = one, Inverse = Comments,
1921

2022
Index AuthorIndex On Author;
2123

22-
Property Link As %String(MAXLEN = 250) [ SqlComputeCode = {set {*} = "https://community.intersystems.com/" _ $case({Type}, "comment":"comment/", :"node/") _ {Id}}, SqlComputed, SqlComputeOnChange = %%INSERT ];
24+
Property Link As %String(MAXLEN = 250) [ SqlComputeCode = {set {*} = $$$Server _ $case({Type}, "comment":"comment/", :"node/") _ {Id}}, SqlComputed, SqlComputeOnChange = "%%INSERT" ];
2325

2426
Index Link On Link [ Unique ];
2527

@@ -93,7 +95,7 @@ Storage Default
9395
<IdLocation>^Community.CommentD</IdLocation>
9496
<IndexLocation>^Community.CommentI</IndexLocation>
9597
<StreamLocation>^Community.CommentS</StreamLocation>
96-
<Type>%Library.CacheStorage</Type>
98+
<Type>%Storage.Persistent</Type>
9799
}
98100

99101
}

src/cls/Community/Group.cls

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Include Community
2+
13
Class Community.Group Extends %Persistent [ SqlTableName = GroupClass ]
24
{
35

@@ -11,7 +13,7 @@ Relationship Posts As Community.GroupPost [ Cardinality = many, Inverse = GroupC
1113

1214
Property Name As %String(MAXLEN = 150);
1315

14-
Property Link As %String(MAXLEN = 250) [ SqlComputeCode = {set {*} = "https://community.intersystems.com/" _ "node/" _ {Nid}}, SqlComputed, SqlComputeOnChange = %%INSERT ];
16+
Property Link As %String(MAXLEN = 250) [ SqlComputeCode = {set {*} = $$$Server _ "node/" _ {Nid}}, SqlComputed, SqlComputeOnChange = "%%INSERT" ];
1517

1618
Index Link On Link [ Unique ];
1719

@@ -66,7 +68,7 @@ Storage Default
6668
<IdLocation>^Community.GroupD</IdLocation>
6769
<IndexLocation>^Community.GroupI</IndexLocation>
6870
<StreamLocation>^Community.GroupS</StreamLocation>
69-
<Type>%Library.CacheStorage</Type>
71+
<Type>%Storage.Persistent</Type>
7072
}
7173

7274
}

src/cls/Community/GroupPost.cls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Class Community.GroupPost Extends %Persistent [ DependsOn = (Community.Group, Co
33

44
Relationship GroupClass As Community.Group [ Cardinality = one, Inverse = Posts, OnDelete = cascade, Required ];
55

6-
Relationship Post As Community.Post [ Cardinality = one, Inverse = GroupsClass, OnDelete = cascade, Required ];
6+
// Relationship Post As Community.Post [ Cardinality = one, Inverse = GroupsClass, OnDelete = cascade, Required ];
77

8-
Index GroupPost On (GroupClass, Post) [ Unique ];
8+
// Index GroupPost On (GroupClass, Post) [ Unique ];
99

1010
Storage Default
1111
{
@@ -25,7 +25,7 @@ Storage Default
2525
<IdLocation>^Community.GroupPostD</IdLocation>
2626
<IndexLocation>^Community.GroupPostI</IndexLocation>
2727
<StreamLocation>^Community.GroupPostS</StreamLocation>
28-
<Type>%Library.CacheStorage</Type>
28+
<Type>%Storage.Persistent</Type>
2929
}
3030

3131
}

src/cls/Community/Member.cls

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Include Community
2+
13
Class Community.Member Extends %Persistent
24
{
35

@@ -19,7 +21,7 @@ Property LastName As %String(MAXLEN = 255);
1921

2022
Property Created As %TimeStamp;
2123

22-
Property Link As %String(MAXLEN = 150) [ SqlComputeCode = {set {*} = "https://community.intersystems.com/" _ "user/" _ {Uid}}, SqlComputed, SqlComputeOnChange = %%INSERT ];
24+
Property Link As %String(MAXLEN = 150) [ SqlComputeCode = {set {*} = $$$Server _ "user/" _ {Uid}}, SqlComputed, SqlComputeOnChange = "%%INSERT" ];
2325

2426
Index Link On Link [ Unique ];
2527

@@ -73,7 +75,7 @@ Storage Default
7375
<IdLocation>^Community.Public.MemberD</IdLocation>
7476
<IndexLocation>^Community.Public.MemberI</IndexLocation>
7577
<StreamLocation>^Community.Public.MemberS</StreamLocation>
76-
<Type>%Library.CacheStorage</Type>
78+
<Type>%Storage.Persistent</Type>
7779
}
7880

7981
}

src/cls/Community/Post.cls

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Include Community
2+
13
Class Community.Post Extends %Persistent [ DependsOn = Community.Member ]
24
{
35

@@ -29,7 +31,7 @@ Property Deleted As %Boolean;
2931

3032
Property Text As %String(MAXLEN = "");
3133

32-
Property Link As %String(MAXLEN = 150) [ SqlComputeCode = {set {*} = "https://community.intersystems.com/" _ "node/" _ {Nid}}, SqlComputed, SqlComputeOnChange = %%INSERT ];
34+
Property Link As %String(MAXLEN = 150) [ SqlComputeCode = {set {*} = $$$Server _ "node/" _ {Nid}}, SqlComputed, SqlComputeOnChange = "%%INSERT" ];
3335

3436
Index Link On Link [ Unique ];
3537

@@ -39,7 +41,7 @@ Relationship Author As Community.Member [ Cardinality = one, Inverse = Posts, On
3941

4042
Index AuthorIndex On Author;
4143

42-
Relationship GroupsClass As Community.GroupPost [ Cardinality = many, Inverse = Post ];
44+
// Relationship GroupsClass As Community.GroupPost [ Cardinality = many, Inverse = Post ];
4345

4446
Property CommentsAmount As %Integer [ Calculated, SqlComputeCode = { set {*} = ##class(Community.Post).GetCommentsAmount({Id})}, SqlComputed ];
4547

@@ -135,7 +137,7 @@ Storage Default
135137
<IdLocation>^Community.PostD</IdLocation>
136138
<IndexLocation>^Community.PostI</IndexLocation>
137139
<StreamLocation>^Community.PostS</StreamLocation>
138-
<Type>%Library.CacheStorage</Type>
140+
<Type>%Storage.Persistent</Type>
139141
}
140142

141143
}

src/cls/Community/Utils.cls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ ClassMethod UpdateCubes(verbose = 1) As %Status
6767
/// Reported as prodlog 141297
6868
set st1 = $$$OK
6969
}
70+
if (cube="POST") continue
7071

7172
set st = $$$ADDSC(st, st1)
7273
}

0 commit comments

Comments
 (0)