Applied Graph Algorithms - Cypher Refresher problem with getting User data

I cannot get User data, the very first step in this training. What ever I do, I get NumReviews 0. In the console there is an message Error, but the comment is empty. Any ideas?

Srdjan

It looks that I solved this myself :) It was puzzling for me why this simple step is not working, so I went through files and found the query that was supposed to get things done:

It is in exercises/exercise0.js:

export const FETCH_USER_INFO_QUERY = `
MATCH (u:User {id: $userId})
MATCH (u)-[:WROTE]->(r:Review)
WITH u, avg(r.stars) AS averageStars
MATCH (u)-[:WROTE]->(:Review)-[:REVIEWS]->(:Business)-[:IN_CATEGORY]-(c:Category)
WITH *, c.name AS category, COUNT(*) AS num ORDER BY num DESC
RETURN u {
  .name, 
  numReviews: toFloat(SIZE((u)-[:WROTE]->(:Review))), 
  categories: COLLECT(category)[..5],
  averageStars
} AS userInfo
`;

I tried this query in Neo4j browser and got error for variable u and averageStars, and if you look closely averageStars is not in the last WITH. When I did this it worked. I thought that WITH * was supposed to return all previous variables?:

export const FETCH_USER_INFO_QUERY = `
MATCH (u:User {id: $userId})
MATCH (u)-[:WROTE]->(r:Review)
WITH u, avg(r.stars) AS averageStars
MATCH (u)-[:WROTE]->(:Review)-[:REVIEWS]->(:Business)-[:IN_CATEGORY]-(c:Category)
WITH u, averageStars, c.name AS category, COUNT(*) AS num ORDER BY num DESC
RETURN u {
  .name, 
  numReviews: toFloat(SIZE((u)-[:WROTE]->(:Review))), 
  categories: COLLECT(category)[..5],
  averageStars
} AS userInfo
`;

Srdjan

WITH * should work.

Elaine