LamTechConsult / obizr

0 stars 1 forks source link

Add My reviews from profile page #27

Open click2tman opened 7 years ago

click2tman commented 7 years ago

The link for this is already in my profile but when you click on it, its blank. Use the API http://slbr.sl/api/v1/slbiz/user/%/reviews.json to get the values for this view and create a view that looks like the picture below. When the user click on the review, you should redirect them to the review details page at http://localhost:8100/#/app/reviewDetails/% using API http://slbr.sl/api/v1/slbiz/%/reviews.json where % is the reviewid

My Account screen shot 2017-01-28 at 12 44 14 pm

My Reviews screen shot 2017-01-28 at 1 07 53 pm

Reviews Detail View screen shot 2017-01-28 at 1 20 04 pm

stevesolanki77 commented 7 years ago

Added support, but there a some issues with this...

the server sends 403 response

XMLHttpRequest cannot load http://slbr.sl/api/v1/slbiz/user/62776/reviews.json. Response for preflight has invalid HTTP status code 403 OPTIONS http://slbr.sl/api/v1/slbiz/user/62776/reviews.json 403 (Forbidden)

this only happens in the app though when sending from chrome directly it works perfectly. as i've found setting " Access-Control-Allow-Origin: * " from server side will fix this issue. currently it set to " Access-Control-Allow-Origin: localhost:8100 "


I've used the output json from chrome to create the views for my-Reviews,

there are small problems with incoming data. this below json shows a single review node that is sent by server.

"node": {
        "reviewid": "145",
        "biznid": "37331",
        "revieweruid": "62776",
        "biztitle": "KingHarman Rd Sat. (EPI) Hospital",
        "reviewtitle": "Nice Services",
        "reviewratings": "5\/5",
        "reviewdateposted": "5 days 18 hours ago",
        "reviewmessage": "Nice Services",
        "bizimage": {
          "src": "http:\/\/slbr.sl\/sites\/default\/files\/styles\/bis_mob_view\/public\/default_images\/health-banner.jpg?itok=FSNhPuyG",
          "alt": ""
        }
      }
    }
  1. the reviewid has some problems , when injecting it into reviewDetails page it is blank, so possibly the review id is wrong. when cross checked with other reviews the other reviews had a field cid which was used to retrieve the review. there is no cid in this data.

  2. the reviewRatings is coming in the form of a string like this "4/5", though we can write a hack to convert it into integer. it's not recommended ( hacky codes may cause serious issues in future ) to do this , it will be better if we get direct integer from server.

click2tman commented 7 years ago

http://slbr.sl/api/v1/slbiz/user/62776/reviews.json is not a public user URL. You will be unable to see this if you are not login to the app. Remember that this is the my reviews view. It displays the reviews of a specific user that is log in. So If I am a user with uid=62776 and I am log in to the app, If I visit http://slbr.sl/api/v1/slbiz/user/62776/reviews.json, I will see my reviews. If I want to see the details of my particular review, I will visit http://slbr.sl/api/v1/slbiz/%/reviews.json and replace % with the value from [reviewid].

4/5 is the correct output for ratings. There is code in app to handle this properly already. There is functionality behind the number of ratings. I changed reviewid to cid from API output.

stevesolanki77 commented 7 years ago

yes. that is a private url. but due to the above stated reasons it isn't working on the browser , though the problem doesn't arise when launching it as an app into my android phone.

stevesolanki77 commented 7 years ago

and there are some issues with the way the reviewDetails page has been setup already. so, i will need the bid (business id) too from the api output

click2tman commented 7 years ago

The business ID is already there. Its biznid: "26701". You can check like http://slbr.sl/node/26701 to see if its a valid business ID. I have changed the field name to 'nid' which is the same as what is used on other business pages and reviewid is now cid in all API

click2tman commented 7 years ago

This is not working as desired. You hard coded http://slbr.sl/api/v1/slbiz/user/62776/reviews.json and the only reviews being displayed are those written by you. Your user id or uid is 62776. When I login on the mobile app, my uid is 1 so my URL becomes http://slbr.sl/api/v1/slbiz/user/1/reviews.json. This means the path or API request should be dynamic. http://slbr.sl/api/v1/slbiz/user/[uid]/reviews.json

I have attached a screenshot of what I see below.

screen shot 2017-02-24 at 11 42 44 am

Also note that the screen I am expecting here should look like this. It was attached in the original issue here and above. This is the same view used on the business details page. Look at the business_details.html code. From line 118 to 132. That is the view you need for the display. when I click on the review, it shows the review details and when I click on the avatar of the reviewer, it displays the reviewer's profile with their reviews below.

screen shot 2017-02-24 at 11 50 09 am

stevesolanki77 commented 7 years ago

It's just for a check i was doing .. actually there is a problem while running it in browser as i've explained in the comment above. I've removed that code and pushed please chekc now.

stevesolanki77 commented 7 years ago

Please look into the API problem . It's getting harder to test things as all the API calls are throwing error on browser. Thought working fine on phone.