Skip to content

Commit

Permalink
feat: appversion in export, bump version to 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelPascale committed Aug 26, 2024
1 parent 91bba72 commit a1d1e02
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</a>

<div class="navbar-item" style="flex-direction: column; align-items: baseline;"><b>MGH-CAM Data Management
Console</b><span>Timeline-Followback v3.0.0.9000</span></div>
Console</b><span id="application-version-title">Timeline-Followback</span></div>

<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false"
data-target="nav-layout-navbar-content">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tlfb",
"version": "1.0.0",
"version": "3.0.0",
"description": "Electronic Timeline Follow-Back Form",
"private": true,
"directories": {
Expand Down
18 changes: 10 additions & 8 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
* Defines various constants used elsewhere.
*
* Copyright (c) 2024, Michael Pascale <[email protected]>
* Last modified: 2023-07-26
* Last modified: 2024-08-26
*/

export const VERSION = '3.0.0';

// Time conversion factors.
export const CVT_MS_S = 1000;
export const CVT_S_MIN = 60;
Expand All @@ -17,14 +19,14 @@ export const CVT_MS_DAY = CVT_MS_S * CVT_S_MIN * CVT_MIN_HR * CVT_HR_DAY;
export const CAL_HEIGHT_DIFF = 205;


export const COLOR_WHITE = '#FFFFFF'
export const COLOR_TEXT = '#15141A'
export const COLOR_WHITE = '#FFFFFF';
export const COLOR_TEXT = '#15141A';

export const COLOR_PURPLE = '#485FC7'
export const COLOR_ORANGE = '#E67975'
export const COLOR_YELLOW = '#F7DBA7'
export const COLOR_GREEN = '#041F1E'
export const COLOR_BROWN = '#5A352A'
export const COLOR_PURPLE = '#485FC7';
export const COLOR_ORANGE = '#E67975';
export const COLOR_YELLOW = '#F7DBA7';
export const COLOR_GREEN = '#041F1E';
export const COLOR_BROWN = '#5A352A';

// Regular Expressions for input validation.
export const RGX_INTEGER = /^\d+$/;
Expand Down
8 changes: 5 additions & 3 deletions src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { CalendarDate, CalendarEvent, UseEvent, NoUseEvent, KeyEvent } from './s

import * as calculate from './calculate'
import { Editor } from './editor';
import { VERSION } from './constants';

export class File {
private _current_properties: TLFBProperties;
Expand Down Expand Up @@ -468,7 +469,7 @@ export class File {

public valid_CSV(csv: (string | number)[][]) {
const title_row = ["Subject", "Event", "pID", "Start", "End", "Staff", "Record", "Keyfield", "Datetime",
"", "", "", "", "", "", ""]
"AppVersion", "", "", "", "", "", ""]
const event_title_row = ["Event", "Date", "Type", "eID", 'gID', 'Title', "Category", "Substance", "MethodType",
"Method", "MethodOther", "Times", "Amount", "Units", "UnitsOther", "Note"]
const filler_row = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
Expand Down Expand Up @@ -864,6 +865,7 @@ export class File {
record: this._current_properties.record,
keyfield: this._current_properties.keyfield,
datetime: new Date(),
appversion: VERSION,
events: this._editor.get_event_list().serialize_events('json'),
}
const data_json = JSON.stringify(data)
Expand All @@ -885,10 +887,10 @@ export class File {

const properties_rows: (string | number)[][] = [
// Header for csv file, "" as placeholders for empty spaces
["Subject", "Event", "pID", "Start", "End", "Staff", "Record", "Keyfield", "Datetime", "", "", "", "", "", "", ""],
["Subject", "Event", "pID", "Start", "End", "Staff", "Record", "Keyfield", "Datetime", "AppVersion", "", "", "", "", "", ""],
[this._current_properties.subject, this._current_properties.timepoint, this._current_properties.pid, this._current_properties.start,
this._current_properties.end, this._current_properties.staff, this._current_properties.record, this._current_properties.keyfield,
(new Date).toISOString(), "", "", "", "", "", "", ""],
(new Date).toISOString(), VERSION, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""] // Empty row for readability
]

Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { File } from './file'
import { TLFBProperties, SubstanceList } from './types'

import * as util from './util'
import { CVT_MS_DAY, CAL_HEIGHT_DIFF, RGX_INTEGER, RGX_WORD, RGX_DATE } from './constants'
import { VERSION, CVT_MS_DAY, CAL_HEIGHT_DIFF, RGX_INTEGER, RGX_WORD, RGX_DATE } from './constants';


function get_url_properties() {
Expand Down Expand Up @@ -165,6 +165,8 @@ document.addEventListener('DOMContentLoaded', function() {

calendar.render();

util.set_inner('application-version-title', `Timeline-Followback v${VERSION}`);

const editor = new Editor(calendar);
const file = new File(tlfb_properties, calendar, editor)

Expand Down

0 comments on commit a1d1e02

Please sign in to comment.