Skip to content

Commit

Permalink
new updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Parv17k committed Dec 7, 2020
2 parents 6b3b989 + 5b27fdb commit af50f5a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
Empty file added ER1.pdf
Empty file.
Binary file added er-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 38 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import graphviz as graphviz
from configparser import ConfigParser
import SessionState
import matplotlib.pyplot as plt

session_state = SessionState.get(id=0,data=pd.DataFrame())
head=st.title("")

Expand Down Expand Up @@ -104,6 +106,36 @@ def submit_feedback(user):
else: st.error('error occured in SQL')
else: st.write('All tickets feedback have been assigned for the tickets created by you')

def show_ms_profit():
st.title("Profit/Loss Overview : All Department")
sql=f"""select sum(amount - penalty) as profit_dept, int.name from costs,
(select t.ticket_id,m.name as name from tickets t,management_system m where m.id=t.ms_id )
int where int.ticket_id=costs.ticket_id group by int.name;
"""
data=query_db(sql)
st.dataframe(data)

def show_cost(user):
st.title("Cost Overview : for your Management Systems")
sql = f"""
select tickets.ticket_id,costs.amount,costs.penalty,(amount - penalty) as profit
from costs,tickets where tickets.ticket_id=costs.ticket_id and tickets.ticket_id in
(select ticket_id from
tickets where ms_id in (select id from management_system where managerid={user['id'][0]}));
"""
data=query_db(sql)
data=data.set_index('ticket_id')
st.dataframe(data)
X = np.arange(4)
fig = plt.figure()
ax = fig.add_axes(data)
ax.bar(X + 0.00, data['amount'], color = 'b', width = 0.25)
ax.bar(X + 0.25, data['profit'], color = 'g', width = 0.25)
ax.bar(X + 0.50, data['penalty'], color = 'r', width = 0.25)
#plt.plot(data['penalty'], 'r--', data['amount'], 'bs', data['profit'], 'g^')

st.pyplot(fig)

def showFeedback(user):
sql =''
if user['domain'][0] == 'issue_reporter':
Expand Down Expand Up @@ -173,7 +205,8 @@ def createticket(user_id):


def updatestatus(user):
sql = f"""select tickets.ticket_id,ticket_status.status, tickets.title from tickets,ticket_status where tickets.status_id = ticket_status.id and assigned_to_id = {str(user['id'][0])};"""
sql = f"""select tickets.ticket_id,ticket_status.status, tickets.title
from tickets,ticket_status where tickets.status_id = ticket_status.id and assigned_to_id = {str(user['id'][0])};"""

data = query_db(sql)
tickets=[]
Expand Down Expand Up @@ -213,7 +246,10 @@ def visualize_tickets(user):

selT=st.selectbox('Select Ticket for a graph:',tickets)
selT=selT.split(":")[0]
sql= f"""select issue_reporter.name as reporter,temp.title,temp.issuer_id as issuer_id,temp.emp_id,temp.emp_name from (select t.issuer_id,t.title,t.assigned_to_id as emp_id,e.name as emp_name from tickets t,employees e where e.id = t.assigned_to_id and t.ticket_id={selT}) temp, issue_reporter where issue_reporter.id=temp.issuer_id;"""
sql= f"""select issue_reporter.name as reporter,temp.title,temp.issuer_id as
issuer_id,temp.emp_id,temp.emp_name from (select t.issuer_id,t.title,t.assigned_to_id as
emp_id,e.name as emp_name from tickets t,employees e where e.id = t.assigned_to_id and t.ticket_id={selT})
temp, issue_reporter where issue_reporter.id=temp.issuer_id;"""
data = query_db(sql)
if data.empty == False:
st.dataframe(data)
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ pandas==1.1.4
streamlit==0.71.0
psycopg2==2.8.6
ConfigParser
graphviz
graphviz
matplotlib
plotly

0 comments on commit af50f5a

Please sign in to comment.