-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
541 changed files
with
50,137 additions
and
66,898 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# | ||
#Makefile - Why not :) | ||
# | ||
|
||
SHELL := /bin/bash | ||
VERSION = $(shell python setup.py --version) | ||
|
||
DB_NAME=cdrstatsdb | ||
DB_OPTS= | ||
PRJ_DIR=./cdr_stats | ||
|
||
all: | ||
@echo "See Makefile source for targets details" | ||
|
||
recreate-static: clean-static create-static | ||
|
||
create-static: | ||
cd $(PRJ_DIR) && ./manage.py collectstatic --noinput | ||
|
||
#clean-static: | ||
# cd $(PRJ_DIR) && echo rm -rf $(dirname $(shell ./manage.py findstatic site.js)) | ||
|
||
makeallmessages: | ||
cd $(PRJ_DIR) && ./manage.py makemessages -s -a -e ".html,.txt" | ||
|
||
compilemessages: | ||
cd $(PRJ_DIR) && ./manage.py compilemessages | ||
|
||
test: | ||
python setup.py nosetests | ||
|
||
release: | ||
git tag $(VERSION) | ||
git push origin $(VERSION) | ||
git push origin master | ||
python setup.py sdist upload | ||
|
||
lint-js: | ||
# Check JS for any problems | ||
# Requires jshint | ||
jshint ${STATIC_DIR}/js/mycode.js | ||
|
||
watch: | ||
bundle exec guard | ||
|
||
runlocal: kill_server | ||
cd $(PRJ_DIR) && python manage.py runserver 0.0.0.0:8000 | ||
|
||
kill_server: | ||
@if /usr/sbin/lsof -i :8000; then \ | ||
echo "WARNING: A server was already listening on port 8000, I'm trying to kill it"; \ | ||
kill -9 `/usr/sbin/lsof -i :8000 -Fp|cut -c2-`; \ | ||
fi | ||
|
||
clean: | ||
find $(PRJ_DIR) -type f -name "*.pyc" -exec rm -rf \{\} \; | ||
|
||
cleardb: clean | ||
-dropdb $(DB_NAME) $(DB_OPTS) | ||
createdb $(DB_NAME) $(DB_OPTS) -E UTF-8 -T cdrstatsdb | ||
|
||
reset: cleardb | ||
cd $(PRJ_DIR) && python manage.py syncdb --noinput | ||
cd $(PRJ_DIR) && python manage.py loaddata fixtures/auth.json | ||
@echo 'Login as admin/admin' | ||
|
||
graph_models: | ||
cd $(PRJ_DIR) && python manage.py graph_models -a -g -o project_models.png | ||
|
||
doc_html: | ||
cd docs && rm -rf build/html && rm -rf build/doctrees && make html | ||
|
||
doc_pdf: | ||
cd docs && rm -rf build/latex && rm -rf build/doctrees && make latexpdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
CREATE EXTENSION "uuid-ossp"; | ||
|
||
-- HANGUP_CAUSE = ['NORMAL_CLEARING', 'USER_BUSY', 'NO_ANSWER'] | ||
-- HANGUP_CAUSE_Q850 = ['16', '17', '19'] | ||
|
||
|
||
-- Generate 1.000.000 random calls in next the 60 days | ||
INSERT INTO voip_cdr (user_id, switch_id, cdr_source_type, callid, caller_id_number, caller_id_name, | ||
destination_number, starting_date, duration, billsec, hangup_cause_id, direction, country_id, | ||
authorized, buy_rate, buy_cost, sell_rate, sell_cost, data) ( | ||
SELECT | ||
1 AS user_id, | ||
cast(random() * 1 as int) + 1 AS switch_id, | ||
cast(random() * 4 as int) + 1 AS cdr_source_type, | ||
cast(uuid_generate_v4() AS text) AS callid, | ||
'+' || cast(30 + cast(trunc(random() * 20 + 1) as int) as text) || 800000000 + cast(trunc(random() * 5000000 + 1) as int) AS caller_id_number, | ||
'' AS caller_id_name, | ||
'+' || cast(30 + cast(trunc(random() * 20 + 1) as int) as text) || 800000000 + cast(trunc(random() * 5000000 + 1) as int) AS destination_number, | ||
current_timestamp - ( cast(trunc(random() * 30) as int) || ' days')::interval | ||
+ ( cast(trunc(random() * 1440) as int) || ' minutes')::interval | ||
AS starting_date, | ||
cast(trunc(random() * 150 + 1) as int) AS duration, | ||
cast(trunc(random() * 120 + 1) as int) AS billsec, | ||
16 + cast(trunc(random() * 10 + 0) as int) AS hangup_cause_id, | ||
cast(random() * 2 as int) AS direction, | ||
cast(trunc(random() * 200 + 1) as int) as country_id, | ||
TRUE AS authorized, | ||
cast(random()::numeric / 5 AS numeric(10,5)) AS buy_rate, | ||
cast(random()::numeric AS numeric(12,5)) AS buy_cost, | ||
cast(random()::numeric / 5 AS numeric(10,5)) / 5 AS sell_rate, | ||
cast(random()::numeric AS numeric(12,5)) AS sell_cost, | ||
'{"mos": 3}'::jsonb AS data | ||
FROM generate_series(1, 500000) AS n | ||
); | ||
|
||
-- Generate fake data in events (used to test pydata) | ||
INSERT INTO events (value, starting_date) ( | ||
SELECT | ||
cast(random() * 100 as int) + 1 AS value, | ||
current_timestamp - ( cast(trunc(random() * 30) as int) || ' days')::interval | ||
+ ( cast(trunc(random() * 1440) as int) || ' minutes')::interval | ||
AS starting_date | ||
FROM generate_series(1, 50) AS n | ||
); |
Oops, something went wrong.