File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
src/com/shuzijun/leetcode/plugin/manager Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ public static void openCode(Question question, Project project) {
6868
6969 JSONObject jsonObject = JSONObject .parseObject (body ).getJSONObject ("data" ).getJSONObject ("question" );
7070
71- question .setContent (CommentUtils .createComment (jsonObject . getString ( URLUtils . getDescContent () ), codeTypeEnum ));
71+ question .setContent (CommentUtils .createComment (getContent ( jsonObject ), codeTypeEnum ));
7272
7373 question .setTestCase (jsonObject .getString ("sampleTestCase" ));
7474
@@ -281,6 +281,27 @@ private static boolean fillQuestion(Question question) {
281281 return true ;
282282 }
283283
284+ private static String getContent (JSONObject jsonObject ) {
285+ StringBuffer sb = new StringBuffer ();
286+ sb .append (jsonObject .getString (URLUtils .getDescContent ()));
287+ JSONArray topicTagsArray = jsonObject .getJSONArray ("topicTags" );
288+ if (topicTagsArray != null && !topicTagsArray .isEmpty ()) {
289+ sb .append ("<div><div>Related Topics</div><div>" );
290+ for (int i = 0 ; i < topicTagsArray .size (); i ++) {
291+ JSONObject tag = topicTagsArray .getJSONObject (i );
292+ sb .append ("<span>" );
293+ if (StringUtils .isBlank (tag .getString ("translatedName" ))){
294+ sb .append (tag .getString ("name" ));
295+ }else {
296+ sb .append (tag .getString ("translatedName" ));
297+ }
298+ sb .append ("</span>" );
299+ }
300+ sb .append ("</div></div>" );
301+ }
302+ return sb .toString ();
303+ }
304+
284305 private static class SubmitCheckTask implements Runnable {
285306
286307 private Question question ;
You can’t perform that action at this time.
0 commit comments