-
Notifications
You must be signed in to change notification settings - Fork 12
feat(api,ui): add howler.triaged to track time assessment is made #490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
b756282
c4b5090
cc22a02
42f0756
0541370
9566cd6
43f1a8b
b3dc5d3
9680712
6577f9f
f3021ca
f40fabc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,16 +24,13 @@ def assess_hit( | |
| assessment: Optional[str] = None, | ||
| rationale: Optional[str] = None, | ||
| hit: Optional[Union[dict[str, Any], Hit]] = None, | ||
| *, | ||
| user: User | str, | ||
| **kwargs, | ||
| ) -> list[OdmUpdateOperation]: | ||
| """Update the assessment and esclation of a hit | ||
|
|
||
| Args: | ||
| user (User | str): The user making the assessment | ||
| assessment (Optional[str], optional): The assessment to set the hit to. Defaults to None. | ||
| hit (Optional[Union[dict[str, Any], Hit]], optional): The hit to update. Defaults to None. | ||
| hit (Optional[dict[str, Any]], optional): The hit to update. Defaults to None. | ||
|
Copilot marked this conversation as resolved.
Outdated
|
||
|
|
||
| Raises: | ||
| InvalidDataException: An invalid assessment was provided | ||
|
|
@@ -55,6 +52,9 @@ def assess_hit( | |
| if assessment is None and rationale: | ||
| rationale = None | ||
|
|
||
| # reset the timestamp to None if removing assessment (re-assessing) | ||
| triaged_timestamp = "NOW" if assessment is not None else None | ||
|
|
||
|
Comment on lines
+58
to
+62
|
||
| logger.debug( | ||
| "Updating assessment of %s to %s", | ||
| hit["howler"]["id"] if hit else "unknown", | ||
|
|
@@ -66,16 +66,11 @@ def assess_hit( | |
| escalation, | ||
| ) | ||
|
|
||
| if assessment is None: | ||
| assessor_id = None | ||
| else: | ||
| assessor_id = user.get("uname", user.get("username", None)) if isinstance(user, User) else user | ||
|
|
||
| return [ | ||
| odm_helper.update("howler.assessment", assessment), | ||
| odm_helper.update("howler.escalation", escalation), | ||
| odm_helper.update("howler.rationale", rationale, silent=True), | ||
| odm_helper.update("howler.assessor", assessor_id, silent=True), | ||
| odm_helper.update("howler.triaged", triaged_timestamp), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't directly related, but also set
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Context: To match the the only transition out of resolved, if an assessment is removed by With the current workflow implementation, if an action sets the status, it takes priority over the transition defined destination status. I think it should be the other way around or even fail if values don't match. Personally, if there's a destination defined in the transition states, I expect this to be the behaviour, with any status changes in actions only being a fallback. |
||
| ] | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { avatarClasses, AvatarGroup, Chip, Stack } from '@mui/material'; | ||
| import { useAppUser } from 'commons/components/app/hooks'; | ||
| import HowlerAvatar from 'components/elements/display/HowlerAvatar'; | ||
| import type { Hit } from 'models/entities/generated/Hit'; | ||
| import type { HowlerUser } from 'models/entities/HowlerUser'; | ||
| import type { FC } from 'react'; | ||
| import { useTranslation } from 'react-i18next'; | ||
| import { HitLayout } from '../HitLayout'; | ||
|
|
||
| const Assigned: FC<{ hit: Hit; layout: HitLayout; hideLabel?: boolean }> = ({ hit, layout, hideLabel = false }) => { | ||
| const { t } = useTranslation(); | ||
| const { user } = useAppUser<HowlerUser>(); | ||
|
|
||
| const userAvatar = ( | ||
| <HowlerAvatar | ||
| userId={hit.howler.assignment} | ||
| sx={{ height: layout !== HitLayout.COMFY ? 24 : 32, width: layout !== HitLayout.COMFY ? 24 : 32 }} | ||
| /> | ||
| ); | ||
|
|
||
| return ( | ||
| <Stack direction="row" spacing={0.5}> | ||
| {hideLabel ? ( | ||
| userAvatar | ||
| ) : ( | ||
| <Chip | ||
| variant="outlined" | ||
| sx={{ | ||
| width: 'fit-content', | ||
| '& .MuiChip-icon': { | ||
| marginLeft: 0 | ||
| } | ||
| }} | ||
| icon={userAvatar} | ||
| label={ | ||
| !hideLabel && | ||
|
github-code-quality[bot] marked this conversation as resolved.
Fixed
|
||
| (hit?.howler.assignment !== 'unassigned' | ||
| ? hit?.howler.assignment | ||
| : t('app.drawer.hit.assignment.unassigned.name')) | ||
| } | ||
| size={layout !== HitLayout.COMFY ? 'small' : 'medium'} | ||
| /> | ||
| )} | ||
| <AvatarGroup | ||
| max={3} | ||
| sx={{ [`.${avatarClasses.root}`]: { border: 0, marginLeft: 0.5 } }} | ||
| componentsProps={{ | ||
| additionalAvatar: { | ||
| sx: { | ||
| height: layout !== HitLayout.COMFY ? 24 : 32, | ||
| width: layout !== HitLayout.COMFY ? 24 : 32, | ||
| fontSize: '12px' | ||
| } | ||
| } | ||
| }} | ||
| > | ||
| {[...new Set(hit?.howler.viewers)] | ||
| .filter(viewer => viewer !== user.username) | ||
| .map(viewer => ( | ||
| <HowlerAvatar | ||
| key={viewer} | ||
| userId={viewer} | ||
| sx={{ height: layout !== HitLayout.COMFY ? 24 : 32, width: layout !== HitLayout.COMFY ? 24 : 32 }} | ||
| /> | ||
| ))} | ||
| </AvatarGroup> | ||
| </Stack> | ||
| ); | ||
| }; | ||
|
|
||
| export default Assigned; | ||
Uh oh!
There was an error while loading. Please reload this page.