7

There are tabs for featured and unanswered questions. Is there a way to combine them?

2

2 Answers 2

8

You can use the following Stack Snippet to search on Stack Overflow for bountied (featured) questions, in a tag, that have not been answered. I use the boolean is_answered from the StackAPI but that follows the SE defintion, meaning no answers with a positive score.

(function () {
  var api = {
    url: 'https://api.stackexchange.com/2.2/',
    endpoint: 'questions/featured',
    params: { 
      site: 'stackoverflow',
      pagesize: 100,
      order: 'desc',
      sort: 'activity',
      tagged: '',
      Filter: '!bAYUP(Wob-TiH(',
      key: 'V8eFZuqvkHflWf8nT6kx7w(('
      }
    };    
    
  function createUrl(ap) {
    var ep = ap.url + ap.endpoint +'?',
     nv = [];
    $.each(ap.params, function (k,v) {
       nv.push(k + '=' + v);
    });
    console.log(ep + nv.join('&'));
    return ep + nv.join('&');
  }
 
  function enableLoad(func) {
    $('#load').show();
    $('#load').one('click', func);
  }
   
  // load a page of featured questions
  function load(page) {
    api.params.page = page;
    api.params.site = 'stackoverflow';
    $('#load').hide();
    $.get(createUrl(api), function (data) {
      var i, 
          list = $('#fav'),
          next;
      for(i = 0; i < data.items.length; i = i +1) {
          // not answered, SE style
          // otherwise use answer_count === 0  
          if (!data.items[i].is_answered)
          {
            list.append(
              $('<div></div>').append(
                $('<img/>')
                .attr('src','//cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico')
                .attr('title','Stack Overflow'),
              $('<a></a>')
                .attr('href', data.items[i].link)
                .attr('title', data.items[i].bounty_amount)
                .html(data.items[i].title)
            ));
          }
      }
      if (data.has_more) {
        next = function () { load(page + 1); };
        if (data.backoff !== undefined) {
          window.setTimeout( function () {
              enableLoad(next);
            }, 
            data.backoff * 1000);  
        } else {
            enableLoad(next);
        }
      } else {
         $('#load').hide(); 
         $('#search').enable();
      }
    });
  }
  
  $('#search').on('click', function () {
      $('#fav').empty();
      api.params.tagged = $('#tag').val();
      load(1);
      $('#search').disable();
    });
}());
#onhold div {
  overflow:hidden;
  text-overflow: ellipsis;
  white-space:nowrap;
  }

#load {
  padding: 1em;
  text-align: center; 
  cursor: pointer
  }

img {
  height: 1em;
  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="error" style="display:none">
</div>
<div>
  <label for="tag">Tag (use one!):</label>
  <input id="tag"/>
</div>
<div>
  <button id="search">Search</button>
</div>
<div id="fav">
  
</div>
<div id="load" style="display:none">
 Click to load more ...
</div>

5
  • I didn't manage to run code snippet/code, is it working ?
    – Ori Marko
    Nov 23, 2017 at 6:01
  • @user7294900 it is for me, if I enter the PHP tag. Which tag did you use?
    – rene
    Nov 23, 2017 at 7:41
  • It's ok, I search for a tag without bounty and got no answer, is there a way to search by all my tags?
    – Ori Marko
    Nov 23, 2017 at 7:45
  • Well, you're free to fork it and add a sensible error if no tags appear ;) It is possible to find the bounties for your tags by first calling api.stackexchange.com/docs/tags-on-users and then call the existing code for each tag found. Something for a rainy weekend day to add.
    – rene
    Nov 23, 2017 at 7:58
  • 1
    Now I have a reason to be happy it's raining
    – Ori Marko
    Nov 23, 2017 at 8:02
0

You can use Custom Question Lists, which you can opt in to by going to your profile (not sure how long it will take to be enabled).

You just need to check the "Has bounty" checkbox, check the "No answers" checkbox, and add your tag(s):

I'm not sure what happened to "unanswered-because-no-answers-score-over-0", since there's currently no way to do this at all with Custom Question Lists.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .