fix:conflicts

This commit is contained in:
scales 2021-09-23 11:35:50 +08:00
commit 720d6c45f6
7 changed files with 295 additions and 126 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ tmp/
# vendor/
~$test.xlsx
lastupdate.tmp

View File

@ -62,7 +62,8 @@ func (c *TestPaperApiController) Display() {
response.SubTopics = append(response.SubTopics, tempSubTopic)
picName := testPaperInfo.Pic_src
//图片地址拼接 ,按服务器
src:="C:\\Users\\yang\\Desktop\\阅卷系统\\img\\"+picName
// src := "C:\\Users\\yang\\Desktop\\阅卷系统\\img\\" + picName
src := "./img/" + picName
bytes, err := os.ReadFile(src)
if err != nil {
log.Println(err)
@ -418,7 +419,8 @@ func (c *TestPaperApiController) Answer() {
for i := 0; i < len(tempString); i++ {
picName := tempString[i]
//图片地址拼接 ,按服务器
src:="C:\\Users\\yang\\Desktop\\阅卷系统\\img\\"+picName
// src:="C:\\Users\\yang\\Desktop\\阅卷系统\\img\\"+picName
src := "./img/" + picName
bytes, err := os.ReadFile(src)
if err != nil {
log.Println(err)
@ -487,7 +489,8 @@ func (c *TestPaperApiController) ExampleDetail() {
//转64编码
for j := 0; j < len(temp); j++ {
picName := temp[j].Pic_src
src:="C:\\Users\\yang\\Desktop\\阅卷系统\\img\\"+picName
// src:="C:\\Users\\yang\\Desktop\\阅卷系统\\img\\"+picName
src := "./img/" + picName
bytes, err := os.ReadFile(src)
if err != nil {
log.Println(err)

View File

@ -91,8 +91,6 @@ func CountArbitramentFinishNumberByQuestionId(questionId int64)(count int64,err
return count, err1
}
func CountFinishScoreNumberByQuestionId(questionId int64) (count int64, err error) {
record := new(ScoreRecord)
count, err1 := x.Where("question_id = ?", questionId).Where("test_finish=1").Count(record)
@ -184,7 +182,7 @@ func CountTestByScore(question int64, score int64) (count int64,err1 error){
}
func (s *ScoreRecord) Update() error {
code, err := x.Where(builder.Eq{"test_id": s.Test_id}).Update(s)
code, err := x.Where(builder.Eq{"test_id": s.Test_id}).AllCols().Update(s)
if code == 0 || err != nil {
log.Println("update ScoreRecord fail")
log.Printf("%+v", err)

View File

@ -26,7 +26,6 @@ type TestPaper struct {
Final_score_id string `json:"finale_score_id"`
Pratice_error int64 `json:"pratice_error"`
Correcting_status int64 `json:"correcting_status"`
}
func (t *TestPaper) GetTestPaperByQuestionIdAndQuestionStatus(question_id int64, question_statue int64) error {
@ -55,8 +54,8 @@ func (t *TestPaper) GetTestPaper(id int64) (bool,error) {
}
func (t *TestPaper) Update() error {
code, err := x.Where(builder.Eq{"test_id": t.Test_id}).Update(t)
if code == 0 || err != nil {
code, err := x.Where(builder.Eq{"test_id": t.Test_id}).AllCols().Update(t)
if code == 0 && err != nil {
log.Println("update test paper fail")
log.Printf("%+v", err)
}
@ -64,7 +63,7 @@ func (t *TestPaper) Update() error {
}
func (t *TestPaper) Insert() error {
code, err := x.Insert(t)
if code == 0 || err != nil {
if code == 0 && err != nil {
log.Println("insert test paper fail")
log.Printf("%+v", err)
}
@ -87,7 +86,6 @@ func FindUnDistributeTest(id int64 , t*[]TestPaper) error {
return err
}
func CountTestDistributionNumberByQuestionId(questionId int64) (count int64, err error) {
testPaper := new(TestPaper)
count, err1 := x.Where("question_id = ?", questionId).Where("correcting_status=?", 1).Count(testPaper)

View File

@ -36,7 +36,7 @@ func (t *TestPaperInfo) GetTestPaperInfoByTestIdAndQuestionDetailId(testId int64
func (t *TestPaperInfo) GetTestPaperInfo(id int64) error {
has, err := x.Where(builder.Eq{"test_detail_id": id}).Get(t)
if !has || err != nil {
if !has && err != nil {
log.Println("could not find test paper info")
log.Println(err)
}
@ -44,8 +44,8 @@ func (t *TestPaperInfo) GetTestPaperInfo(id int64) error {
}
func (t *TestPaperInfo) Update() error {
code, err := x.Where(builder.Eq{"test_detail_id": t.Test_detail_id}).Update(t)
if code == 0 || err != nil {
code, err := x.Where(builder.Eq{"test_detail_id": t.Test_detail_id}).AllCols().Update(t)
if code == 0 && err != nil {
log.Println("update test paper info fail")
log.Println(err)
}

169
tstex_modules/_api.ts Normal file
View File

@ -0,0 +1,169 @@
//THIS FILE DEFINES TS-TEX's API AND SHOULD NOT BE EDITED. IF EDITED YOU CAN REWRITE THIS FILE USING TsApiFile.rewrite().
//CHANGING ANY OF THIS CONTENT WILL NOT AFFECT THE ACTUAL API THAT IS EXPOSED BY THE RUNTIME AND THEREFORE WILL HAVE NO EFFECT!
export interface IRange
{
start: ILocation;
end: ILocation;
}
export interface ILocation
{
offset: number;
line: number;
column: number;
}
export abstract class ScopeAbstract
{
abstract input(file: string): string;
abstract configure(key: string, value: any);
abstract config<T>(key: string): T;
abstract fn(fn: () => any);
abstract eval(code: string);
abstract str(o: any): string;
abstract get state(): "idle"|"building";
workdir: string;
}
export interface IResolvable
{
}
export type IRootNode = IFnNode | ITextNode;
export type NodeType = "fn" | "text" | "parameter" | "parametersep" | "fnname" | "parameterlist" | "typeannotation" | "comment";
export interface INode
{
range: IRange;
type: NodeType;
}
export interface ITextNode extends INode
{
getText(filetext: string);
}
export interface IFnNode extends INode
{
complete: boolean;
parameters: IParameterListNode;
name: IFnNameNode;
getStatementText(filetext: string);
}
export interface IFnNameNode extends INode
{
name: string;
}
export interface IParameterListNode extends INode
{
parameters: IParameterNode[];
}
export interface IParameterNode extends INode
{
annotation: IAnnotationNode;
}
export interface IParameterSeperatorNode extends INode {}
export interface IAnnotationNode extends INode {}
export interface IResolver
{
resolve<T>(type: string, key?: string): T;
register(object: any, type: string, key?: string);
unregister(object: any);
}
export interface ISourceFile
{
path: string;
nodes: IRootNode[];
text: string;
}
export interface ILifecycleHookComponent
{
_prebuild?();
_postbuild?();
_init?();
_finalize?();
_resolvable?: boolean;
_resolver: IResolver;
}
export interface IModule extends ILifecycleHookComponent
{
}
export interface ILoggerFactory
{
getLogger(componentName: string): ILogger;
registerLogLambda(lambda: (component: string, message: string, level?: LogLevel, error?: any) => any);
}
export enum LogLevel
{
Debug, Verbose, Info, Warn, Error
}
export interface ILogger
{
log(message: string, level?: LogLevel, error?: any);
}
export interface IDiagnostic
{
message: string;
level: DiagnosticLevel;
location: IOffsetRange;
}
export interface IOffsetRange
{
start: number;
end: number;
}
export type DiagnosticLevel = "fatal"|"warn"|"error"|"info";
export class DiagnosticError extends Error
{
diagnostic: IDiagnostic;
constructor(message: string, level: DiagnosticLevel, location: IOffsetRange = null)
{
super(message);
location = location || {
start: 0,
end: null
};
this.diagnostic = {
message,
level,
location
};
}
}
export interface ICompletionItem
{
name: string;
sortText: string;
insertText?: string;
hasAction?: true;
source?: string;
isRecommended?: true;
}
export interface ICompletionItemProvider extends ILifecycleHookComponent
{
provideCompletionItems(triggerChar: string, node: IRootNode, file: ISourceFile): ICompletionItem[];
}
export const l = String.raw;
export const SCOPE: ScopeAbstract = null;
export const RESOLVER: IResolver = null;