anchor.diff:  	end.
   
   %% @doc
  +%% Function: now_to_seconds/0
  +%% Purpose: Converts the built-in function now() into seconds
  +%% Returns: The current number of seconds from 1970
  +%% @end
  +-spec now_to_seconds() -> integer().
  +now_to_seconds() ->
  +	{Mega, Sec, _} = erlang:now(),
  +    (Mega * 1000000) + Sec.
  +
  +
  +%% @doc
   %% Function: pair/1
   %% Purpose: Used to create a new list of tuples where each
   %%          2 elements are paired
  
positive.code: 	 get_list_and_add_id/2,
  	 get_and_add_password/1,
  	 get_list_and_add_password/1,
  	 is_polling_history/1,
  	 is_auth/1,
  	 is_auth_redirect/1,
  
negative.code:     lib_json:set_attr(users, AddedPassword).
  
  %% @doc
  %% Function: id_from_path/1
  %% Purpose: Retrieves the id from the path.
  %% Returns: Id
  %% @end
  -spec id_from_path(RD::tuple()) -> string().
  id_from_path(RD) ->
      Fetch_user_id = fun(TableName, Id) ->
          case erlastic_search:get_doc(?INDEX, "stream", Id) of
              {error, _} -> undefined;
              {ok, JSON} ->
                  UID = lib_json:get_field(JSON, "_source.user_id"),
                  string:to_lower(binary_to_list(UID))
          end
      end,
  
      case api_help:parse_path(wrq:path(RD)) of
          [error]               -> undefined;
          [{"users"}]           -> undefined;
          [{"users", Id}]       -> string:to_lower(Id);
          [{"users", Id}, _]    -> string:to_lower(Id);
          [{"streams", Id}]     -> Fetch_user_id("streams", Id);
          [{"streams", Id}, _]  -> Fetch_user_id("streams", Id);
          [{"vstreams", Id}]    -> Fetch_user_id("vstreams", Id);
          [{"vstreams", Id}, _] -> Fetch_user_id("vstreams", Id);
          _                     -> undefined
      end.
  
  %% @doc
  %% Function: is_polling_history/1
  %% Purpose: Used to deiced if the URI specify a polling_history
  %% Returns: True if URI specify a pollinghistory, false otherwise
  