Skip to content

Commit

Permalink
Merge pull request #8107 from OpenMined/fix/dataset_assets_contributo…
Browse files Browse the repository at this point in the history
…r_uploader

fix: show uploader if exists
  • Loading branch information
tcp authored Oct 5, 2023
2 parents a431832 + a16a247 commit 54d0e5c
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions packages/syft/src/syft/service/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Asset(SyftObject):
mock_is_real: bool = False
shape: Optional[Tuple]
created_at: DateTime = DateTime.now()
uploader: Contributor
uploader: Optional[Contributor]

__repr_attrs__ = ["name", "shape"]

Expand All @@ -165,11 +165,12 @@ def _repr_html_(self) -> Any:
# relative
from ...service.action.action_object import ActionObject

uploaded_by_line = "n/a"
if len(self.contributors) > 0:
uploaded_by_line = (
f"<p><strong>Uploaded by: </strong>{self.uploader.name}</p>"
)
uploaded_by_line = (
f"<p><strong>Uploaded by: </strong>{self.uploader.name} ({self.uploader.email})</p>"
if self.uploader
else ""
)

if isinstance(self.data, ActionObject):
data_table_line = itables.to_html_datatable(
df=self.data.syft_action_data, css=itables_css
Expand Down Expand Up @@ -494,12 +495,15 @@ def _coll_repr_(self) -> Dict[str, Any]:
}

def _repr_html_(self) -> Any:
uploaded_by_line = "n/a"
if len(self.contributors) > 0:
uploaded_by_line = (
uploaded_by_line = (
(
"<p class='paragraph-sm'><strong>"
+ f"<span class='pr-8'>Uploaded by:</span></strong>{self.uploader.name}</p>"
+ f"<span class='pr-8'>Uploaded by:</span></strong>{self.uploader.name} ({self.uploader.email})</p>"
)
if self.uploader
else ""
)

return f"""
<style>
{fonts_css}
Expand Down

0 comments on commit 54d0e5c

Please sign in to comment.