Skip to content

Commit

Permalink
Fixes: clean database and case 0 bugs (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelrios authored Oct 23, 2024
1 parent 0e1eec6 commit ccf8b8a
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions bugz.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,26 @@ def bugzilla_qe_verify(self):

rows.append(row)

# Create the DataFrame
df = pd.DataFrame(rows)
self.db.qa_needed_delete()

df['modification_date'] = pd.to_datetime(df['modification_date'], format='%Y%m%dT%H:%M:%S') # noqa
df['creation_date'] = pd.to_datetime(df['creation_date'], format='%Y%m%dT%H:%M:%S') # noqa
if not rows:
print("There are no bugs to verify today")

# Drop the columns 'type_id' and 'id'
df_cleaned = df.drop(columns=["type_id", "id"])
else:
# Create the DataFrame
df = pd.DataFrame(rows)

data_frame = self.db.report_bugzilla_qa_needed(df_cleaned)
self.db.report_bugzilla_qa_needed_insert(data_frame)
df['modification_date'] = pd.to_datetime(df['modification_date'], format='%Y%m%dT%H:%M:%S') # noqa
df['creation_date'] = pd.to_datetime(df['creation_date'], format='%Y%m%dT%H:%M:%S') # noqa

qe_needed_count = self.db.report_bugzilla_qa_needed_count(data_frame)
self.db.report_bugzilla_qa_needed_count_insert(qe_needed_count)
# Drop the columns 'type_id' and 'id'
df_cleaned = df.drop(columns=["type_id", "id"])

data_frame = self.db.report_bugzilla_qa_needed(df_cleaned)
self.db.report_bugzilla_qa_needed_insert(data_frame)

qe_needed_count = self.db.report_bugzilla_qa_needed_count(data_frame) # noqa
self.db.report_bugzilla_qa_needed_count_insert(qe_needed_count)


class DatabaseBugzilla(Database):
Expand All @@ -146,6 +152,13 @@ def __init__(self):
super().__init__()
self.db = Database()

def qa_needed_delete(self):
""" Wipe out all bugs.
NOTE: we'll print daily bugs data from Bugzilla every day."""
print("Delete entries from db first")
self.session.query(ReportBugzillaQENeeded).delete()
self.session.commit()

def report_bugzilla_qa_needed(self, payload):

selected_columns = {
Expand Down

0 comments on commit ccf8b8a

Please sign in to comment.