FogBugz » TimeIntervalCommentsPlugin http://fogbugz.stackexchange.com/questions/3316
Clone URL:  
Pushed to one repository · View In Graph Contained in version_0-2-0-0, version_0-2-0-1, and tip

check length of intervals returned

Changeset 3286058dee83

Parent d538b01283e6

by Adam Wishneusky

Changes to 2 files · Browse files at 3286058dee83 Showing diff from parent d538b01283e6 Diff from another changeset...

 
39
40
41
42
43
 
 
 
39
40
41
 
 
42
43
@@ -39,5 +39,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers  // by using the '*' as shown below:  // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.1.5")] -[assembly: AssemblyFileVersion("0.1.1.5")] +[assembly: AssemblyVersion("0.1.2.0")] +[assembly: AssemblyFileVersion("0.1.2.0")]
 
132
133
134
135
 
136
137
138
 
155
156
157
 
 
158
159
160
161
162
163
164
165
166
 
 
 
 
167
168
169
 
132
133
134
 
135
136
137
138
 
155
156
157
158
159
160
161
162
163
 
 
 
 
 
164
165
166
167
168
169
170
@@ -132,7 +132,7 @@
  Convert.ToString(api.Request[api.AddPluginPrefix("action")]) == "getTimeIntervalComment")   {   int ixInterval = -1; - if (api.Request[api.AddPluginPrefix("action")] != null && + if (api.Request[api.AddPluginPrefix("ixInterval")] != null &&   Int32.TryParse(Convert.ToString(api.Request[api.AddPluginPrefix("ixInterval")]), out ixInterval))   return GetComment(ixInterval);   else @@ -155,15 +155,16 @@
    private string GetComment(int ixInterval)   { + string sComment = "none"; +   CTimeIntervalQuery query = api.TimeInterval.NewTimeIntervalQuery();   query.AddWhere("TimeInterval.ixInterval = @ixInterval");   query.SetParamInt("@ixInterval", ixInterval);   - CTimeInterval timeInterval = query.List()[0]; - // check for null - string sComment = timeInterval.GetPluginField(SPluginId, "sComment").ToString(); - // return sComment; - return "comment goes here"; + CTimeInterval[] rgTimeIntervals = query.List(); + if (rgTimeIntervals.Length > 0) + sComment = rgTimeIntervals[0].GetPluginField(SPluginId, "sComment").ToString(); + return sComment;   }   }  }