Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop
commit
565f82c4aa
@ -0,0 +1,3 @@
|
||||
class SchoolDailyActiveUser < ActiveRecord::Base
|
||||
belongs_to :school_daily_report
|
||||
end
|
@ -1,3 +1,5 @@
|
||||
class SchoolDailyReport < ActiveRecord::Base
|
||||
belongs_to :school
|
||||
|
||||
has_many :school_daily_active_users, dependent: :delete_all
|
||||
end
|
@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="renderer" content="webkit"/><meta name="force-rendering" content="webkit"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Educoder</title><script type="text/javascript">window.__isR=!0</script><link rel="stylesheet" href="/react/build/css/css_min_all.css"><link rel="stylesheet" href="/assets/iconfont/iconfont.css"><link href="/react/build/./static/css/main.e1b0d6a5.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="md_div" style="display:none"></div><div id="root" class="page -layout-v -fit"></div><div id="picture_display" style="display:none"></div><script type="text/javascript" src="/react/build/js/js_min_all.js"></script><script type="text/javascript" src="/assets/kindeditor/kindeditor.js"></script><script type="text/javascript" src="/react/build/js/create_kindeditor.js"></script><script type="text/javascript" src="/javascripts/educoder/edu_application.js"></script><script type="text/javascript" src="/react/build/./static/js/main.85df3a28.js"></script></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="renderer" content="webkit"/><meta name="force-rendering" content="webkit"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Educoder</title><script type="text/javascript">window.__isR=!0</script><link rel="stylesheet" href="/react/build/css/css_min_all.css"><link rel="stylesheet" href="/assets/iconfont/iconfont.css"><link href="/react/build/./static/css/main.e1b0d6a5.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="md_div" style="display:none"></div><div id="root" class="page -layout-v -fit"></div><div id="picture_display" style="display:none"></div><script type="text/javascript" src="/react/build/js/js_min_all.js"></script><script type="text/javascript" src="/assets/kindeditor/kindeditor.js"></script><script type="text/javascript" src="/react/build/js/create_kindeditor.js"></script><script type="text/javascript" src="/javascripts/educoder/edu_application.js"></script><script type="text/javascript" src="/react/build/./static/js/main.994eab16.js"></script></body></html>
|
@ -0,0 +1,93 @@
|
||||
class MigrateHomeworkEndTime < ActiveRecord::Migration
|
||||
def up
|
||||
homework = HomeworkCommon.where(id: 18615).first
|
||||
if homework.present?
|
||||
transaction do
|
||||
homework.student_works.where("work_status = 2 and commit_time is not null and commit_time <= '#{homework.end_time}'").each do |work|
|
||||
work.work_status = 1
|
||||
work.late_penalty = 0
|
||||
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
|
||||
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
|
||||
work.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
homework = HomeworkCommon.where(id: 18614).first
|
||||
if homework.present?
|
||||
homework.update_column('end_time', '2019-05-20 00:00:00')
|
||||
transaction do
|
||||
homework.student_works.where("work_status = 2 and commit_time is not null and commit_time <= '2019-05-20 00:00:00'").each do |work|
|
||||
work.work_status = 1
|
||||
work.late_penalty = 0
|
||||
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
|
||||
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
|
||||
work.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
homework = HomeworkCommon.where(id: 18617).first
|
||||
if homework.present?
|
||||
homework.update_column('end_time', '2019-05-29 00:00:00')
|
||||
homework.save
|
||||
transaction do
|
||||
homework.student_works.where("work_status = 2 and commit_time is not null and commit_time <= '2019-05-29 00:00:00'").each do |work|
|
||||
work.work_status = 1
|
||||
work.late_penalty = 0
|
||||
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
|
||||
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
|
||||
work.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
homework = HomeworkCommon.where(id: 18616).first
|
||||
if homework.present?
|
||||
homework.update_column('end_time', '2019-06-10 00:00:00')
|
||||
homework.save
|
||||
transaction do
|
||||
homework.student_works.where("work_status = 2 and commit_time is not null and commit_time <= '2019-06-10 00:00:00'").each do |work|
|
||||
work.work_status = 1
|
||||
work.late_penalty = 0
|
||||
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
|
||||
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
|
||||
work.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
homework = HomeworkCommon.where(id: 25901).first
|
||||
if homework.present?
|
||||
homework.update_column('end_time', '2019-06-16 00:00:00')
|
||||
homework.save
|
||||
transaction do
|
||||
homework.student_works.where("work_status = 2 and commit_time is not null and commit_time <= '2019-06-16 00:00:00'").each do |work|
|
||||
work.work_status = 1
|
||||
work.late_penalty = 0
|
||||
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
|
||||
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
|
||||
work.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
homework = HomeworkCommon.where(id: 25902).first
|
||||
if homework.present?
|
||||
homework.update_column('end_time', '2019-06-17 00:00:00')
|
||||
homework.save
|
||||
transaction do
|
||||
homework.student_works.where("work_status = 2 and commit_time is not null and commit_time <= '2019-06-17 00:00:00'").each do |work|
|
||||
work.work_status = 1
|
||||
work.late_penalty = 0
|
||||
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
|
||||
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
|
||||
work.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
@ -0,0 +1,31 @@
|
||||
class MigrateShixunStudentWorkScore2 < ActiveRecord::Migration
|
||||
def up
|
||||
homeworks = HomeworkCommon.where(id: [18615, 18614, 18617, 18616, 25901, 25902])
|
||||
homeworks.each do |homework|
|
||||
transaction do
|
||||
homework.student_works.where("work_status > 0").each do |work|
|
||||
if homework.end_time > Time.now
|
||||
work.work_status = 1
|
||||
work.late_penalty = 0
|
||||
else
|
||||
myshixun = work.myshixun
|
||||
|
||||
if myshixun.status == 1 && myshixun.try(:done_time) < homework.end_time
|
||||
work.work_status = 1
|
||||
work.late_penalty = 0
|
||||
else
|
||||
work.work_status = 2
|
||||
work.late_penalty = homework.late_penalty
|
||||
end
|
||||
end
|
||||
score = work.final_score.to_f + work.eff_score.to_f - work.late_penalty.to_f
|
||||
work.work_score = format("%.2f", score < 0 ? 0 : score.to_f) unless work.ultimate_score
|
||||
work.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
@ -0,0 +1,10 @@
|
||||
class CreateSchoolDailyActiveUsers < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :school_daily_active_users do |t|
|
||||
t.integer :school_daily_report_id
|
||||
t.integer :user_id
|
||||
end
|
||||
|
||||
add_index :school_daily_active_users, :school_daily_report_id
|
||||
end
|
||||
end
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,154 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import RFB from '@novnc/novnc/lib/rfb.js';
|
||||
|
||||
const $ = window.$;
|
||||
// const showIframeContent = window.location.search.indexOf('vnc=1') != -1;
|
||||
class VNCDisplay extends Component {
|
||||
componentDidMount() {
|
||||
console.log(RFB)
|
||||
|
||||
let rfb;
|
||||
let desktopName;
|
||||
// When this function is called we have
|
||||
// successfully connected to a server
|
||||
function connectedToServer(e) {
|
||||
status("Connected to " + desktopName);
|
||||
}
|
||||
// This function is called when we are disconnected
|
||||
function disconnectedFromServer(e) {
|
||||
if (e.detail.clean) {
|
||||
status("Disconnected");
|
||||
} else {
|
||||
status("Something went wrong, connection is closed");
|
||||
}
|
||||
}
|
||||
// When this function is called, the server requires
|
||||
// credentials to authenticate
|
||||
function credentialsAreRequired(e) {
|
||||
const password = prompt("Password Required:");
|
||||
rfb.sendCredentials({ password: password });
|
||||
}
|
||||
// When this function is called we have received
|
||||
// a desktop name from the server
|
||||
function updateDesktopName(e) {
|
||||
desktopName = e.detail.name;
|
||||
}
|
||||
// Since most operating systems will catch Ctrl+Alt+Del
|
||||
// before they get a chance to be intercepted by the browser,
|
||||
// we provide a way to emulate this key sequence.
|
||||
function sendCtrlAltDel() {
|
||||
rfb.sendCtrlAltDel();
|
||||
return false;
|
||||
}
|
||||
// Show a status text in the top bar
|
||||
function status(text) {
|
||||
document.getElementById('status').textContent = text;
|
||||
}
|
||||
// This function extracts the value of one variable from the
|
||||
// query string. If the variable isn't defined in the URL
|
||||
// it returns the default value instead.
|
||||
function readQueryVariable(name, defaultValue) {
|
||||
// A URL with a query parameter can look like this:
|
||||
// https://www.example.com?myqueryparam=myvalue
|
||||
//
|
||||
// Note that we use location.href instead of location.search
|
||||
// because Firefox < 53 has a bug w.r.t location.search
|
||||
const re = new RegExp('.*[?&]' + name + '=([^&#]*)'),
|
||||
match = document.location.href.match(re);
|
||||
if (typeof defaultValue === 'undefined') { defaultValue = null; }
|
||||
if (match) {
|
||||
// We have to decode the URL since want the cleartext value
|
||||
return decodeURIComponent(match[1]);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
document.getElementById('sendCtrlAltDelButton')
|
||||
.onclick = sendCtrlAltDel;
|
||||
// Read parameters specified in the URL query string
|
||||
// By default, use the host and port of server that served this file
|
||||
|
||||
// const host = readQueryVariable('host', window.location.hostname);
|
||||
// let port = readQueryVariable('port', window.location.port);
|
||||
// const password = readQueryVariable('password', '');
|
||||
|
||||
const { vnc_url } = this.props;
|
||||
// http://117.50.12.63:43149/vnc_lite.html?password=headless
|
||||
let _ar1 = vnc_url.split('/');
|
||||
let ipAndPort = _ar1[2].split(':')
|
||||
let passwordAr = _ar1[3].split('password=')
|
||||
const host = ipAndPort[0]
|
||||
let port = ipAndPort[1]
|
||||
const password = passwordAr[1].split('&')[0]
|
||||
|
||||
const path = readQueryVariable('path', 'websockify');
|
||||
// | | | | | |
|
||||
// | | | Connect | | |
|
||||
// v v v v v v
|
||||
status("Connecting");
|
||||
// Build the websocket URL used to connect
|
||||
let url;
|
||||
// if (window.location.protocol === "https:") {
|
||||
// url = 'wss';
|
||||
// } else {
|
||||
url = 'ws';
|
||||
// }
|
||||
url += '://' + host;
|
||||
if(port) {
|
||||
url += ':' + port;
|
||||
}
|
||||
url += '/' + path;
|
||||
// Creating a new RFB object will start a new connection
|
||||
rfb = new RFB(document.getElementById('screen'), url,
|
||||
{ credentials: { password: password } });
|
||||
// Add listeners to important events from the RFB module
|
||||
rfb.addEventListener("connect", connectedToServer);
|
||||
rfb.addEventListener("disconnect", disconnectedFromServer);
|
||||
rfb.addEventListener("credentialsrequired", credentialsAreRequired);
|
||||
rfb.addEventListener("desktopname", updateDesktopName);
|
||||
// Set parameters that can be changed on an active connection
|
||||
rfb.viewOnly = readQueryVariable('view_only', false);
|
||||
rfb.scaleViewport = readQueryVariable('scale', false);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { challenge, vnc_url } = this.props
|
||||
|
||||
|
||||
return (
|
||||
<div className="">
|
||||
<style>{`
|
||||
#top_bar {
|
||||
background-color: #6e84a3;
|
||||
color: white;
|
||||
font: bold 12px Helvetica;
|
||||
padding: 6px 5px 4px 5px;
|
||||
border-bottom: 1px outset;
|
||||
}
|
||||
#status {
|
||||
text-align: center;
|
||||
}
|
||||
#sendCtrlAltDelButton {
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
border: 1px outset;
|
||||
padding: 5px 5px 4px 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#screen {
|
||||
flex: 1; /* fill remaining space */
|
||||
overflow: hidden;
|
||||
}
|
||||
`}</style>
|
||||
<div id="top_bar">
|
||||
<div id="status">Loading</div>
|
||||
<div id="sendCtrlAltDelButton">Send CtrlAltDel</div>
|
||||
</div>
|
||||
<div id="screen"></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default VNCDisplay;
|
Loading…
Reference in new issue