Skip to content

Commit

Permalink
Implement planning choice for Crypto
Browse files Browse the repository at this point in the history
  • Loading branch information
matejak committed Apr 4, 2024
1 parent 2cccea5 commit 3e85d27
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions estimage/plugins/crypto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ def from_form_and_app(cls, form, app) -> "InputSpec":
ret.server_url = "https://issues.redhat.com"
ret.token = form.token.data
ret.cutoff_date = app.get_config_option("RETROSPECTIVE_PERIOD")[0]
sprint = "openSprints()"
query = f"project = {PROJECT_NAME} AND type = Task AND sprint in openSprints()"
query = "filter = 12350823 AND Sprint in openSprints() AND labels = committed AND issuetype in (task, bug, Story)"
ret.retrospective_query = query
query = "filter = 12350823 AND Sprint in futureSprints() AND issuetype in (task, bug, Story)"
ret.projective_query = query
query_tpl = "filter = 12350823 AND Sprint in {sprint} AND issuetype in (task, bug, Story)"
ret.retrospective_query = query_tpl.format(sprint=sprint)
if form.project_next.data:
sprint = "futureSprints()"
ret.projective_query = query_tpl.format(sprint=sprint)
ret.item_class = app.get_final_class("BaseCard")
return ret

Expand Down
1 change: 1 addition & 0 deletions estimage/plugins/crypto/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@


class CryptoFormEnd(FlaskForm):
project_next = wtforms.BooleanField('Plan for the Next Iteration')
submit = wtforms.SubmitField("Import Data")


Expand Down
5 changes: 4 additions & 1 deletion estimage/plugins/crypto/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import flask_login

from ...webapp import web_utils
from ...plugins import crypto, jira
from ...plugins import crypto, jira, redhat_compliance
from ...plugins.jira import routes
from . import forms

Expand All @@ -19,5 +19,8 @@ def sync():
if form.validate_on_submit():
task_spec = crypto.InputSpec.from_form_and_app(form, flask.current_app)
jira.routes.do_stuff_and_flash_messages(task_spec, crypto.do_stuff)
else:
next_starts_soon = redhat_compliance.days_to_next_epoch(datetime.datetime.today()) < 30
form.project_next.data = next_starts_soon
return web_utils.render_template(
'crypto.html', title='Red Hat Crypto Plugin', plugin_form=form, )

0 comments on commit 3e85d27

Please sign in to comment.