Skip to content

Commit

Permalink
Fixed an issue with error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vloothuis committed Dec 6, 2023
1 parent e80ac74 commit 30f599c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 41 deletions.
Binary file modified public/port-0.0.0-py3-none-any.whl
Binary file not shown.
Binary file modified src/framework/processing/py/dist/port-0.0.0-py3-none-any.whl
Binary file not shown.
26 changes: 14 additions & 12 deletions src/framework/processing/py/port/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def __call__(self, value, start_date):
self.start_times.append(start_date)

def to_dataframe(self):
return pd.DataFrame({"Start Time": self.start_times, "Aantal stappen": self.steps})
return pd.DataFrame(
{"Start Time": self.start_times, "Aantal stappen": self.steps}
)


def parse_health_data(file_obj):
Expand Down Expand Up @@ -132,24 +134,24 @@ def process(sessionId):
fileResult = yield render_donation_page(promptFile, 33)
if fileResult.__type__ == "PayloadString":
meta_data.append(("debug", f"extracting file"))
extractionResult = extract_daily_steps_from_zip(fileResult.value)
if extractionResult != "invalid":
meta_data.append(
("debug", f"extraction successful, go to consent form")
)
data = extractionResult
break
else:
try:
extractionResult = extract_daily_steps_from_zip(fileResult.value)
except:
meta_data.append(
("debug", f"prompt confirmation to retry file selection")
)
retry_result = yield render_donation_page(retry_confirmation(), 33)
if retry_result.__type__ == "PayloadTrue":
meta_data.append(("debug", f"skip due to invalid file"))
continue
else:
meta_data.append(("debug", f"retry prompt file"))
break
meta_data.append(("debug", f"retry prompt file"))
break
else:
meta_data.append(
("debug", f"extraction successful, go to consent form")
)
data = extractionResult
break
else:
meta_data.append(("debug", f"skip to next step"))
break
Expand Down
31 changes: 2 additions & 29 deletions src/framework/visualisation/react/ui/pages/donation_page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ import { ConsentForm } from '../prompts/consent_form'
import { FileInput } from '../prompts/file_input'
import { RadioInput } from '../prompts/radio_input'
import { Page } from './templates/page'
import { Progress } from '../elements/progress'
import { Instructions } from '../elements/instructions'

type Props = Weak<PropsUIPageDonation> & ReactFactoryContext

export const DonationPage = (props: Props): JSX.Element => {
const { title, forwardButton } = prepareCopy(props)
const { platform, locale, resolve } = props
const { title } = prepareCopy(props)
const { locale } = props

function renderBody (props: Props): JSX.Element {
const context = { locale: locale, resolve: props.resolve }
Expand All @@ -39,31 +37,6 @@ export const DonationPage = (props: Props): JSX.Element => {
throw new TypeError('Unknown body type')
}

function handleSkip (): void {
resolve?.({ __type__: 'PayloadFalse', value: false })
}

const footer: JSX.Element = (
<Footer
middle={<Progress percentage={props.footer.progressPercentage} />}
right={
<div className='flex flex-row'>
<div className='flex-grow' />
<ForwardButton label={forwardButton} onClick={handleSkip} />
</div>
}
/>
)

const sidebar: JSX.Element = (
<Sidebar
logo={LogoSvg}
content={
<Instructions platform={platform} locale={locale} />
}
/>
)

const body: JSX.Element = (
<>
<Title1 text={title} />
Expand Down

0 comments on commit 30f599c

Please sign in to comment.