A method and system for saving and restoring a calculation draft
By establishing a link between the draft canvas and the exam and question icons in the online examination system, and collecting handwriting data to form calculation blocks and steps, the problems of draft data isolation and loss are solved, enabling reliable saving and recovery of drafts. It also supports logical indexing and rendering optimization, and forms verifiable answer records.
Patent Information
- Application Number
- CN202611674736.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-28
- Publication Date
- 2026-11-24
AI Technical Summary
In existing online examination systems, draft data is difficult to reliably isolate according to examination session and question identifier, is easily lost when the network fluctuates or the browser malfunctions, and lacks an adaptive saving mechanism and logical index, resulting in slow interface response and incomplete recording of the answer process.
By establishing a connection between the draft canvas and the exam and question icons, handwriting data is collected to form calculation blocks and steps, a logical index is established, and integrity verification values and version snapshots are obtained during the saving phase. During the recovery phase, verification and breakpoint location are performed, and caching or vector reconstruction is performed in combination with the viewport status.
It achieves reliable isolation and seamless recovery of draft data, supports step jumps and breakpoint resume calculations, reduces rendering burden, and forms a verifiable record of the answer process.
Smart Images

Figure CN123157668A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of online examinations and computer-aided assessments, and particularly relates to a method and system for saving and restoring calculation drafts. Background Technology
[0002] With the development of online examinations, remote answering, and computer-aided assessment technologies, online examination systems typically provide candidates with electronic drafting functionality for recording their calculation processes. Current electronic drafting is generally based on web canvases or mobile terminal drawing components, capturing handwriting via touch, mouse, or electronic pen, and saving the stroke data locally or on a server. Some systems also support automatic saving, clearing, restoring, and archiving of drafts, allowing candidates to record their calculations during the answering process and view historical drafts when re-entering the question.
[0003] However, existing electronic draft systems typically save draft data as full-page images or unstructured stroke sets, making it difficult to reliably isolate drafts according to exam session and question identifiers. Furthermore, data loss is prone to occur during continuous writing, network fluctuations, or browser crashes. Current saving mechanisms generally lack adaptive saving based on writing pauses, calculation step transitions, and calculation block completion states, and the clearing operation lacks a reversible version management mechanism. When editing the same question simultaneously across multiple tabs, drafts are easily overwritten. Simultaneously, existing systems struggle to identify calculation steps based on the spatial location, temporal relationship, and writing structure of handwriting, and cannot establish logical indexes for step jumps and breakpoint continuation. When draft content is extensive, continuous vector rendering of all handwriting can also cause slow interface response. In addition, there is a lack of integrity verification, archiving, and behavior association mechanisms between draft data and answer submission records, making it difficult to create a verifiable record of the answering process. Summary of the Invention
[0004] To solve the above-mentioned technical problems, the present invention provides a method for saving and restoring calculation drafts, comprising: A draft canvas is created based on the draft trigger operation and associated with the exam icon and question icon. Handwriting data is collected based on the draft canvas. The handwriting data is used to form calculation blocks and calculation steps; logical indexes are established based on the calculation steps. During the saving phase, the draft data, integrity check value, and version snapshot are obtained and saved based on the handwriting data, calculation steps, and logical index. During the recovery phase, the draft data is retrieved according to the draft recovery request and its integrity is verified. If the verification passes, the draft canvas is reconstructed based on the draft data. If the verification fails, the draft canvas is restored based on the version snapshot, and the breakpoint is located or the target calculation step is jumped to according to the logical index. The computational blocks are cached or vector reconstructed based on the viewport state.
[0005] Optionally, collecting handwriting data based on the draft canvas includes: calling a unified pointer event interface based on the draft canvas to obtain pointer events from the input device; Based on the pointer event, obtain the sampling points including canvas coordinates, pressure value, and relative timestamp; Stroke data is generated based on continuous sampling points.
[0006] Optionally, the calculation block and calculation steps based on the handwriting data include: obtaining the time interval and spatial bounding box relationship between adjacent strokes based on the stroke data; Based on the judgment result that the time interval is less than a preset threshold and the spatial bounding boxes are adjacent or overlapping, the corresponding strokes are assigned to the same calculation block; The type of computation step is determined based on the derivation arrows, equal sign chains, or conclusion symbols in the computation block.
[0007] Optionally, the step of obtaining and saving the draft data, integrity check value, and version snapshot based on the handwriting data, calculation steps, and logical index during the saving stage includes: Save stroke data stroke by stroke based on stroke completion events; The saving frequency is reduced based on the judgment result that the time interval between adjacent strokes exceeds the pause threshold; Based on events such as resuming writing after a pause, switching calculation steps, completing a calculation block, or forming a conclusion, the complete draft state is saved and a milestone snapshot with semantic tags is generated.
[0008] Optionally, establishing a logical index based on the calculation steps includes: obtaining the step sequence, step type, time interval, spatial region, and stroke identifier based on the calculation steps; A logical index is established based on the sequence of steps, step type, time interval, spatial region, and stroke identifier; The logical index is saved based on the association between the logical index and the draft data.
[0009] Optionally, the step of acquiring and saving draft data, integrity verification values, and version snapshots during the saving phase includes: Calculate the integrity check value based on the draft data; Obtain the current stroke data based on the clear operation; generate a snapshot of the previous version based on the current stroke data; The integrity verification value, the previous version snapshot, and the draft data are saved.
[0010] Optionally, the step of retrieving the draft data and performing integrity verification based on the draft recovery request during the recovery phase includes: Retrieve draft data associated with the exam identifier and question identifier based on the draft recovery request; Recalculate the current integrity check value based on the draft data; The integrity of the draft data is determined based on the comparison between the current integrity check value and the saved integrity check value. Retrieve the previous version snapshot based on the result that the draft data is incomplete.
[0011] Optionally, the step of locating the breakpoint or jumping to the target calculation based on the logical index during the recovery phase includes: The step type and stroke end time of each calculation step are obtained according to the logical index; Eliminate steps with known conditions and steps with notes based on the step type; The breakpoint is determined based on the calculation step in the remaining calculation steps where the last stroke ends the latest and there are no new strokes within the step that exceed the preset duration. The target calculus step is retrieved according to the step jump instruction, and the spatial region of the target calculus step is located.
[0012] Optionally, caching or vector reconstruction of the computation block based on the viewport state includes: The spatial bounding box of each computation block is obtained according to the logical index; The location of the computation block outside the viewport is determined based on the intersection relationship between the viewport rectangle and the bounding box. A low-resolution bitmap cache is generated based on the results where the computation block is located outside the viewport and has not been edited for a preset time. The low-resolution bitmap cache is deleted and vector rendering is rebuilt based on the result of the determined calculation block re-entering the viewport or receiving the result of the editing operation.
[0013] To address the aforementioned technical problems, the present invention also provides a system for saving and restoring calculation drafts, comprising: The draft canvas creation module is used to create a draft canvas associated with the exam icon and question icon based on the draft trigger operation; The handwriting acquisition module is used to acquire handwriting data based on the draft canvas. The calculation block and step formation module is used to form calculation blocks and calculation steps based on the handwriting data; A logical index building module is used to build a logical index based on the calculation steps; The saving module is used to obtain and save draft data, integrity verification value and version snapshot based on the handwriting data, calculation steps and logical index during the saving stage. The recovery module is used to retrieve the draft data according to the draft recovery request and perform integrity verification during the recovery phase. If the verification passes, the draft canvas is reconstructed according to the draft data. If the verification fails, the draft canvas is restored based on the version snapshot, and the breakpoint is located or the target calculation step is jumped to according to the logical index. The rendering cache module is used to cache or reconstruct the computation blocks based on the viewport state.
[0014] On the other hand, the present invention also provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method when executing the computer program.
[0015] On the other hand, the present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method.
[0016] Compared with the prior art, the present invention has the following advantages and technical effects: This invention enables the associated management of draft data based on exam and question identifiers, performs hierarchical saving according to strokes, pauses, and key calculation nodes, and achieves anomaly recovery and reversible clearing through integrity check value version snapshots. It reduces overwriting caused by multi-tab editing through a concurrent data merging mechanism, identifies calculation blocks and steps through spatial location, timestamps, and writing structure, and establishes logical indexes to support step jumps and breakpoint location. It reduces the rendering burden of large amounts of handwriting through viewport-outside bitmap caching and viewport-inside vector reconstruction, and combines submission records, archived data, and behavior timelines to form verifiable answer process data. Attached Figure Description
[0017] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a schematic diagram of the method flow according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a system according to an embodiment of the present invention. Detailed Implementation
[0018] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0019] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0020] Example 1 like Figure 1 As shown, this embodiment provides a method for saving and restoring calculation drafts, including: A draft canvas is created based on the draft trigger operation and associated with the exam icon and question icon. Handwriting data is collected based on the draft canvas. The handwriting data is used to form calculation blocks and calculation steps; logical indexes are established based on the calculation steps. During the saving phase, the draft data, integrity check value, and version snapshot are obtained and saved based on the handwriting data, calculation steps, and logical index. During the recovery phase, the draft data is retrieved according to the draft recovery request and its integrity is verified. If the verification passes, the draft canvas is reconstructed based on the draft data. If the verification fails, the draft canvas is restored based on the version snapshot, and the breakpoint is located or the target calculation step is jumped to according to the logical index. The computational blocks are cached or vector reconstructed based on the viewport state.
[0021] The specific process includes: This embodiment provides a method for saving and restoring computational drafts. Its core concept lies in achieving real-time saving and seamless restoration of computational drafts through a management chain of "stroke-level event-driven acquisition → context-aware hierarchical saving and snapshot protection → draft retrieval and restoration." Furthermore, it establishes verifiable capabilities such as computational block cluster management, derivation chain structure detection and hierarchical storage of steps, backtracking by computational logic and breakpoint continuation, computational block rendering degradation, reversible clearing to prevent accidental deletion, merging of concurrent conflicts across multiple tabs, computation-submission sequence verification, and evidence preservation and archiving. The method of this embodiment includes the following steps: Step S1: During the question-answering process, the calculation draft mode is triggered. The client creates a draft canvas based on HTML5 Canvas and checks whether there is historical draft data associated with the current exam and the current question.
[0022] In one specific implementation, the toolbar of the question-answering interface has a "scratch paper" function entry. When triggered, a draft canvas is created in the form of a modal box, side drawer, or full-screen overlay. The toolbar is initialized and provides tools such as pen color selection, line width adjustment, eraser, undo / redo, and clear. If there is historical draft data for the current question, it is automatically loaded and rendered, and a restore prompt message is displayed to the examinee.
[0023] Step S2: Collect handwriting data from the multimodal input device through the unified pointer event interface. For each sampling point, at least the canvas coordinates, pressure sensitivity value, and relative timestamp are recorded.
[0024] In one specific implementation, W3C Pointer Events (pointerdown, pointermove, pointerup) are registered on the canvas to ensure uniform compatibility with mice, touchscreens, and pressure-sensitive writing tablets. During pointer movement, handwriting points are collected at a sampling frequency synchronized with the screen refresh rate. Each sampling point records its coordinates (floating-point number), pressure sensitivity value (0.0 to 1.0, default 0.5 for non-pressure-sensitive devices), and millisecond offset relative to the stroke start time. A quadratic Bézier curve smoothing fitting algorithm is used to render the handwriting segments in real time. When the pointer is lifted, the stroke ends, the end timestamp is recorded, and the stroke object is appended to the global stroke array.
[0025] Step S3 employs a context-aware hierarchical saving strategy, saving all stroke data of the current question along with the integrity verification value and the previous version snapshot. It also establishes a correspondence between draft data and exam and question identifiers to isolate draft data across different exam sessions and questions. Specifically, during continuous writing, each stroke is saved sequentially based on completion events. The saving frequency is reduced when a writing pause exceeds a preset threshold. Forced saving is implemented at key nodes such as step switching, calculation block completion, resumption of writing after a pause, and conclusion formation. Milestone snapshots with semantic tags are created, and these milestone snapshots are managed independently of the previous version snapshot.
[0026] In one specific implementation, all stroke data of the current question, along with the exam identifier, question identifier, last modification time, integrity check value, and previous version snapshot, are organized into draft data. If an old draft exists before saving, the stroke array of the old draft is copied to the previous version snapshot field of the new draft to achieve automatic maintenance of the version snapshot. The save operation is wrapped in an exception handling block to ensure that a save failure does not affect normal answering.
[0027] In another specific implementation, the hierarchical saving strategy monitors the writing rhythm in real time: during continuous writing, it maintains an event-driven approach of "saving after each stroke," minimizing the data loss window; when the interval between two strokes exceeds a preset pause threshold (e.g., 15 seconds), it determines that the examinee has entered a thinking pause period, automatically reducing the saving frequency (e.g., stopping stroke-by-stroke saving and only retaining the memory state) to avoid meaningless high-frequency writing; when writing resumes after a pause, it forcibly saves the current complete state and creates a milestone snapshot with the semantic label "resumption after pause." When key nodes such as step switching and calculation block completion are detected (see the step-by-step data in step S7), it also forcibly saves and creates milestone snapshots with semantic labels, such as "step 3 completed" or "when conclusion is formed." The milestone snapshot contains complete stroke data and step metadata at that moment, independent of the regular previous version snapshot storage and management, supporting examinees or the system to retrieve and restore any key state by semantic labels. During restoration, the current state is first saved as a snapshot to ensure reversibility.
[0028] Step S4: When entering the draft canvas, retrieve the draft data according to the correspondence, and reconstruct the visual state of the draft canvas stroke by stroke after verifying the integrity of the retrieved draft data.
[0029] In one specific implementation, the integrity verification includes: recalculating the hash value of the stroke array content and comparing it with the saved integrity verification value; if they do not match, the data is determined to be corrupted, and a downgrade attempt is made to restore from the previous version snapshot; simultaneously, the compatibility of the data format version number with the currently supported version number is verified. After the verification passes, the canvas is completely reconstructed, and a recovery prompt is displayed to the examinee, including the last save time; if the data object contains a previous version snapshot, the "Restore Previous Version" button is activated, achieving reversible version rollback.
[0030] Step S5, Lifecycle Management. Draft data cleanup follows the principles of "explicit triggering, precise cleanup, and delayed release": When performing a clear operation, the current stroke array is saved as a snapshot of the previous version, followed by an empty stroke array and canvas, while retaining the already saved draft data; when a snapshot of the previous version is detected, a version rollback is performed based on the snapshot, restoring the stroke data from the snapshot to the canvas and resaving the data before the rollback as a snapshot, achieving reversible clearing and restoration; when starting a new exam session, old drafts that do not belong to the current exam identifier are deleted; a silent expiration cleanup is performed during system initialization, deleting drafts that have exceeded their retention period.
[0031] Step S6, concurrent save conflict merging. Before the save operation is executed, the existing data of the draft is read. If the last modification time of the existing data is later than the time when the current tab was last loaded or read the draft, it is determined that there is concurrent saving from other tabs; At this point, the stroke data that has not yet been saved in the current tab is merged with the existing stroke data in the order of the timestamps of each stroke and then saved. When the amount of data after merging exceeds the preset limit, the data with the newest last modification time is used to overwrite and save, ensuring that the saving is successful.
[0032] Step S7 involves clustering computational blocks, detecting the derivation chain structure, storing steps in a hierarchical manner, and backtracking and resuming computation based on operational logic. Based on the spatial position and timestamp of each stroke, all strokes in the draft canvas are clustered into multiple computational blocks. Each computational block consists of a set of spatially adjacent and temporally continuous strokes. Writing structure clues within each computational block are detected, and the computational blocks are organized into computational steps based on these clues, forming a three-layer logical structure of problem, steps, and strokes. Logical indexes are built based on step-by-step data, supporting retrieval, backtracking, and breakpoint continuation by operational logic; in response to block-level operation instructions, the calculation blocks are moved, scaled, deleted, or referenced as a whole, and the saved draft data is updated synchronously; when clearing or concurrent merging is performed, data is organized and merged at the granularity of calculation blocks.
[0033] In one specific implementation, strokes with a time interval less than a preset threshold and whose spatial bounding boxes are adjacent or overlapping are grouped into the same calculation block, and the calculation block is represented by a bounding box rectangle; candidates can drag the calculation block to move it as a whole, scale it, delete it individually, or drag the calculation block to the reference area to generate a reference copy; After block-level operations, the bounding boxes of each calculation block are recalculated and the block metadata in the draft data is updated. When saving, the stroke data is organized with the calculation block as the basic unit. The clear operation and concurrent merging are both performed at the calculation block level to avoid the stroke data in the block being disordered.
[0034] In another specific implementation, derivation chain structure detection is performed: for each computational block, writing structure clues are detected based on the geometric and directional features of the vector handwriting. (a) Derivation arrow: Slender strokes with a bounding box aspect ratio greater than a preset threshold (e.g., 3) and whose endpoint direction forms an angle greater than a preset angle (e.g., 30°) with the overall direction of the stroke are determined as derivation arrows, used to represent the direction of reasoning; (b) Equal sign chain: Two strokes that are spatially adjacent, have similar lengths, have a vertical spacing within a preset range, and overlap in the horizontal direction are determined to be equal sign chains, which are used to characterize equation transformations; (c) Conclusion symbol: The three small strokes that are arranged in an inverted triangle and are located in the middle of the third stroke at the bottom are determined to be the conclusion symbol, which is used to represent the derivation conclusion.
[0035] All structural clue detection is based on the geometric and directional features of vector handwriting, without involving image recognition. The step type is determined based on the structural clues contained in the calculation block: calculation blocks containing conclusion symbols are determined to be conclusion steps, calculation blocks containing derivation arrows or equal sign chains are determined to be intermediate derivation steps, and the remaining calculation blocks are determined to be known conditions or note steps; the calculation blocks are sorted by writing time to obtain the step sequence number, and the step metadata (type, time interval, spatial region, and stroke identifiers) is saved together with the draft data, forming a three-layer logical structure of "title → step → stroke".
[0036] In another specific implementation, the calculation is performed based on step-by-step data, allowing for logical backtracking and breakpoint continuation: a logical index table is established with steps as the index, supporting jumps to any calculation step according to the derivation order (known conditions → intermediate derivation → conclusion) or logical relationship; when the draft is restored, the last completed logical derivation step is located as the breakpoint, prompting the examinee to "continue the calculation from here"; The breakpoint determination rule is as follows: In the step-based data, the last step that is deduced is selected (i.e., the step with the latest end time of the last stroke in the step and whose step type does not belong to known conditions or remarks). If there are no new strokes in the step for more than the preset time, the step is considered to be completed. It supports generating a continuation copy by referencing the complete state (handwriting and metadata) of any historical step for continuation or review. The continuation result is saved independently and does not overwrite the original step.
[0037] Step S8: Degraded caching of computed blocks. For computed blocks that do not intersect with the viewport, their rendering results are cached as low-resolution bitmaps, while computed blocks within the viewport maintain real-time vector rendering. When a computed block re-enters the viewport or receives an editing operation, vector rendering is reconstructed as needed. The low-resolution bitmap also serves as a thumbnail preview of the computed blocks in the draft management interface.
[0038] In one specific implementation, the system maintains the intersection determination of the viewport rectangle and the bounding boxes of each computation block; for computation blocks that do not intersect with the viewport and have not been edited for a preset time, a low-resolution bitmap (approximately 160×120) is rendered in the off-screen canvas and cached. When the canvas is redrawn, the cached bitmap is drawn directly to avoid performing vector redrawing on all strokes every frame; when the computation block re-enters the viewport or is selected for editing, the cache is discarded and vector rendering is restored; the cached bitmap is also used for the thumbnail preview displayed by computation block in the draft management interface, allowing candidates to quickly locate the relevant parts.
[0039] Step S9, Calculation-Submission Timing Reasonableness Verification. When the answer submission time is earlier than the sum of the calculation start time and the preset minimum calculation time, it is determined that the calculation process record for that question is inconsistent with the answer submission record. An anomaly identifier data representing this inconsistency is generated and associated with the answer record for that question for invigilators or reviewers to verify. This verification is a pure client-side timestamp arithmetic comparison, does not rely on the network or server clock, and can be completed offline.
[0040] Step S10: Comparison of draft hash verification with the review record. The integrity verification value of the draft data is uploaded to the server for verification along with the answer submission record. During the score review, the integrity verification value of the draft data on the candidate's device is recalculated and compared with the value stored on the server. If they do not match, it is determined that the draft data has been tampered with. This mechanism upgrades the draft from "process data visible only to the candidate" to "verifiable evidence of the answer".
[0041] Step S11: Submit all draft data and archive it. When submitting the exam, read all the draft data of all questions in this exam, and package it together with the question list and integrity check value into a single archive data and upload it to the server for archiving as objective evidence for grade review; after successful archiving, clean up the draft data according to the preset strategy to complete the evidence preservation.
[0042] Step S12, Draft Behavior Timeline Monitoring. Collect draft-related behavioral events, including opening, completing strokes, clearing, restoring, and exporting. Combine these with answer events to generate timestamped behavioral timeline data, which is then uploaded to the server for real-time viewing by the proctor, for remote supervision of the answering process and identification of abnormal behavior.
[0043] On the other hand, this embodiment also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method when executing the computer program.
[0044] On the other hand, this embodiment also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method.
[0045] Example 2 This embodiment provides a method for saving and restoring calculation drafts, including: In a specific application scenario, let's take a high school math calculation problem as an example: Given the function... Find the maximum value of f(x) on the interval [1,4]. Candidates should click the "Draft Paper" icon in the question toolbar; the system will open the Canvas draft canvas in a full-screen modal. The toolbar is initialized with a black pen (3px line width), eraser, and undo button; the system retrieves draft data for this problem, initially entering a blank canvas with no historical drafts. The test taker writes the derivation process on the canvas: The maximum value is 3. The system collects the sampling points (coordinates, pressure sensitivity, relative timestamp) of each stroke in real time, for a total of 15 strokes, and uses double Bezier smoothing rendering.
[0046] After the last stroke is completed, the system constructs a draft data object (including the stroke array, last modification time, and integrity check value; prevSnapshot is null upon first save), saves the draft, and the toolbar status bar updates to "Automatically saved 12:30:05". If the candidate's browser crashes and restarts after completing the calculation, and they log in again and open the draft paper, the system retrieves the non-empty draft data for that question, recalculates the hash value, compares it with the saved integrity check value, and reconstructs all the strokes stroke by stroke. A prompt appears: "Unsaved draft calculation detected, automatically restored (last save: 12:30:05)".
[0047] After submitting their answer to the question, candidates click "Clear Draft." A confirmation dialog box indicates that they can undo the process by clicking "Restore Previous Version." After confirmation, the current 15 strokes are deeply copied to prevSnapshot, the strokes array is set to empty, the canvas is redrawn to a blank canvas, and the draft data is retained. When candidates need to review the derivation, they click "Restore Previous Version." The system restores the snapshot strokes to the canvas and saves the empty data before the rollback as a new snapshot, achieving reversible clearing and restoration.
[0048] In another specific application scenario, let's take a physics electrostatics calculation problem as an example: Two point charges are located at (0,0) and (3,0) respectively, with charges of +2μC and -1μC. Find the coordinates of the position on the x-axis where the electric field strength is zero. Candidates should draw a simplified coordinate system (blue), charge labels (red), and formula derivations (black) on their draft paper, totaling approximately 40 strokes. Each stroke should be saved independently by color, allowing for viewing and modification based on color distinctions.
[0049] In another specific application scenario, a test taker simultaneously opens the same question from the same exam in browser tabs A and B, and performs the calculation on the draft paper in each tab. Tab A saves at 12:30:00 (15 strokes), and tab B saves at 12:30:40. Before saving, tab B reads the existing data in the draft and finds that its last modification time of 12:30:00 is later than the page's most recent load time of 12:29:50, thus determining that concurrent saving exists. The system merges the 10 unsaved strokes on this page with the existing 15 strokes according to their timestamps, saving them as a total of 25 strokes. Duplicate timestamps are removed, and the calculated content of both pages is completely preserved without any overwriting or loss. If the merged data exceeds a preset limit, the system will retain the data with the more recent modification time and overwrite it to ensure successful saving.
[0050] In another specific application scenario, when submitting the exam, the system reads the draft data of all questions in the exam, packages it together with the question list and the integrity check value of each item into a single archive data, uploads it to the server for archiving, and generates an archive-level integrity check value; the draft integrity check value is also uploaded for evidence along with the answer submission record.
[0051] During grade review, the system recalculates the verification value of the draft on the candidate's device and compares it with the value stored on the server. If they match, it proves that the draft has not been modified since submission; if they do not match, it indicates that the draft has been tampered with or the device data is corrupted, prompting reviewers to be cautious in accepting the evidence. After successful archiving, the draft is cleaned up according to the preset retention period, completing the evidence preservation.
[0052] In another specific application scenario, the system collects candidates' behavioral events on the draft paper (opening the draft, completing each stroke, clearing, restoring, and exporting) and answering events (selecting a question, changing the selection, and submitting), merges them to generate a timeline data stream of behavior with timestamps, and reports it to the proctoring terminal in real time; the proctoring terminal presents the candidate's behavior throughout the exam in the form of a timeline, such as "12:29:10 open the draft for question 3, 12:30:45 complete the 15th stroke, 12:31:02 submit the answer", which is used for remote proctoring and abnormal behavior identification.
[0053] In another specific application scenario, when a test taker performs calculations on the draft paper for question 3, they first write out the differentiation process. Draw a derivation arrow pointing to the next line, then derive the conclusion on the right side of the canvas, and finally write "When x=4, the maximum value is 3".
[0054] The system clusters all strokes into calculation blocks based on time intervals and bounding boxes: a differentiation process block (12 strokes, 12:10:00-12:12:35) and a conclusion derivation block (8 strokes, 12:12:53-12:14:00). The time interval between blocks is 18 seconds, and the coordinate regions do not intersect. Derivation chain detection: In the differentiation process block, one derivation arrow (bounding box aspect ratio 6.2, endpoint direction angle with the overall direction 58°) and one set of equal sign chains (two short horizontal lines, lengths 31px and 33px, vertically spaced 10px, horizontally overlapping) are detected, which are identified as intermediate derivation steps. Three small strokes arranged in an inverted triangle were detected in the conclusion derivation block (the y-coordinate difference between the top two points is 8px, and the third point is located 24px below with its x-coordinate centered). These were identified as conclusion symbols, and the block was determined to be the conclusion step. The system assigned step sequence numbers 1 and 2 to the two blocks, generated step metadata (type, time interval, spatial region, and stroke identifier list), forming a three-layer structure of "question → step → stroke" and saving it along with the draft data.
[0055] If a test taker finds insufficient space at the bottom of the canvas, they drag the entire conclusion step block to the bottom left corner of the canvas and scale it to 80%. They then drag the differentiation process block to the reference area to create a reference copy for later review. When clearing the canvas, the system confirms the deletion range on a block-by-block basis to avoid misalignment of handwriting within blocks.
[0056] In another specific application scenario, a test taker accumulated 32 calculation blocks and approximately 900 strokes on the draft of question 5. The system maintains viewport rectangle determination: the 24 calculation blocks outside the viewport are rendered as a 160×120 low-resolution bitmap cache, and each frame redraw only draws the vector strokes and cached bitmaps of the 8 blocks within the viewport, resulting in smooth scrolling without lag; when the test taker scrolls to a cached block, the system discards its bitmap cache and reconstructs the vector rendering; the draft management panel also uses the cached bitmap as a block-level thumbnail, allowing the test taker to preview the content of each calculation block without expanding it.
[0057] In another specific application scenario, the test taker completed four steps on the draft of question 3: Step 1 (given conditions, copy the question stem), Step 2 (intermediate derivation, find the derivative and set it to zero), Step 3 (intermediate derivation, substitute endpoint values to calculate), and Step 4 (conclusion, write the maximum value). The system establishes a logical index table indexed by the steps. If the test taker accidentally closes the browser while writing Step 4 (conclusion) and re-enters the draft, the system restores all handwriting and step-by-step data, and locates breakpoints: after excluding steps with known conditions, the system takes Step 3, which has the latest completion time, as the breakpoint. The draft interface displays the message "Last written to: Step 3 (substitute endpoint values to calculate), continue from here."
[0058] The candidate clicks "Continue from breakpoint," and the canvas automatically navigates to the area of step 3. The candidate then reviews step 2 and clicks "Step 2: Intermediate Derivation" in the step list. The system jumps to and highlights this step according to the logical index. The candidate selects "Reference Step 2" to generate a copy of the continuation calculation, adds new calculations to the copy, and saves the continuation result independently, without affecting the original step 2.
[0059] In another specific application scenario, the test taker continuously worked on the draft of question 3. From 12:10:00 to 12:12:35, the system saved the work after each stroke. After completing the last stroke at 12:12:35, the test taker paused to think for 18 seconds. The system determined that this exceeded the preset pause threshold of 15 seconds and entered a reduced-frequency saving state, no longer writing stroke by stroke. At 12:12:53, the test taker resumed writing, and the system forcibly saved the current complete state and created a snapshot with the semantic label "resume after pause".
[0060] When the candidate switches to the conclusion derivation, the system detects the completion of the calculation block (the start of a new block) and creates a milestone snapshot with the semantic label "Step 2 Completed". Once the conclusion is written, a "Conclusion Formed" milestone snapshot is created. Milestone snapshots are stored independently of the regular previous version snapshot and are displayed in the draft management interface as a list of semantic labels. When the candidate clicks on the "Step 2 Completed" milestone, the system restores the complete draft state at that moment; the state before restoration is first saved as a snapshot, which is reversible. Throughout the process, the saving behavior adapts to the writing pace, balancing seamless writing with automatic archiving of critical states.
[0061] Example 3 like Figure 2 As shown, this embodiment provides a system for saving and restoring calculation drafts, including: The output of the draft canvas creation module is connected to the input of the handwriting acquisition module. The draft canvas creation module is used to create a draft canvas associated with the exam identifier and the question identifier based on the draft trigger operation, and provide the draft canvas to the handwriting acquisition module. The output of the handwriting acquisition module is connected to the input of the calculation block and step formation module and the input of the storage module, respectively. The handwriting acquisition module is used to acquire handwriting data according to the draft canvas and send the handwriting data to the calculation block and step formation module and the storage module, respectively. The output of the calculation block and step forming module is connected to the input of the logical index building module, the input of the storage module, and the input of the rendering cache module, respectively. The calculation block and step forming module is used to form calculation blocks and calculation steps based on the handwriting data, and send the calculation steps to the logical index building module and the storage module, and provide the calculation blocks to the rendering cache module. The output of the logical index building module is connected to the input of the storage module and the input of the recovery module, respectively. The logical index building module is used to build a logical index according to the calculation steps and send the logical index to the storage module and the recovery module. The saving module and the recovery module are connected through a draft data storage unit. The saving module is used to obtain and save draft data, integrity verification value, and version snapshot to the draft data storage unit according to the handwriting data, calculation steps, and logical index during the saving phase. The recovery module is used to retrieve the draft data from the draft data storage unit according to the draft recovery request during the recovery phase and perform integrity verification. If the verification passes, the draft canvas is reconstructed according to the draft data. If the verification fails, the draft canvas is restored based on the version snapshot, and the breakpoint is located or the target calculation step is jumped to according to the logical index. The output of the recovery module is connected to the input of the rendering cache module, and the recovery module is used to provide the reconstructed or recovered draft canvas to the rendering cache module. The rendering cache module is connected to the calculation block and step formation module. The rendering cache module is used to cache or vector reconstruct the calculation block according to the viewport state.
[0062] The system is used to perform all the steps of the above method.
[0063] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for saving and restoring calculation drafts, characterized in that, include: A draft canvas is created based on the draft trigger operation and associated with the exam icon and question icon. Handwriting data is collected based on the draft canvas. The handwriting data is used to form calculation blocks and calculation steps; logical indexes are established based on the calculation steps. During the saving phase, the draft data, integrity check value, and version snapshot are obtained and saved based on the handwriting data, calculation steps, and logical index. During the recovery phase, the draft data is retrieved according to the draft recovery request and its integrity is verified. If the verification passes, the draft canvas is reconstructed based on the draft data. If the verification fails, the draft canvas is restored based on the version snapshot, and the breakpoint is located or the target calculation step is jumped to according to the logical index. The computational blocks are cached or vector reconstructed based on the viewport state.
2. The method according to claim 1, characterized in that, Collecting handwriting data based on the draft canvas includes: calling the unified pointer event interface based on the draft canvas to obtain pointer events from the input device; Based on the pointer event, obtain the sampling points including canvas coordinates, pressure value, and relative timestamp; Stroke data is generated based on continuous sampling points.
3. The method according to claim 2, characterized in that, The calculation block and calculation steps based on the handwriting data include: obtaining the time interval and spatial bounding box relationship between adjacent strokes based on the stroke data; Based on the judgment result that the time interval is less than a preset threshold and the spatial bounding boxes are adjacent or overlapping, the corresponding strokes are assigned to the same calculation block; The type of computation step is determined based on the derivation arrows, equal sign chains, or conclusion symbols in the computation block.
4. The method according to claim 1, characterized in that, The step of obtaining and saving draft data, integrity verification value, and version snapshot based on the handwriting data, calculation steps, and logical index during the saving phase includes: Save stroke data stroke by stroke based on stroke completion events; The saving frequency is reduced based on the judgment result that the time interval between adjacent strokes exceeds the pause threshold; Based on events such as resuming writing after a pause, switching calculation steps, completing a calculation block, or forming a conclusion, the complete draft state is saved and a milestone snapshot with semantic tags is generated.
5. The method according to claim 1, characterized in that, Establishing a logical index based on the calculation steps includes: obtaining the step sequence, step type, time interval, spatial region, and stroke identifier based on the calculation steps; A logical index is established based on the sequence of steps, step type, time interval, spatial region, and stroke identifier. The logical index is saved based on the association between the logical index and the draft data.
6. The method according to claim 1, characterized in that, The process of acquiring and saving draft data, integrity verification values, and version snapshots during the saving phase includes: Calculate the integrity check value based on the draft data; Obtain the current stroke data based on the clear operation; generate a snapshot of the previous version based on the current stroke data; The integrity verification value, the previous version snapshot, and the draft data are saved.
7. The method according to claim 1, characterized in that, The step of retrieving the draft data based on the draft recovery request and performing integrity verification during the recovery phase includes: Retrieve draft data associated with the exam identifier and question identifier based on the draft recovery request; Recalculate the current integrity check value based on the draft data; The integrity of the draft data is determined based on the comparison between the current integrity check value and the saved integrity check value. Retrieve the previous version snapshot based on the result that the draft data is incomplete.
8. The method according to claim 1, characterized in that, The step of locating the breakpoint or jumping to the target calculation based on the logical index during the recovery phase includes: The step type and stroke end time of each calculation step are obtained according to the logical index; Eliminate steps with known conditions and steps with notes based on the step type; The breakpoint is determined based on the calculation step in the remaining calculation steps where the last stroke ends the latest and there are no new strokes within the step that exceed the preset duration. The target calculus step is retrieved according to the step jump instruction, and the spatial region of the target calculus step is located.
9. The method according to claim 1, characterized in that, The step of caching or vector reconstruction of the computation block based on the viewport state includes: The spatial bounding box of each computation block is obtained according to the logical index; The location of the computation block outside the viewport is determined based on the intersection relationship between the viewport rectangle and the bounding box. A low-resolution bitmap cache is generated based on the results where the computation block is located outside the viewport and has not been edited for a preset time. The low-resolution bitmap cache is deleted and vector rendering is rebuilt based on the result of the determined calculation block re-entering the viewport or receiving the result of the editing operation.
10. A system for saving and restoring calculation drafts, characterized in that, include: The draft canvas creation module is used to create a draft canvas associated with the exam icon and question icon based on the draft trigger operation; The handwriting acquisition module is used to acquire handwriting data based on the draft canvas. The calculation block and step formation module is used to form calculation blocks and calculation steps based on the handwriting data; A logical index building module is used to build a logical index based on the calculation steps; The saving module is used to obtain and save draft data, integrity verification value and version snapshot based on the handwriting data, calculation steps and logical index during the saving stage. The recovery module is used to retrieve the draft data according to the draft recovery request and perform integrity verification during the recovery phase. If the verification passes, the draft canvas is reconstructed according to the draft data. If the verification fails, the draft canvas is restored based on the version snapshot, and the breakpoint is located or the target calculation step is jumped to according to the logical index. The rendering cache module is used to cache or reconstruct the computation blocks based on the viewport state.
