Example #1
0
def get_data(filters):

	def add_devs_and_cons(row):
		row[2] = cons.get(row[0], '').replace(',', '<br>')
		row[3] = devs.get(row[0], '').replace(',', '<br>')
		return row

	def add_dept_head_relevance(row):
		relevant = int(row[-1])
		row[1] += f';{relevant}'
		return row[:-1]

	devs = get_developers_for_product()
	cons = get_consultants_for_product()

	has_perms = 'DC_PLC_Developer' in frappe.get_roles(frappe.session.user)

	res = get_developer_stats(filters)
	res = [add_devs_and_cons(row) for row in res]
	res = [add_completeness(row, range(2, 12)) for row in res]
	res = [add_query_relevance(row, has_perms) for row in res]
	res = [add_dept_head_relevance(row) for row in res]
	res = [add_newline(row) for row in res]

	return res
def get_data(filters):
    res = get_procmap_stats(filters)

    has_perms = 'DC_PLC_Process_Map_Specialist' in frappe.get_roles(
        frappe.session.user)

    res = [add_completeness(row, [4]) for row in res]
    res = [add_query_relevance(row, has_perms) for row in res]

    return res
def get_data(filters):
	res = get_tech_writer_stats(filters)

	has_perms = 'DC_PLC_Tech_Writer' in frappe.get_roles(frappe.session.user)

	res = [add_completeness(row, [9, 10, 11]) for row in res]
	res = [add_query_relevance(row, has_perms) for row in res]
	res = [add_newline(row) for row in res]

	return res
Example #4
0
def get_data(filters):
    res = get_rnd_spec_stats(filters)

    # TODO use frappe API to determine perms
    has_perms = 'DC_PLC_RnD_Specialist' in frappe.get_roles(
        frappe.session.user)

    res = [add_completeness(row, [2]) for row in res]
    res = [add_query_relevance(row, has_perms) for row in res]

    return res
Example #5
0
def get_data(filters):
    # TODO sanitize filters
    # TODO refactor hardcoded indexes

    relevance_values = {0: 3, 1: 1, 2: 10, 3: 2, 4: 1, 5: 3, 6: 2}
    cell_groups = {
        0: [4, 10, 11],
        1: [9],
        2: [8, 7, 15, 12, 13, 14, 17, 18, 23, 19],
        3: [5, 21],
        4: [22],
        5: [16, 24, 25],
        6: [6, 20],
    }

    def add_devs_and_cons(row):
        row[7] = cons.get(row[0], '').replace(',', '<br>')
        row[8] = devs.get(row[0], '').replace(',', '<br>')
        return row

    def add_relevance(row):
        done = 0
        total = 22
        flags = row[24:]
        cells_to_highlight = list()
        for index, flag in enumerate(flags):
            if flag:
                done += relevance_values[index]
                cells_to_highlight += cell_groups[index]
        percent = int((done / total) * 100)
        return [row[0]] + [f'{percent:03d}|{cells_to_highlight}'] + row[1:]

    devs = get_developers_for_product()
    cons = get_consultants_for_product()
    result = get_full_stats(filters)

    result = [add_devs_and_cons(row) for row in result]
    result = [add_completeness(row, range(21)) for row in result]
    result = [add_relevance(row) for row in result]
    result = [add_newline(row) for row in result]

    return result
def get_data(filters):
    def add_devs_and_cons(row):
        row[3] = cons.get(row[0], '').replace(',', '<br>')
        row[4] = devs.get(row[0], '').replace(',', '<br>')
        return row

    devs = get_developers_for_product()
    cons = get_consultants_for_product()

    # TODO use frappe API to determine perms
    has_perms = 'DC_PLC_MMIC_Dept_Head' in frappe.get_roles(
        frappe.session.user)

    res = get_dept_head_stats(filters)
    res = [add_devs_and_cons(row) for row in res]
    res = [add_completeness(row, [1, 2, 4, 5]) for row in res]
    res = [add_query_relevance(row, has_perms) for row in res]
    res = [add_newline(row) for row in res]

    # TODO calc stats by appointed fields
    return res