+ this.problems.forEach(p => this.setVname(p));
+ // Retrieve all problems' authors' names
+ let names = {};
+ this.problems.forEach(p => {
+ if (p.uid != this.st.user.id)
+ names[p.uid] = ""; //unknwon for now
+ else { console.log("assign " + this.st.user.name);
+ p.uname = this.st.user.name; console.log(p); console.log(this.problems); }
+ });
+ if (Object.keys(name).length > 0)
+ {
+ ajax("/users",
+ "GET",
+ { ids: Object.keys(names).join(",") },
+ res2 => {
+ res2.users.forEach(u => {names[u.id] = u.name});
+ this.problems.forEach(p => p.uname = names[p.uid]);
+ }
+ );
+ }
+ const pid = this.$route.query["id"];
+ if (!!pid)
+ this.showProblem(this.problems.find(p => p.id == pid));