【Angualr4】跨方法計算
前臺TS辛辛苦苦寫的TS程式碼,但是不能夠跨方法計算,即使宣告的是全域性變數也不行,暫時放這裡,作為個資料庫 ,方便以後自己呼叫;(注:這裡是半成品,不可全部copy)
this.examStudyTimeCount=0;
this.examPointCount=0;
this.examPntCntThsYr=0;
this.examHourStudy=0;
for(var i=0;i<this.messagenotices.length;i++){
/!*考試*!/
if(1==this.messagenotices[i].status) {
var examId=this.messagenotices[i].examId;
this.trainService.findExamUser(examId).subscribe(result2=>{
this.examUserList=result2;
console .log(result2);
var examUser=this.examUserList[0];
var exam=this.examUserList[0].exam;
if (2==examUser.status) {
this.examStudyTimeCount += exam.duration;
this .examHourStudy = this.examStudyTimeCount / (60);
this.examPointCount += examUser.integral;
console.log("考試積分:");
console.log(examUser.integral);
var timeStudy = new Date(examUser.handInTime);
var time00001 = new Date(examUser.handInTime);
time00001.setMonth(0);
time00001.setDate(0);
time00001.setHours(0);
time00001.setMinutes(0);
time00001.setMilliseconds(1);
var now1 = new Date();
if (timeStudy < now1 && timeStudy > time00001) {
this.examPntCntThsYr += examUser.integral;
}
}
});
}
/!*warn 培訓*!/
if(2==this.messagenotices[i].status){
this.studyTimeCount=0;
this.pointCount=0;
this.studyTimeOnce=0;
this.pntCntThsYr=0;
this.hourStudy=0;
this.train=this.messagenotices[i].train;
this.pointCount += this.train.point;
console.log("培訓積分:");
console.log(this.pointCount);
this.trainService.findTrainMarksAndTime(this.train.id).subscribe(result3=>{
this.trainList=result3;
var trainInfo = this.trainList[0];
var st: any = new Date(trainInfo.startDate);
var et: any = new Date(trainInfo.endDatess);
this.studyTimeOnce = parseInt((et - st).toString());
this.studyTimeCount += this.studyTimeOnce;
this.hourStudy = Math.round(this.studyTimeCount / (1000 * 60 * 60));
var timeStudy = new Date(trainInfo.endDatess);
var time00001 = new Date(trainInfo.endDatess);
time00001.setMonth(0);
time00001.setDate(0);
time00001.setHours(0);
time00001.setMinutes(0);
time00001.setMilliseconds(1);
var now1 = new Date();//獲取現在時間;
if (timeStudy < now1 && timeStudy > time00001) {
this.pntCntThsYr += this.train.point;
}
});
}
}
/*this.hourFinal=this.hourStudy+this.examHourStudy;
this.pointFinal=this.pointCount+this.examPointCount;//6分
console.log("最終積分");
console.log(this.pointFinal);
this.pntCnYrFinal=this.pntCntThsYr+this.examPntCntThsYr;*/
相關推薦
【Angualr4】跨方法計算
前臺TS辛辛苦苦寫的TS程式碼,但是不能夠跨方法計算,即使宣告的是全域性變數也不行,暫時放這裡,作為個資料庫 ,方便以後自己呼叫;(注:這裡是半成品,不可全部copy) this.examStudyTimeCount=0;
【轉】dB的計算方法
方便 濾波 order 意義 級聯 儀表 宋體 信噪比 car 原文地址:https://www.espressif.com/zh-hans/media/blog/%E5%A2%9E%E7%9B%8A%E6%AF%94%E5%80%BC-db-%E4%BB%A5%E5%8F
【MPI高效能運算】蒙特卡洛方法計算pi值
蒙特卡洛方法 就是通過概率模擬來近似計算。 其實演算法進度不是很高。 程式碼 在下面程式碼中的input檔案中的內容是 10000000 執行效果:下面用四個核來做計算 PS D:\C++\VS\repo\MPI-DEMO\Debug> mpiexec
【轉載】機器學習計算距離和相似度的方法
3. 向量內積 向量內積是線性代數裡最為常見的計算,實際上它還是一種有效並且直觀的相似性測量手段。向量內積的定義如下: 直觀的解釋是:如果 x 高的地方 y 也比較高, x 低的地方 y 也比較低,那麼整體的內積是偏大的,也就是說 x 和 y 是相似的。舉個例子,在一段長的序列訊號 A 中尋找哪一段與短序
【筆記】跨域重定向中使用Ajax(XHR請求)導致跨域失敗
兩個 led stat -h java cut 報錯 blank direct 背景: 1、前端Web中有兩個域名,a.com和b.com,其中a.com是訪問主站(頁面),b.com是數據提交接口的服務器(XHR請求) 2、a.com中用XHR調用b.com/cerate
【mysql】排序方法
記錄 mysql group by esc 通過 成績 avi 前三 方法 查詢各科成績前三名的記錄,不考慮並列的情況; select a.course_id as 課程ID, a.score as 成績, count(a.course_id) as 排名 from sc
【MAC】常用方法-持續更新
1.Homebrew安裝 刪除brewruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"安裝最新的/usr/bin/ruby -e "$(curl -fsSL https
【JAVA】多邊形重心計算
多邊形重心計算 三角形重心 頂點為a,b,c的三角形重心為x = (xa + xb + xc) / 3,y = (ya + yb + yc) / 3 多邊形重心 x = (x1w1 + x2w2 + … + xnwn)/W y = (y1w1 + y2w2 + … +
【PHP】靜態方法呼叫非靜態方法和靜態呼叫非靜態方法程式碼解讀
static 關鍵字用來修飾屬性、方法,稱這些屬性、方法為靜態屬性、靜態方法。 在類的靜態方法中是不能直接以$this->test()的方式呼叫非靜態方法的。還有框架中靜態的呼叫非靜態方法是怎麼回事??? 。。。 算了,不知道說啥 具體為啥看程式碼註釋: <?ph
【Hadoop】MapReduce平行計算框架
MapReduce平行計算框架 基本知識 前言 核心概念 計算模型 系統架構 作業配置 計算流程與機制 作業提交和初始化 Mapper Reducer
【YOLOV2】K-means 計算 anchor boxes
目錄 k-means原理 問題 演算法概要 k-means演算法缺點 k-means++演算法 k-means 計算 anchor boxes 距離公式 程式碼實現 參考 k-means原理 K-means演算法是很典型的基於距離的聚類演算法,採用距離
【pandas】apply方法傳入dataframe多列進行函式操作
參考:dataframe.apply官方文件 How to apply a function to two columns of Pandas dataframe python pandas- apply function with two arguments to colu
【C++】使用sizeof計算類物件所佔空間大小-sizeof總結
決定C ++中物件的大小的因素: 1.所有非靜態資料成員的大小 2.資料成員的順序 3.位元組對齊或位元組填充 4.其直接基類的大小虛擬函式的存在 5. 正在使用的編譯器 6.繼承模式(虛擬繼承) 一、使用sizeof計算類物件所佔空間大小
【原始碼】曲線交點計算——基於向量運算的快速互交點與自交點定位函式
本函式的作用是快速計算曲線的互交點與自交點,互交點是指兩條曲線之間的交點,自交點是指該曲線自己與自己的交點,如曲線“8”的中間點即為自交點。該函式編寫全部採用向量運算,沒有使用任何for迴圈,提高了程式碼的執行效率。 P = INTERX(L1,L2) 返回曲
【Http】HTTP方法的安全性和冪等性
Http協議規定了不同方法的安全特性和冪等特性,作為服務提供者的伺服器必需為客戶端提供這些特性。 安全性 僅指方法的多次呼叫不會產生副作用,不涉及傳統意義上的“安全”,這裡的副作用是指資源狀態。即,安全的方法不會修改資源狀態,儘管多次呼叫的返回值可能不一樣(被其
【pytorch】ConvTranspose2d的計算公式
in_channels(int) – 輸入訊號的通道數 out_channels(int) – 卷積產生的通道數 kerner_size(int or tuple) - 卷積核的大小 stride(int or tuple,optional) - 卷積步長,即要將輸入擴大的倍數。 padding(in
【轉載】Tableau 如何計算增長(去年及上個月或之前月份的)值
好久沒有更新了,今天主要分享一下在tableau中如何計算growth,也就是當前年跟去年或者上一個月份的差值。 當然每個人採取的方式不同,個人習慣在view中將PY及PM的值計算好,直接在tableau中去使用,首先我們說說在tableau中如何計算grw:
【Pandas】常規方法使用
文章目錄count count import pandas as pd a=[['1','2','5'],['1','4','7'],['2','5','6']] b=pd.DataFrame(a,co
【Swift】iOS UICollectionView 計算 Cell 大小的陷阱
前言 API 不熟悉導致的問題,想當然的去理解果然會出問題,這裡記錄一下 UICollectionView 使用問題。 宣告 歡迎轉載,但請保留文章原始出處:) 部落格園:http://www.cnblogs.com 農民伯伯: http://over140.cnblogs.com
【 專欄 】- Python 科學計算庫NumPy 完整教程
Python 科學計算庫NumPy 完整教程 NumPy 是 Python 在科學計算領域取得成功的關鍵之一,如果你想通過 Python 學習資料科學或者機器學習,就必須學習 NumPy。我認為 NumPy 的功能很強大,而且入門