Closed akashdeepsinghal closed 8 years ago
@akigupta131 This is a wrong approach to solving the problem. The values in the view should come from the analyze controller, and not from the actual values of the logged in user. This is so that the data can be processed before binding it to the view.
@aneeshd16 In the home view, value comes from root right? I mean if we have stored the values for logged in user in rootScope, then whenever we switch to a different view, user is same so those are not going to be changed. So why call an API for again? (Though I have not removed the API call) PS: My bad, if I misunderstood something.
A better approach would be to not show the empty profile card until the data is obtained to display the information of the user. I agree with @aneeshd16 that this is not how the values should come in from.
@aneeshd16 @sudheesh001 I asked earlier too, Does the profile box on reports page show data(Display Picture, Banner Name etc) for the logged in user or the name I am 'creating new report' for?
Earlier, I got answer from Aneesh that it shows data for logged in user. And if that is the case, I am still not getting, why is that approach not right.
@akigupta131 It looks like it's definitely providing the results for the currently logged in user and when an explicit query is made it can give the new results for the new user who is queried.
@aneeshd16 But since I was under impression that data is for logged in user, according to our discussion (Or I might have confused), so I made the solution for logged in user and not for the one for whom query is made. So my solution will not work.
Though some changes can be made to the current main code (not mine) for stabilizing this issue.
EDIT:
I guess no change needed in loklak_webclient.
I was accessing from localhost. And I don't know why, contrary to Loklak API Docs, I am not recieving any data on localhost while I receive full data from Loklac server API. PFA the screenshots.
Localhost:- http://localhost:9000/api/user.json?screen_name=loklak_app
V/S
Loklak Server:- http://loklak.org/api/user.json?screen_name=akigupta131
So since data.user
is empty, The code from analyze.js ends the further processing and
var followerstotal=data.user.followers_count;
vm.topology = data.topology;
$scope.followerstotal=data.user.followers_count;
$scope.followingstotal=data.user.friends_count;
$scope.name=data.user.name;
$scope.profilepicurl=data.user.profile_image_url_https;
$scope.profilebanner=data.user.profile_banner_url;
$scope.tweetcount=data.user.statuses_count;
All the entries are left undefined. Also, that is the reason why All the analysis data is undefined.
closing as #575 postponed due to it being related to loklak_server
Old
v/s
New