@@ -84,6 +84,8 @@ def fetch_github_item_details(item_id):
84
84
85
85
86
86
class GithubProjectV2Item :
87
+ # NOTE: This might be something for pydantic schemas in the future
88
+
87
89
def __init__ (self , content : dict ):
88
90
self .content = content
89
91
@@ -107,30 +109,30 @@ def content_type(self):
107
109
return self .content ["projects_v2_item" ]["content_type" ]
108
110
109
111
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.
112
114
# Using node_id, which is an id of a ProjectV2Item we can get both
113
115
# 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.
116
118
return self .content ["projects_v2_item" ]["node_id" ]
117
119
118
- def content_node_id (self ):
119
- return self .content ["projects_v2_item" ]["content_node_id" ]
120
-
121
120
def changes (self ) -> dict :
122
121
if "changes" in self .content :
123
122
fv = self .content ["changes" ]["field_value" ]
124
123
field_name = fv ["field_name" ]
125
124
field_type = fv ["field_type" ]
125
+
126
126
if field_type == "date" :
127
127
changed_from = (
128
128
fv ["from" ].split ("T" )[0 ] if fv ["from" ] is not None else "None"
129
129
)
130
130
changed_to = fv ["to" ].split ("T" )[0 ] if fv ["to" ] is not None else "None"
131
+
131
132
elif field_type == "single_select" :
132
133
changed_from = fv ["from" ]["name" ] if fv ["from" ] is not None else "None"
133
134
changed_to = fv ["to" ]["name" ] if fv ["to" ] is not None else "None"
135
+
134
136
else :
135
137
changed_from = "None"
136
138
changed_to = "None"
@@ -152,8 +154,9 @@ def as_discord_message(self, github_object: GithubDraftIssue | GithubIssue) -> s
152
154
changes = self .changes ()
153
155
154
156
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
+ )
157
160
158
161
else :
159
162
details = github_object .as_discord_message ()
0 commit comments