Skip to content

Commit

Permalink
NXDRIVE-2438: Add a metric
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickaël Schoentgen authored and BoboTiG committed Jan 18, 2021
1 parent b5a0fbf commit 098c27c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion nxdrive/engine/engine.py
Expand Up @@ -464,7 +464,7 @@ def _direct_transfer(
last_local_selected_location,
)
if new_folder:
self.send_metric("direct_transfer", "new_folder", 1)
self.send_metric("direct_transfer", "new_folder", "1")
item = self._create_remote_folder(remote_parent_path, new_folder)
if not item:
return
Expand Down
29 changes: 17 additions & 12 deletions nxdrive/gui/folders_dialog.py
Expand Up @@ -392,23 +392,28 @@ def _add_subgroup_new_folder(self, layout: QHBoxLayout, /) -> None:
def _find_folders_duplicates(self) -> List[str]:
"""Return a list of duplicate folder(s) found on the remote path."""
parent = self.remote_folder_ref
folders = []

new_folder = self.new_folder.text()
if bool(new_folder):
if self.engine.remote.exists_in_parent(parent, new_folder, True):
return [new_folder]
return []

all_paths = self.paths.keys()
return [
path.name
for path in all_paths
if (
path.parent not in all_paths
and path.is_dir()
and self.engine.remote.exists_in_parent(parent, path.name, True)
folders.append(new_folder)
else:
all_paths = self.paths.keys()
folders.extend(
path.name
for path in all_paths
if (
path.parent not in all_paths
and path.is_dir()
and self.engine.remote.exists_in_parent(parent, path.name, True)
)
)
]

if folders:
self.engine.send_metric("direct_transfer", "dupe_folder", "1")

return folders

def accept(self) -> None:
"""Action to do when the OK button is clicked."""
Expand Down

0 comments on commit 098c27c

Please sign in to comment.