Utopian-io Task Request: SteemLogs.info Buttons and more

in #utopian-io5 years ago

Repository
Pull Request
Task Request

I've continued picking up task request from SteemLogs.info, and this one was for the load more and load all buttons, although I fixed a bit more that we had talked about.

Load More and Load All Buttons

Screen Shot 2019-04-12 at 11.29.00 AM.png

The main part of the request was getting the load more button set up, and adding the load all button. The logic behind is this pretty easy; you just call the get_user_posts function I updated in the last task request, either a single time per button click for load more, or until you've got them all if they hit load all. Here's the load all view logic:

Screen Shot 2019-04-12 at 11.45.14 AM.png

I set it up similarly to how the load more view logic was already implemented, but with a loop. The loop gets either 1000 (the max amount you can get at once) or next_entry_id posts at once, whichever is smaller. This should make it the fastest possible time to load all posts in most cases. It maybe could get a bit faster, but that would require loading less information about each post, which may not be preferable.

I also added a 'load_all_posts.js' file and load_all_posts function in the static js files, which do a similar job as the load_posts.js file and load_posts function, which is what the load more button calls. I added some comments to each file for clarity of what they were doing for future people (since I had to think some to figure out the old code). This also included added a url for load all into the urls.py file.

Other changes

I updated beem to 0.20.20 because it was pretty far behind for some reason, looks like only one or two more task requests until steem-py is no longer required. I also fixed a bug in dev mode that caused the load button to not work in dev mode, not sure if there were other issues with it but that one made it impossible to test anyways. To load static files in dev mode, you have to add some code to the app's urls file, so that there's something that points to the static file. This is done pretty easily, by adding an import and a line in app/urls.py

from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# add the static file patterns to url patterns
urlpatterns += staticfiles_urlpatterns()

I also had to change STATIC_ROOT to '/static/' in settings.py, but not sure what that was connected to. It's the same as STATIC_URL now, so maybe you only need one, but I couldn't find a lot of info on it.

I added comments for all the code I changed, and also removed some that don't relate to the code anymore.

Vote For Me as Your Witness

Cheers, thanks for reading! If you like my tools and content and would like to see more, Vote for me as witness or proxy your votes and I'll pick the best witnesses for you!

My Projects

Pjtaggartv2- My website, built in React Typescript with Redux and dSteem, with more info about me as well as some Steem utilities you can use!

Pywit- A witness tool-kit built in Python on top of Holger80's Beempy.

Sort:  

Good work!

I know that's out of the task request, but regarding stm = Steem() on get_user_posts, maybe getting a general factory function returns a Steem instance with a configurable list of nodes may help.

Having lots apps using that famous Steem instance, I can say you change this list from time to time due to temporary problems on public nodes, so, having this configurable and global makes sense.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Chat with us on Discord.

[utopian-moderator]

Thank you for your review, @emrebeyler! Keep up the good work!

I'm accepting this right now! Thank you for helping us with @steemlogs!

Hi, @petertag!

You just got a 0.19% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 12 of all contributions awarded today. You can find the TOP DAILY TRUFFLE PICKS HERE.

I upvoted your contribution because to my mind your post is at least 6 SBD worth and should receive 151 votes. It's now up to the lovely Steemit community to make this come true.

I am TrufflePig, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, you can find an explanation here!

Have a nice day and sincerely yours,
trufflepig
TrufflePig

Hi @petertag!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @petertag!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.30
TRX 0.11
JST 0.033
BTC 63968.82
ETH 3136.80
USDT 1.00
SBD 4.28