#922 Monitor page should not show builds from PR.
Merged 4 years ago by praiskup. Opened 4 years ago by schlupov.
copr/ schlupov/copr edit_monitor_page  into  master

@@ -0,0 +1,22 @@ 

+ """

+ Added index for main in copr_dir

+ 

+ Revision ID: 12abab545d7a

+ Revises: 3cba3ffe2836

+ Create Date: 2019-08-19 08:18:02.561158

+ """

+ 

+ import sqlalchemy as sa

+ from alembic import op

+ 

+ 

+ revision = '12abab545d7a'

+ down_revision = '3cba3ffe2836'

+ 

+ 

+ def upgrade():

+     op.create_index(op.f('ix_copr_dir_main'), 'copr_dir', ['main'], unique=False)

+ 

+ 

+ def downgrade():

+     op.drop_index(op.f('ix_copr_dir_main'), table_name='copr_dir')

@@ -1238,6 +1238,7 @@ 

  	  AND build_chroot.build_id = max_build_ids_for_a_chroot.max_build_id_for_chroot

  	JOIN mock_chroot

  	  ON mock_chroot.id = max_build_ids_for_a_chroot.mock_chroot_id

+ 	JOIN copr_dir ON build.copr_dir_id=copr_dir.id WHERE copr_dir.main IS TRUE

  	ORDER BY package.name ASC, package.id ASC, mock_chroot.os_release ASC, mock_chroot.os_version ASC, mock_chroot.arch ASC

  	""".format(copr_id=copr.id)

          rows = db.session.execute(query)

@@ -561,7 +561,7 @@ 

      id = db.Column(db.Integer, primary_key=True)

  

      name = db.Column(db.Text, index=True)

-     main = db.Column(db.Boolean, default=False, server_default="0", nullable=False)

+     main = db.Column(db.Boolean, index=True, default=False, server_default="0", nullable=False)

  

      ownername = db.Column(db.Text, index=True, nullable=False)

  

Wouldn't it be better to fix get_monitor_data, so only relevant builds are returned? Note that it would also fix the api call (see route "/coprs/<username>/<coprname>/monitor, but it would be probably much easier fix.

Keeping in mind @praiskup's comment a few lines below, this piece of code might be replaced, but just to give feedback ... It is better to avoid random numeric values in the code, so instead of 8, I would use BuildSourceEnum("scm").

1 new commit added

  • Adding condition into get_monitor_data instead of changes in render_monitor
4 years ago

rebased onto e50a3e08c7239390b8602c8876ea8dd2ed503d81

4 years ago

rebased onto bb647826531b1f150473e3f814ac489bdd1bd099

4 years ago

Could you please squash the commits, and use <sth> is true? Otherwise this looks good!

We discussed that some indexes might be needed, what's the conclusion there?

rebased onto 590caf3

4 years ago

I added an index for column main in table copr_dir.

Pull-Request has been merged by praiskup

4 years ago