Subversion Repositories DevTools

Rev

Rev 6613 | Rev 6616 | 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
6615 dpurdie 23
Dim BaseId
125 ghuddy 24
'------------ Constants Declaration -----------
25
'------------ Variable Init -------------------
26
parInterval = Request("Interval")
27
'----------------------------------------------
28
%>
29
<%
30
'------------------------------------------------------------------------------------------------------------------------
31
' Thus function formulates a query that is intended to find the top 10 packages that have changed the most in a period of
32
' time, limited in scope to those packages that have at least one version in the specified release.
33
' The function relies upon the user of this ASP file having setup the Interval parameter as needed (see RequestReleasePackages.asp)
34
Function formQueryString
35
 
36
   Dim qs
37
   Dim date_Interval_expression
38
 
39
   ' Insert the correct date interval condition
40
   Select Case parInterval
41
      Case 1
42
         date_Interval_expression = " AND changed_package_versions.MODIFIED_STAMP > (ORA_SYSDATE - interval '7' day)"
43
      Case 2
151 ghuddy 44
         date_Interval_expression = " AND changed_package_versions.MODIFIED_STAMP > (ORA_SYSDATE - interval '30' day)"
125 ghuddy 45
      Case 3
151 ghuddy 46
         date_Interval_expression = " AND changed_package_versions.MODIFIED_STAMP > (ORA_SYSDATE - interval '90' day)"
6615 dpurdie 47
      Case 4
48
         date_Interval_expression = ""
125 ghuddy 49
      Case Else
50
         Call RaiseMsg(enum_MSG_ERROR, "Internal Error, date interval not specified.")
51
   End Select
52
 
53
   ' For each package ID in a release
54
   '    For each package version across all projects and releases (have to do this due to schema limitations)
55
   '       If the package version extension is the same as that being used currently in the release
56
   '          If the package version is locked, and is not a ripple
57
   '             Increment a count for this package ID
58
   ' Return the 10 package IDs with the highest counts
6615 dpurdie 59
   qs  = " SELECT ordered_changed.pkg_id, ordered_changed.pkg_name || pv_outer.v_ext as pkg_name, pv_outer.pv_id, pv_outer.pkg_version, ordered_changed.NumberOfChanges" _
125 ghuddy 60
       & " FROM RELEASE_CONTENT rc_outer, PACKAGE_VERSIONS pv_outer,                                        " _
61
       & " (                                                                                                " _
62
       & "    SELECT * FROM (                                                                               " _
63
       & "       SELECT changed.pkg_name, changed.pkg_id, COUNT(changed.pkg_name) as NumberOfChanges FROM ( " _
64
       & "          SELECT PACKAGES.pkg_name, PACKAGES.pkg_id                                               " _
65
       & "          FROM   PACKAGE_VERSIONS changed_package_versions, PACKAGES                              " _
66
       & "          WHERE  changed_package_versions.pkg_id      = PACKAGES.pkg_id                           " & date_Interval_expression _
67
       & "          AND    changed_package_versions.build_type <> 'Y'                                       " _
68
       & "          AND    changed_package_versions.dlocked     = 'Y'                                       " _
69
       & "          AND    changed_package_versions.pkg_id IN (                                             " _
70
       & "                    SELECT pkg_id FROM PACKAGE_VERSIONS WHERE pv_id IN (                          " _
71
       & "                       SELECT pv_id                                                               " _
72
       & "                       FROM   RELEASE_CONTENT                                                     " _
73
       & "                       WHERE  RELEASE_CONTENT.rtag_id = :rtag_id                                  " _
74
       & "                    )                                                                             " _
75
       & "                 )                                                                                " _
76
       & "          AND    changed_package_versions.v_ext IN (                                              " _
77
       & "                    SELECT v_ext FROM PACKAGE_VERSIONS, RELEASE_CONTENT                           " _
78
       & "                    WHERE  PACKAGE_VERSIONS.pv_id  = RELEASE_CONTENT.pv_id                        " _
79
       & "                    AND    PACKAGE_VERSIONS.pkg_id = changed_package_versions.pkg_id              " _
80
       & "                    AND    RELEASE_CONTENT.rtag_id = :rtag_id                                     " _
81
       & "                 )                                                                                " _
82
       & "       ) changed                                                                                  " _
83
       & "       GROUP BY changed.pkg_name, changed.pkg_id                                                  " _
84
       & "       ORDER BY NumberOfChanges DESC                                                              " _
85
       & "    ) WHERE ROWNUM < 11                                                                           " _
86
       & " ) ordered_changed                                                                                " _
87
       & " WHERE                                                                                            " _
88
       & "   ordered_changed.pkg_id = pv_outer.pkg_id                                                       " _
89
       & "   AND rc_outer.rtag_id   = :rtag_id                                                              " _
6615 dpurdie 90
       & "   AND rc_outer.pv_id     = pv_outer.pv_id                                                        " _
91
       & "   order by upper(pkg_name) "
125 ghuddy 92
 
93
   formQueryString = qs
94
End Function
95
 
96
 
97
 
98
'------------------------------------------------------------------------------------------------------------------------
99
%>
100
<%
101
'------------------------ MAIN LINE ---------------------------------
102
'--------------------------------------------------------------------
6615 dpurdie 103
OraDatabase.Parameters.Add "RTAG_ID", Request("rtag_id"),    ORAPARM_INPUT, ORATYPE_NUMBER
104
Set rsTemp = OraDatabase.DbCreateDynaset( formQueryString, cint(0))
105
OraDatabase.Parameters.Remove "RTAG_ID"
125 ghuddy 106
%>
6615 dpurdie 107
<!-- RequestTop10Changes.asp -->
125 ghuddy 108
<table width="100%" border="0" cellspacing="1" cellpadding="1">
6615 dpurdie 109
 
110
<%If rsTemp.RecordCount < 1 Then %>
111
   <tr class="form_field_grey_bg">
112
      <td nowrap class="body_row">None Found</td>
113
   </tr>
114
<% Else %>
115
    <tr class="form_field_bg">
116
      <td class="form_field_bg">
125 ghuddy 117
         <table width="100%" border="0" cellspacing="1" cellpadding="1">
118
            <tr>
6615 dpurdie 119
               <td nowrap class="body_row" valign="top" width="70%">Package Name</td>
120
               <td nowrap class="body_row" valign="top" width="30%">Changes<%=Quick_Help("Top10ChangeCounts")%></td>
125 ghuddy 121
            </tr>
122
            <%
123
               While ((NOT rsTemp.BOF) AND (NOT rsTemp.EOF))
6615 dpurdie 124
                BaseId = "TOP10_I" & parInterval & "_" & Request("rtag_id") & "_" & rsTemp("pv_id") 
125 ghuddy 125
               %>
6615 dpurdie 126
                <tr class="form_field_grey_bg">
127
                    <td nowrap class="body_row">
128
                       <a href="javascript://rtag_id=<%=Request("rtag_id")%>&pv_id=<%=rsTemp("pv_id")%>;" class="txt_linked" onClick="ToggleLoadControl('<%=BaseId%>','RequestPackageVersionHistoryMetrics.asp?rtag_id=<%=Request("rtag_id")%>&pv_id=<%=rsTemp("pv_id")%>&mode=1');"><img id='IMG_<%=BaseId%>' src="images/bt_plus.gif" border="0" align="absmiddle" hspace="3"><img src="images/i_world.gif" border="0" align="absmiddle" hspace="3"><%=rsTemp("pkg_name")%></a>
129
                    </td>
130
                    <td nowrap class="body_row">
125 ghuddy 131
                        <%=rsTemp("NumberOfChanges")%>
6615 dpurdie 132
                    </td>
133
                </tr>
134
                <tr class="form_field_bg" id="TGL_<%=BaseId%>" style="display:none;">
135
                    <td nowrap class="body_row"><div id='<%=BaseId%>'><%=enumLOADING%></div></td>
136
                </tr>
137
                <%rsTemp.MoveNext
125 ghuddy 138
               WEnd
139
            %>
140
         </table>
141
      </td>
142
   </tr>
6615 dpurdie 143
<%End If%>
125 ghuddy 144
</table>
145
<br>
146
<%
6615 dpurdie 147
rsTemp.Close
148
Set rsTemp = nothing
149
%>
150
<%
125 ghuddy 151
Call Destroy_All_Objects
152
%>