Ejemplo n.º 1
0
 def parse(self):
     """
     Parses spreadsheet data.
     """
     area = SpreadsheetArea(self.vacation_lines, start_row=self.start_row)
     result = area.parse(self.headers, self.header_row)
     return result
Ejemplo n.º 2
0
    def parse(self):
        """
        Parses data from work stream.
        """
        area = SpreadsheetArea(self.work_lines, start_row=self.start_row)
        parsed_work = area.parse(self.headers + self.skill_headers,
                                                         self.header_row)
        # Gathers tags from columns that have headings like "Tag",
        # "Tag:Product", etc.
        tags = area.parse_tags(self.header_row)

        # Rearrange data in work records
        num_headers = len(self.headers)
        num_skill_headers = len(self.skill_headers)
        result = []
        cur_rank = 1

        for rec_index in range(len(parsed_work)):
            record = parsed_work[rec_index]
            rank = str(cur_rank)
            cur_rank += 1
            item = []
            estimates = []

            if self.skip_record(record):
                print("Skipping %d" % cur_rank)
                continue

            # The first part of the record will be our normal headers
            for i in range(0, num_headers):
                value = input_conditioner.condition_user_input(record[i])
                item.append(value)

            # After the normal headers we'll augment with the rank
            item.append(rank)

            # The last part of the record is the estimate. We'll gather them
            # here and then pack them here.
            for i in range(num_headers, num_headers + num_skill_headers):
                estimates.append(self.condition_manweeks(record[i]))
            print(record, estimates)
            item.append(sectionize.pack_string(self.skill_headers, estimates))

            # Condition work record fields
            conditioned_record = self.condition_work_record(item, tags[rec_index])
            if conditioned_record:
                result.append(conditioned_record)

        return result
Ejemplo n.º 3
0
    def parse(self):
        """
        Parses staff data.

            Tries to figure out where the start and end rows are. This will
            always be a little delicate.
        """
        headers = [self.COL_QUARTER, self.COL_TRACK, self.COL_SKILL, self.COL_PERSON]

        # Figure out spreadsheet area
        header_row = 0
        start_row = header_row + 1

        area = SpreadsheetArea(self.assignments_lines, start_row=start_row)
        parsed_staff = area.parse(headers, header_row)

        # Return array of person items
        result = []
        for row in parsed_staff:
            result.append({"quarter": Quarter(row[0]), "track": row[1], "skill": row[2], "name": row[3]})

        return result
Ejemplo n.º 4
0
    def parse(self):
        """
        Parses staff data.

            Tries to figure out where the start and end rows are. This will
            always be a little delicate.
        """
        headers = [
                self.COL_FIRST_NAME,
                self.COL_LAST_NAME,
                self.COL_SKILL
        ]

        # Figure out spreadsheet area
        header_row = self.get_header_row()
        start_row = header_row + 1

        area = SpreadsheetArea(self.staff_lines, start_row=start_row)
        parsed_staff = area.parse(headers, header_row)

        # Return array of person items
        result = []
        for row in parsed_staff:
            skills = [s.strip() for s in row[2].split(",")]
            first_name = row[0]
            last_name = row[1]

            if first_name == '':
                    continue

            for sk in skills:
                result.append({
                    'name': "%s %s" % (first_name, last_name),
                    'skill': sk
                })

        return result