MCPcopy Index your code
hub / github.com/vastsa/FileCodeBox / _build_admin_activity_options

Method _build_admin_activity_options

apps/admin/services.py:970–995  ·  view source on GitHub ↗
(
        self,
        activities: list[dict[str, Any]],
        field: str,
    )

Source from the content-addressed store, hash-verified

968 return any(keyword in str(value or "").lower() for value in searchable_values)
969
970 def _build_admin_activity_options(
971 self,
972 activities: list[dict[str, Any]],
973 field: str,
974 ) -> list[dict[str, Any]]:
975 counters: dict[str, dict[str, Any]] = {}
976 for activity in activities:
977 raw_value = self._normalize_admin_activity_text(activity.get(field))
978 if not raw_value:
979 continue
980 value = raw_value.lower()
981 if value not in counters:
982 counters[value] = {"label": raw_value, "count": 0}
983 counters[value]["count"] += 1
984
985 return [
986 {
987 "value": value,
988 "label": option["label"],
989 "count": option["count"],
990 }
991 for value, option in sorted(
992 counters.items(),
993 key=lambda item: (-item[1]["count"], item[0]),
994 )
995 ]
996
997 def _build_admin_activity_id(
998 self,

Callers 1

list_admin_activitiesMethod · 0.95

Calls 2

itemsMethod · 0.80

Tested by

no test coverage detected