anchor.diff:  								#price{} = Price ->
   									{Charged, NewBuckets} = rating2(Price,
   											Validity, UsageSecs, UsageOctets, Final, Buckets),
  -									Entry = Subscriber#subscriber{buckets = NewBuckets},
  +									NewSessionList = remove_session(SessionList, Attributes),
  +									Entry = Subscriber#subscriber{buckets = NewBuckets,
  +											session_attributes = NewSessionList},
   									mnesia:write(Entry);
   								false ->
   									throw(price_not_found)
  
positive.code: -define(MILLISECOND, milli_seconds).
  %-define(MILLISECOND, millisecond).
  
  -spec rating(SubscriberID, Final, UsageSecs, UsageOctets) -> Return
  	when
  		SubscriberID :: string() | binary(),
  		Final :: boolean(),
  		UsageSecs :: integer(),
  		UsageOctets :: integer(),
  		Return :: ok | {error, Reason},
  		Reason :: term().
  rating(SubscriberID, Final, UsageSecs, UsageOctets) when is_list(SubscriberID) ->
  	rating(list_to_binary(SubscriberID), Final, UsageSecs, UsageOctets);
  rating(SubscriberID, Final, UsageSecs, UsageOctets) when is_binary(SubscriberID) ->
  	F = fun() ->
  			case mnesia:read(subscriber, SubscriberID, write) of
  				[#subscriber{buckets = Buckets, product =
  						#product_instance{product = ProdID,
  						characteristics = Chars}} = Subscriber] ->
  					Validity = proplists:get_value(validity, Chars),
  					case mnesia:read(product, ProdID, read) of
  
negative.code: -module(ocs_rating).
  -copyright('Copyright (c) 2016 - 2017 SigScale Global Inc.').
  
  -export([rating/5]).
  -export([remove_session/2]).
  
  -include("ocs.hrl").
  
  