Subversion Repositories DevTools

Rev

Rev 5506 | Rev 6615 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
125 ghuddy 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
4
'|                                                   |
5
'|        RequestTop10ChangesInLastWeek.asp          |
6
'|                                                   |
7
'=====================================================
8
%>
9
<%
10
Option explicit
11
' Good idea to set when using redirect
12
Response.Expires = 0   ' always load the page, dont store
13
%>
14
<!--#include file="common/conf.asp"-->
15
<!--#include file="common/globals.asp"-->
16
<!--#include file="common/formating.asp"-->
17
<!--#include file="common/qstr.asp"-->
18
<!--#include file="common/common_subs.asp"-->
19
<%
20
'------------ Variable Definition -------------
21
Dim rsTemp
22
Dim parInterval
23
'------------ Constants Declaration -----------
24
'------------ Variable Init -------------------
25
parInterval = Request("Interval")
26
'----------------------------------------------
27
%>
28
<%
29
'------------------------------------------------------------------------------------------------------------------------
30
' Thus function formulates a query that is intended to find the top 10 packages that have changed the most in a period of
31
' time, limited in scope to those packages that have at least one version in the specified release.
32
' The function relies upon the user of this ASP file having setup the Interval parameter as needed (see RequestReleasePackages.asp)
33
Function formQueryString
34
 
35
   Dim qs
36
   Dim date_Interval_expression
37
 
38
   ' Insert the correct date interval condition
39
   Select Case parInterval
40
      Case 1
41
         date_Interval_expression = " AND changed_package_versions.MODIFIED_STAMP > (ORA_SYSDATE - interval '7' day)"
42
      Case 2
151 ghuddy 43
         date_Interval_expression = " AND changed_package_versions.MODIFIED_STAMP > (ORA_SYSDATE - interval '30' day)"
125 ghuddy 44
      Case 3
151 ghuddy 45
         date_Interval_expression = " AND changed_package_versions.MODIFIED_STAMP > (ORA_SYSDATE - interval '90' day)"
125 ghuddy 46
      Case Else
47
         Call RaiseMsg(enum_MSG_ERROR, "Internal Error, date interval not specified.")
48
   End Select
49
 
50
   ' For each package ID in a release
51
   '    For each package version across all projects and releases (have to do this due to schema limitations)
52
   '       If the package version extension is the same as that being used currently in the release
53
   '          If the package version is locked, and is not a ripple
54
   '             Increment a count for this package ID
55
   ' Return the 10 package IDs with the highest counts
56
   qs  = " SELECT ordered_changed.pkg_id, ordered_changed.pkg_name, pv_outer.pv_id, pv_outer.pkg_version, ordered_changed.NumberOfChanges" _
57
       & " FROM RELEASE_CONTENT rc_outer, PACKAGE_VERSIONS pv_outer,                                        " _
58
       & " (                                                                                                " _
59
       & "    SELECT * FROM (                                                                               " _
60
       & "       SELECT changed.pkg_name, changed.pkg_id, COUNT(changed.pkg_name) as NumberOfChanges FROM ( " _
61
       & "          SELECT PACKAGES.pkg_name, PACKAGES.pkg_id                                               " _
62
       & "          FROM   PACKAGE_VERSIONS changed_package_versions, PACKAGES                              " _
63
       & "          WHERE  changed_package_versions.pkg_id      = PACKAGES.pkg_id                           " & date_Interval_expression _
64
       & "          AND    changed_package_versions.build_type <> 'Y'                                       " _
65
       & "          AND    changed_package_versions.dlocked     = 'Y'                                       " _
66
       & "          AND    changed_package_versions.pkg_id IN (                                             " _
67
       & "                    SELECT pkg_id FROM PACKAGE_VERSIONS WHERE pv_id IN (                          " _
68
       & "                       SELECT pv_id                                                               " _
69
       & "                       FROM   RELEASE_CONTENT                                                     " _
70
       & "                       WHERE  RELEASE_CONTENT.rtag_id = :rtag_id                                  " _
71
       & "                    )                                                                             " _
72
       & "                 )                                                                                " _
73
       & "          AND    changed_package_versions.v_ext IN (                                              " _
74
       & "                    SELECT v_ext FROM PACKAGE_VERSIONS, RELEASE_CONTENT                           " _
75
       & "                    WHERE  PACKAGE_VERSIONS.pv_id  = RELEASE_CONTENT.pv_id                        " _
76
       & "                    AND    PACKAGE_VERSIONS.pkg_id = changed_package_versions.pkg_id              " _
77
       & "                    AND    RELEASE_CONTENT.rtag_id = :rtag_id                                     " _
78
       & "                 )                                                                                " _
79
       & "       ) changed                                                                                  " _
80
       & "       GROUP BY changed.pkg_name, changed.pkg_id                                                  " _
81
       & "       ORDER BY NumberOfChanges DESC                                                              " _
82
       & "    ) WHERE ROWNUM < 11                                                                           " _
83
       & " ) ordered_changed                                                                                " _
84
       & " WHERE                                                                                            " _
85
       & "   ordered_changed.pkg_id = pv_outer.pkg_id                                                       " _
86
       & "   AND rc_outer.rtag_id   = :rtag_id                                                              " _
87
       & "   AND rc_outer.pv_id     = pv_outer.pv_id                                                        "
88
 
89
   formQueryString = qs
90
End Function
91
 
92
 
93
 
94
'------------------------------------------------------------------------------------------------------------------------
95
%>
96
<%
97
'------------------------ MAIN LINE ---------------------------------
98
'--------------------------------------------------------------------
99
%>
100
<table width="100%" border="0" cellspacing="1" cellpadding="1">
101
   <tr>
102
      <td background="images/bg_form_lightbluedark.gif">
103
         <table width="100%" border="0" cellspacing="1" cellpadding="1">
104
            <tr>
105
               <td nowrap class="body_txt" valign="top" width="70%" background="images/bg_form_lightbluedark.gif">Package Name</td>
106
               <td nowrap class="body_txt" valign="top" width="30%" background="images/bg_form_lightbluedark.gif">Changes<%=Quick_Help("Top10ChangeCounts")%></td>
107
            </tr>
108
 
109
            <%
110
            OraDatabase.Parameters.Add "RTAG_ID", Request("rtag_id"),    ORAPARM_INPUT, ORATYPE_NUMBER
111
 
112
            Set rsTemp = OraDatabase.DbCreateDynaset( formQueryString, cint(0))
113
 
114
            OraDatabase.Parameters.Remove "RTAG_ID"
115
 
116
            If rsTemp.RecordCount < 1 Then
117
            %>
118
               <tr>
119
                  <td colspan="3" background="images/bg_form_lightgray.gif" nowrap>&nbsp;</td>
120
               </tr>
121
            <%
122
            Else
123
 
124
               While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
125
               %>
126
                  <tr>
127
                     <td nowrap class="body_txt" background="images/bg_form_lightgray.gif">
128
                        <a class="txt_linked" href="dependencies.asp?pv_id=<%=rsTemp("pv_id")%>&rtag_id=<%=Request("rtag_id")%>">
129
                           <%=rsTemp("pkg_name")%>
130
                        </a>
131
                     </td>
132
 
133
                     <td nowrap class="body_txt" background="images/bg_form_lightgray.gif">
134
                        <%=rsTemp("NumberOfChanges")%>
135
                     </td>
136
                  </tr>
137
                  <%rsTemp.MoveNext
138
               WEnd
139
               rsTemp.Close
140
               Set rsTemp = nothing
141
 
142
            End If
143
            %>
144
         </table>
145
      </td>
146
   </tr>
147
</table>
148
<br>
149
 
150
<%
151
Call Destroy_All_Objects
152
%>