@@ -84,6 +84,8 @@ def fetch_github_item_details(item_id):
8484
8585
8686class GithubProjectV2Item :
87+ # NOTE: This might be something for pydantic schemas in the future
88+
8789 def __init__ (self , content : dict ):
8890 self .content = content
8991
@@ -107,30 +109,30 @@ def content_type(self):
107109 return self .content ["projects_v2_item" ]["content_type" ]
108110
109111 def node_id (self ):
110- # NOTE(artcz): This is more relevant, because of how the graphql query
111- # above is constructed.
112+ # NOTE(artcz): This is relevant, because of how the graphql query above
113+ # is constructed.
112114 # Using node_id, which is an id of a ProjectV2Item we can get both
113115 # DraftIssue and Issue from one query.
114- # If we use the content_node_id we need to adjust the query as that ID
115- # points us directly either an Issue or DraftIssue
116+ # If we use the content_node_id we would probably need two separate
117+ # ways of getting that data.
116118 return self .content ["projects_v2_item" ]["node_id" ]
117119
118- def content_node_id (self ):
119- return self .content ["projects_v2_item" ]["content_node_id" ]
120-
121120 def changes (self ) -> dict :
122121 if "changes" in self .content :
123122 fv = self .content ["changes" ]["field_value" ]
124123 field_name = fv ["field_name" ]
125124 field_type = fv ["field_type" ]
125+
126126 if field_type == "date" :
127127 changed_from = (
128128 fv ["from" ].split ("T" )[0 ] if fv ["from" ] is not None else "None"
129129 )
130130 changed_to = fv ["to" ].split ("T" )[0 ] if fv ["to" ] is not None else "None"
131+
131132 elif field_type == "single_select" :
132133 changed_from = fv ["from" ]["name" ] if fv ["from" ] is not None else "None"
133134 changed_to = fv ["to" ]["name" ] if fv ["to" ] is not None else "None"
135+
134136 else :
135137 changed_from = "None"
136138 changed_to = "None"
@@ -152,8 +154,9 @@ def as_discord_message(self, github_object: GithubDraftIssue | GithubIssue) -> s
152154 changes = self .changes ()
153155
154156 if changes :
155- details = "**{field}** of **{obj}** from **{from}** to **{to}**" .format
156- details = details (** {"obj" : github_object .as_discord_message (), ** changes })
157+ details = "**{field}** of **{obj}** from **{from}** to **{to}**" .format (
158+ ** {"obj" : github_object .as_discord_message (), ** changes }
159+ )
157160
158161 else :
159162 details = github_object .as_discord_message ()
0 commit comments