made calculation function in the tweet_model