Skip to content

Commit b9bf5bd

Browse files
committed
Update to jaclang v 0.8.4
1 parent 765fc90 commit b9bf5bd

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

littleX_BE/littleX.impl.jac

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ impl Tweet.remove_like {
5454
impl Tweet.comment {
5555
current_profile = [root-->(`?Profile)];
5656
comment_node = current_profile[0] +>:Post():+> Comment(content=visitor.content);
57-
_.perm_grant(comment_node[0], level="CONNECT");
57+
grant(comment_node[0], level=ConnectPerm);
5858
self ++> comment_node[0];
5959
report comment_node[0];
6060
}
@@ -89,18 +89,18 @@ impl Comment.delete {
8989
impl visit_profile.visit_profile {
9090
visit [-->(`?Profile)] else {
9191
new_profile = here ++> Profile();
92-
_.perm_grant(new_profile[0], level="CONNECT");
92+
grant(new_profile[0], level=ConnectPerm);
9393
visit new_profile;
9494
}
9595
}
9696

9797
impl load_user_profiles.load_profiles {
9898
self.profiles: list = [];
9999

100-
for user in NodeAnchor.Collection.find({"name": "Profile"}) {
101-
user_node = user.archetype;
100+
for each_root in allroots() {
101+
profile = [each_root --> (`?Profile)][0];
102102
self.profiles.append(
103-
{"name": user_node.username, "id": jid(user_node)}
103+
{"name": profile.username, "id": jid(profile)}
104104
);
105105
}
106106
}
@@ -112,13 +112,12 @@ impl load_user_profiles.report_profiles {
112112
impl create_tweet.tweet {
113113
embedding = vectorizer.fit_transform([self.content]).toarray().tolist();
114114
tweet_node = here +>:Post():+> Tweet(content=self.content, embedding=embedding);
115-
_.perm_grant(tweet_node[0], level="CONNECT");
115+
grant(tweet_node[0], level=ConnectPerm);
116116
report tweet_node;
117117
}
118118

119119
impl load_feed.load {
120-
visit [->:Post:->];
121-
ignore [--> (`?Comment)];
120+
visit [-->(`?Tweet)];
122121
for user_node in [->:Follow:->(`?Profile)] {
123122
visit [user_node-->(`?Tweet)];
124123
}

littleX_BE/littleX.jac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import datetime;
2-
import from jac_cloud.core.archetype { NodeAnchor }
32
import numpy;
43
import from sklearn.feature_extraction.text { TfidfVectorizer }
54
import from sklearn.metrics.pairwise { cosine_similarity }

littleX_BE/littleX.test.jac

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,9 @@ test load_feed {
9797
check all(
9898
[ (feeds.results[i]['similarity'][0] >= feeds.results[i + 1]['similarity'][0]) for i in range(len(feeds.results) - 1) ]
9999
);
100+
}
101+
102+
test test_load_user_profiles {
103+
load_user_walker = root spawn load_user_profiles();
104+
check load_user_walker.profiles;
100105
}

0 commit comments

Comments
 (0)