def load_by_query(self, query_str, expand, url): cc = config_controller.cc_klass() data_path = cc.read_cache_config()[config_controller.DATA_FILE] issue_dict = self.get_cache().read(data_path=data_path) # issue_dict = clear_issues(issue_dict) return issue_dict
def get_query_str(self, x): cc = cc_klass() projects = cc.read_projects_config() if x.lower() in projects: query = projects[x.lower()] else: raise Exception('{0} not found in {1}'.format( x.lower(), cc.get_ini_path())) return query
def get_all_queries(self, jira_name): cc = cc_klass() projects = cc.read_projects_config(jira_name) query = '' for x in projects: if query == '': query = projects[x.lower()] else: query = query + ' or ' + projects[x.lower()] return query
def save(data, data_path): with open(data_path, "w") as outfile: try: json.dump(data, outfile) outfile.close() except FileExistsError: outfile.close() raise cc = config_controller.cc_klass() info_path = cc.get_info_from_data(data_path) FileCache.write_info(info_file_name=info_path)
def export_to_plotly(self): if len(self.name_list) == 0: return cc = cc_klass() self.jira_url = cc.get_jira_url(jira="jira_1") self.brnamelist = [] for vl in self.name_list: self.brnamelist.append( stringDivider( vl, int(cc.read_display_width() / 10 / len(self.name_list)), "<br>")) #colors.append() traces = [] # was: brnamelist trace1 = go.Bar( x=self.get_name_list(), y=self.close_list, text=self.close_list, name=FACT_PREFIX, textposition='auto', marker=dict( color='rgb(29,137,49)', #'palegreen', line=dict(color='black', width=1), ), insidetextfont=dict(family='Arial', size=12, color='white')) # was: brnamelist trace2 = go.Bar( x=self.get_name_list(), y=self.dev_list, text=self.dev_list, name=DEV_PREFIX, textposition='auto', marker=dict( color='rgb(254,210,92)', #'lightgoldenrodyellow', line=dict(color='black', width=1), ), insidetextfont=dict(family='Arial', size=12, color='black')) # was: brnamelist trace3 = go.Bar( x=self.get_name_list(), y=self.open_list, text=self.open_list, name=OPEN_PREFIX, textposition='auto', marker=dict( color='rgb(75,103,132)', #'powderblue', line=dict(color='black', width=1), ), insidetextfont=dict(family='Arial', size=12, color='white')) trace4 = go.Bar(x=self.get_name_list(), y=self.unplan_list, text=self.unplan_list, name=UNPLAN_PREFIX, textposition='auto', marker=dict( color='red', line=dict(color='black', width=1), ), insidetextfont=dict(family='Arial', size=12, color='white')) traces.append(trace1) traces.append(trace2) traces.append(trace3) traces.append(trace4) all_open = 0 for value in self.open_list: all_open += value for value in self.unplan_list: all_open += value all_dev = 0 for value in self.dev_list: all_dev += value all_closed = 0 for value in self.close_list: all_closed += value all_tasks = all_closed + all_dev + all_open if all_tasks == 0: all_tasks = 1 plan_fact_str = "pf" title_sum = "Open: {0:.2f}%, Dev: {1:.2f}%, Closed: {2:.2f}%, All tasks: {3:.2f} md".format( 100 * all_open / all_tasks, 100 * all_dev / all_tasks, 100 * all_closed / all_tasks, all_tasks) now_dt = datetime.datetime.now() length_ss = cc.read_supersprint_length(self.sprint) if length_ss != 0: will_be_done = min( 100, 100 * (now_dt - cc.read_supersprint_start(self.sprint)).days / length_ss) else: will_be_done = 0 title = "{0} <br>{1} <br> Must be closed today ({4}) in {2}: {3:.2f}%".format( self.dashboard_name, title_sum, self.fixversion, will_be_done, now_dt.strftime("%d.%m.%y %H:%M")) tools.make_subplots if self.dashboard_type == DashboardType.FEATURE: file_name1 = self.project else: file_name1 = self.dashboard_name.replace(')', '_') file_name = self.png_dir + "{0}_{1}".format(file_name1, self.project) # file_name = '//billing.ru/dfs/incoming/ABryntsev/' + "{0}_{1}".format(file_name1, self.project) layout = go.Layout( annotations=[ dict(x=1.05, y=1.03, xref='paper', yref='paper', text='Status', showarrow=False, font=dict(family='sans-serif', size=14, color='black')) ], legend=dict(x=1, y=1, traceorder='normal', font=dict(family='sans-serif', size=14, color='#000')), showlegend=True, margin=dict(t=50, b=50, r=100, l=6 * 6), autosize=True, font=dict(size=12, color='black'), barmode='stack', title=title, plot_bgcolor='white', yaxis=dict( rangemode="tozero", autorange=True, showgrid=True, zeroline=True, showline=True, ticks='', showticklabels=True, tickangle=0, title='Estimates (man-days)', tickfont=dict(size=10, color='black'), ), xaxis=dict( rangemode="tozero", autorange=True, showgrid=True, zeroline=True, showline=True, ticks='', tickangle=0, showticklabels=self.dashboard_type == DashboardType.PROJECT or self.dashboard_type == DashboardType.DOMAIN or (len(self.dev_list) < 30), tickfont=dict(size=16 if self.dashboard_type == DashboardType.DOMAIN else 10, color='black'), title=self.get_title_xaxis(), titlefont=dict(size=12, color='black'))) fig = go.Figure(data=traces, layout=layout) if self.dashboard_format == DashboardFormat.HTML: plotly.offline.plot(fig, filename=file_name + '.html', auto_open=self.auto_open) else: #plotly.offline.plot(fig,auto_open=self.auto_open, image='png', image_filename=file_name+'.png', # output_type='file', filename=file_name+'.html') pio.write_image(fig, file_name + '.png')
def save_all(self, data): cc = config_controller.cc_klass() data_path = cc.read_cache_config()[config_controller.DATA_FILE] self.get_cache().save(data=data, data_path=data_path) logging.info('cache was updated to ' + data_path)
def __init__(self): cc = config_controller.cc_klass() self.png_dir = cc.read_dashboards_config()[config_controller.FILE_DIR]