fix: 接口测试,定时任务数量统计,统计了手动执行的次数

修复接口测试,定时任务数量统计,统计了手动执行的次数的问题
This commit is contained in:
song.tianyang 2020-12-25 11:08:44 +08:00
parent caa7a5d4d7
commit 79ef041153
4 changed files with 45 additions and 42 deletions

View File

@ -181,7 +181,7 @@
INNER JOIN (
SELECT acitem.`name`,acitem.id FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id
) ac on ar.scenario_id = ac.id
WHERE acr.project_id = #{projectId} AND ar.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
WHERE acr.project_id = #{projectId} AND ar.trigger_mode = 'SCHEDULE' AND ar.create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp}
</select>
<select id="countByProjectIdGroupByExecuteResult" resultType="io.metersphere.api.dto.datacount.ApiDataCountResult">
@ -191,7 +191,7 @@
INNER JOIN (
SELECT acitem.`name`,acitem.id FROM api_scenario acitem INNER JOIN `schedule` sc ON acitem.id = sc.resource_id
) ac on ar.scenario_id = ac.id
WHERE acr.project_id = #{projectId}
WHERE acr.project_id = #{projectId} AND ar.trigger_mode = 'SCHEDULE'
GROUP BY groupField;
</select>
</mapper>

View File

@ -159,7 +159,7 @@
INNER JOIN api_test_report testReport ON testReportDetail.report_id = testReport.id
WHERE sch.resource_id IN (
SELECT id FROM api_test WHERE project_id = #{projectId,jdbcType=VARCHAR}
)
) AND testReport.trigger_mode = 'SCHEDULE'
GROUP BY groupField;
</select>
@ -170,6 +170,6 @@
WHERE sch.resource_id IN (
SELECT id FROM api_test WHERE project_id = #{projectId,jdbcType=VARCHAR}
)
AND testReport.create_time BETWEEN #{startTime} and #{endTime}
AND testReport.trigger_mode = 'SCHEDULE' AND testReport.create_time BETWEEN #{startTime} and #{endTime}
</select>
</mapper>

View File

@ -46,9 +46,11 @@
<select id="countTaskByProjectIdAndCreateTimeRange" resultType="java.lang.Long">
SELECT COUNT(id) AS countNumber FROM `schedule`
WHERE resource_id IN (
SELECT id FROM api_test WHERE project_id = #{projectId,jdbcType=VARCHAR} AND status != 'Trash'
SELECT atest.id FROM api_test atest
WHERE atest.project_id = #{projectId,jdbcType=VARCHAR} AND atest.status != 'Trash'
UNION
SELECT id FROM api_scenario WHERE project_id = #{projectId,jdbcType=VARCHAR} AND status != 'Trash'
SELECT scene.id FROM api_scenario scene
WHERE scene.project_id = #{projectId,jdbcType=VARCHAR} AND scene.status != 'Trash'
)
AND create_time BETWEEN #{startTime} and #{endTime}
</select>

View File

@ -2,14 +2,22 @@
<ms-container>
<el-header height="0">
<div style="float: right">
<div v-if="dateType==='1'">
<div v-if="tipsType==='1'">
🤔天凉了保温杯买了吗
</div>
<div v-else-if="dateType==='2'">
😔觉得MeterSphere不好用就来 <el-link href="https://github.com/metersphere/metersphere/issues" target="_blank" style="color: black" type="primary">https://github.com/metersphere/metersphere/issues</el-link>
<div v-else-if="tipsType==='2'">
😔觉得MeterSphere不好用就来
<el-link href="https://github.com/metersphere/metersphere/issues" target="_blank" style="color: black"
type="primary">https://github.com/metersphere/metersphere/issues
</el-link>
吐个槽吧
</div>
<div v-else-if="dateType==='3'">
😄觉得MeterSphere好用就来 <el-link href="https://github.com/metersphere/metersphere" target="_blank" style="color: black" type="primary">https://github.com/metersphere/metersphere</el-link> star
<div v-else-if="tipsType==='3'">
😄觉得MeterSphere好用就来
<el-link href="https://github.com/metersphere/metersphere" target="_blank" style="color: black"
type="primary">https://github.com/metersphere/metersphere
</el-link>
点个star吧
</div>
<div v-else>
😊 MeterSphere温馨提醒 多喝热水哟
@ -19,25 +27,25 @@
<ms-main-container v-loading="result.loading">
<el-row :gutter="0"></el-row>
<el-row :gutter="10">
<el-col :span="6" >
<el-col :span="6">
<ms-api-info-card :api-count-data="apiCountData"/>
</el-col>
<el-col :span="6" >
<el-col :span="6">
<ms-test-case-info-card :test-case-count-data="testCaseCountData"/>
</el-col>
<el-col :span="6" >
<el-col :span="6">
<ms-scene-info-card :scene-count-data="sceneCountData"/>
</el-col>
<el-col :span="6" >
<el-col :span="6">
<ms-schedule-task-info-card :schedule-task-count-data="scheduleTaskCountData"/>
</el-col>
</el-row>
<el-row :gutter="10" >
<el-col :span="12" >
<el-row :gutter="10">
<el-col :span="12">
<ms-failure-test-case-list/>
</el-col>
<el-col :span="12" >
<el-col :span="12">
<ms-running-task-list/>
</el-col>
</el-row>
@ -48,7 +56,7 @@
<script>
import MsContainer from "@/business/components/common/components/MsContainer";
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
import MsMainContainer from "@/business/components/common/components/MsMainContainer";
import MsApiInfoCard from "./components/ApiInfoCard";
import MsSceneInfoCard from "./components/SceneInfoCard";
import MsScheduleTaskInfoCard from "./components/ScheduleTaskInfoCard";
@ -63,56 +71,49 @@ export default {
components: {
MsApiInfoCard, MsSceneInfoCard, MsScheduleTaskInfoCard, MsTestCaseInfoCard,
MsFailureTestCaseList,MsRunningTaskList,
MsFailureTestCaseList, MsRunningTaskList,
MsMainContainer, MsContainer
},
data() {
return {
values: [],
apiCountData:{},
sceneCountData:{},
testCaseCountData:{},
scheduleTaskCountData:{},
dateType:"1",
apiCountData: {},
sceneCountData: {},
testCaseCountData: {},
scheduleTaskCountData: {},
tipsType: "1",
result: {},
}
},
activated() {
this.search();
this.checkDateType();
this.checkTipsType();
},
// mounted() {
// this.getValues();
// },
created() {
// this.search();
},
methods: {
checkDateType(){
var random = Math.floor(Math.random() * (4 - 1 + 1))+1;
this.dateType = random +"";
},
openNewPage(herf){
window.open(herf, '_blank');
checkTipsType() {
var random = Math.floor(Math.random() * (4 - 1 + 1)) + 1;
this.tipsType = random + "";
},
search() {
let selectProjectId = getCurrentProjectID();
this.$get("/api/apiCount/"+selectProjectId, response => {
this.$get("/api/apiCount/" + selectProjectId, response => {
this.apiCountData = response.data;
});
this.$get("/api/testSceneInfoCount/"+selectProjectId, response => {
this.$get("/api/testSceneInfoCount/" + selectProjectId, response => {
this.sceneCountData = response.data;
});
this.$get("/api/testCaseInfoCount/"+selectProjectId, response => {
this.$get("/api/testCaseInfoCount/" + selectProjectId, response => {
this.testCaseCountData = response.data;
});
// let workSpaceID = getCurrentWorkspaceId();
this.$get("/api/scheduleTaskInfoCount/"+selectProjectId, response => {
this.$get("/api/scheduleTaskInfoCount/" + selectProjectId, response => {
this.scheduleTaskCountData = response.data;
});
},