Commit 9e1ea891 authored by Adam Rambousek's avatar Adam Rambousek
Browse files

fix #149 api pro notifikace

parent 38b83d0d
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -899,10 +899,11 @@ class TeCu < DictSedna
    }
  end

  def list_notifications(user='', term='', role='', time_from='', time_to='', from='')
  def list_notifications(user='', term='', role='', time_from='', time_to='', from='', read='')
    res = []
    conds = []
    conds << '(read=0)'
    conds << '(read=0)' if read == '' or read == '0'
    conds << '(read=1)' if read == '1'
    conds << '(notif_for="'+user+'")' if user != ''
    conds << '(term like "%'+term+'%")' if term != ''
    conds << '(time_received >= "'+time_from+' 00:00:00")' if time_from != ''
@@ -930,6 +931,7 @@ class TeCu < DictSedna
        'role'=>role,
        'read'=>'false'
      } 
      hash['read'] = 'true' if row['read'].to_s == '1'
      res << hash
    }
    return res
+1 −1
Original line number Diff line number Diff line
@@ -1780,7 +1780,7 @@ def do_GET(request, response)
          end
      end
    when 'list_notifications'
      res = @dict_array['notification'].list_notifications(user, request.query['term'].to_s, request.query['role'].to_s, request.query['time_from'].to_s, request.query['time_to'].to_s, request.query['from'].to_s)
      res = @dict_array['notification'].list_notifications(user, request.query['term'].to_s, request.query['role'].to_s, request.query['time_from'].to_s, request.query['time_to'].to_s, request.query['from'].to_s, request.query['read'].to_s)
      response['Content-Type'] = 'application/json; charset=utf-8'
      response.body = res.to_json
    when 'search_all_terms'