Skip to content
Snippets Groups Projects
Commit 6b2b3df6 authored by Benedikt's avatar Benedikt
Browse files

added Issue Creation function

parent 320e2a88
No related branches found
No related tags found
No related merge requests found
There was an issue with the following unit conversion: There was an issue with the following unit conversion:
- Left unit: {} | Which unit | User entered input | Parsed input |
- Right unit: {} | ---------- | ------------------ | ------------ |
| Left unit | {} | {} |
| Right unit | {} | {} |
### Result/Expectation: ### Result/Expectation:
| Calculation | Result | Expectation | Did match | | Calculation | Result | Expectation | Did match |
|-------------|--------|-------------|-----------| |-------------|--------|-------------|-----------|
| Base unit | {} | | [] | | Base unit | {} | | [ ] |
| factor * left = right | {} | | [] | | factor * left = right | {} | | [ ] |
| factor * right = left | {} | | [] | | factor * right = left | {} | | [ ] |
| factor * left = base | {} | | [] | | factor * left = base | {} | | [ ] |
| factor * base = left | {} | | [] | | factor * base = left | {} | | [ ] |
| factor * right = base | {} | | [] | | factor * right = base | {} | | [ ] |
| factor * base = right | {} | | [] | | factor * base = right | {} | | [ ] |
If there was an error with the calculation, please fill out the table above. Feel free to also add additional info here: If there was an error with the calculation, please fill out the table above. Feel free to also add additional info here:
......
...@@ -6,6 +6,7 @@ import warnings ...@@ -6,6 +6,7 @@ import warnings
import itertools import itertools
import math import math
import bokehCssPTB import bokehCssPTB
from urllib.parse import quote
from dsiParser import dsiParser from dsiParser import dsiParser
from bokeh.plotting import curdoc,figure from bokeh.plotting import curdoc,figure
from bokeh.layouts import column, row from bokeh.layouts import column, row
...@@ -190,6 +191,10 @@ class page(): ...@@ -190,6 +191,10 @@ class page():
curdoc().add_root(self.compareRow) curdoc().add_root(self.compareRow)
self.dsiCompGraphGen=dsiCompGraphGen(self.dsiInput1,self.dsiInput2) self.dsiCompGraphGen=dsiCompGraphGen(self.dsiInput1,self.dsiInput2)
curdoc().add_root(self.dsiCompGraphGen.widget) curdoc().add_root(self.dsiCompGraphGen.widget)
self.createIssueButton = Button(label="Report conversion error", disabled=True)
# self.createIssueButton.on_click(self.createIssueUrl)
curdoc().add_root(self.dsiCompGraphGen.widget)
curdoc().add_root(self.createIssueButton)
def compare(self): def compare(self):
self.dsiInput1.parseInput() self.dsiInput1.parseInput()
...@@ -211,4 +216,21 @@ class page(): ...@@ -211,4 +216,21 @@ class page():
self.compaReresult.text = "The two units are not equal" self.compaReresult.text = "The two units are not equal"
self.compaReresult.css_classes = ["msg-negative"] self.compaReresult.css_classes = ["msg-negative"]
self.dsiCompGraphGen.flush() self.dsiCompGraphGen.flush()
self.createIssueButton.disabled=False
self.createIssueButton.button_type="danger"
self.createIssueButton.js_on_event("button_click",CustomJS(code=f"window.open('{self.createIssueUrl()}', '_blank');"))
def createIssueUrl(self):
quantitiesToAdd=[self.dsiInput1.dsiInput.value,str(self.dsiInput1.dsiTree),self.dsiInput2.dsiInput.value,str(self.dsiInput2.dsiTree),str(self.dsiCompGraphGen.baseUnit),self.dsiCompGraphGen.scalfactorAB,self.dsiCompGraphGen.scalfactorBA,self.dsiCompGraphGen.scalfactorABase,self.dsiCompGraphGen.scalfactorBaseA,self.dsiCompGraphGen.scalfactorBBase,self.dsiCompGraphGen.scalfactorBaseB]
templateStr=open('./issue.md').read()
filledResult=templateStr.format(*quantitiesToAdd)
filledTitle = f'Unexpected comparison result: {self.dsiInput1.dsiInput.value} to {self.dsiInput2.dsiInput.value}'
issueUrl = r'https://gitlab1.ptb.de/digitaldynamicmeasurement/dsi-parser-frontend/-/issues/new?'
title = quote(filledTitle)
body = quote(filledResult)
url = issueUrl + 'issue[title]=' + title + '&issue[description]=' + body
return url
thisPage = page() thisPage = page()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment