Update on Steem Bot Analysis :Range Selection for dates

Words
172
Reading
1 min
Listen
Play
8y

New Features added to SteemBotAnalysis

SteemBotAnalysis is a tool developed to analyze :

  • How old are the posts at the date of upvote
  • According to the chosen bots
  • According to the chosen date ( with the new feature, the range of dates )

Features added

  • Before

Only one-day selection was available.The analysis was made on a single day.

image.png

  • After

A range of selection is available with START DATE and END DATE

image.png

With this improvement, it is possible to make the analysis for a longer range of time in one page.

Implementation of the changes

  • Addition of the second date picker
<form action="/action_page.php" class="gwd-form-d3aa">
      Start Date:
      <input type="date" id="Sday" name="Sday" value="">End Date:
      <input type="date" id="Dday" name="Dday" value="">
    </form>

With this addition, the date picker also starts from the current date with the PHP code implemented.

  • Selecting & filtering according to the date
var selectedDate = document.getElementById('Sday').value;
          var selectedDateUnix = moment(selectedDate, "YYYY-MM-DD").valueOf();
          // date range addition
          var nextDate = document.getElementById('Dday').value;
          var nextDateUnix = moment(nextDate, "YYYY-MM-DD").valueOf();
        
          steem.api.getAccountVotes(bot, function(err, result) {
            var accountVotes = result;
            // Filter and return all of the account votes between the selected date and the next
            var accountVotesFilteredForSelectedDate = _.filter(accountVotes, function(accountVote) {
              var accountVoteDateUnix = moment(accountVote.time).valueOf();
              return (accountVoteDateUnix >= selectedDateUnix && accountVoteDateUnix <= nextDateUnix);
            });

The full code for the project can be found here

Links

Steem Bot Analysis: https://fdsteemtools.neocities.org/botanalysis.html

GitHub: https://github.com/firedreamgames/steembotanalysis

Contact

@FireDream - Steemit

firedream@firedream#3528 - Discord

Proof of Work

image.png

Link to relevant lines in the code on GitHub and explain briefly what you added/changed.

Update on Steem Bot Analysis :Range Selection for dates | Ecency