You've already forked lazarus-ccr
LazStats: Refactor GradingBookUnit and GradingUnit. Add pdf help to chm.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7425 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
Binary file not shown.
Binary file not shown.
@ -7,6 +7,7 @@ object GradebookFrm: TGradebookFrm
|
||||
ClientHeight = 521
|
||||
ClientWidth = 956
|
||||
Menu = MainMenu1
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poMainFormCenter
|
||||
@ -31,6 +32,7 @@ object GradebookFrm: TGradebookFrm
|
||||
Top = 0
|
||||
Width = 299
|
||||
Align = alLeft
|
||||
BevelOuter = bvNone
|
||||
Caption = 'Panel1'
|
||||
ClientHeight = 521
|
||||
ClientWidth = 299
|
||||
@ -41,7 +43,7 @@ object GradebookFrm: TGradebookFrm
|
||||
AnchorSideTop.Control = Panel1
|
||||
Left = 26
|
||||
Height = 24
|
||||
Top = 9
|
||||
Top = 8
|
||||
Width = 246
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'YOUR GRADEBOOK FOR:'
|
||||
@ -59,9 +61,9 @@ object GradebookFrm: TGradebookFrm
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = FileNameEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 9
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 45
|
||||
Top = 44
|
||||
Width = 21
|
||||
BorderSpacing.Left = 8
|
||||
Caption = 'File:'
|
||||
@ -71,9 +73,9 @@ object GradebookFrm: TGradebookFrm
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = FileNameEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 9
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 72
|
||||
Top = 71
|
||||
Width = 199
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
@ -87,14 +89,14 @@ object GradebookFrm: TGradebookFrm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 38
|
||||
Left = 37
|
||||
Height = 23
|
||||
Top = 41
|
||||
Width = 252
|
||||
Top = 40
|
||||
Width = 262
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
Text = 'FileNameEdit'
|
||||
end
|
||||
@ -104,16 +106,16 @@ object GradebookFrm: TGradebookFrm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 9
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 89
|
||||
Width = 284
|
||||
Top = 88
|
||||
Width = 291
|
||||
ShowHidden = False
|
||||
ButtonWidth = 23
|
||||
NumGlyphs = 1
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 8
|
||||
MaxLength = 0
|
||||
TabOrder = 1
|
||||
OnChange = DirectoryEdit1Change
|
||||
@ -125,30 +127,33 @@ object GradebookFrm: TGradebookFrm
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ResetBtn
|
||||
Left = 9
|
||||
Height = 334
|
||||
Top = 116
|
||||
Width = 281
|
||||
Left = 8
|
||||
Height = 336
|
||||
Top = 115
|
||||
Width = 291
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
ItemHeight = 15
|
||||
Directory = 'd:\prog_lazarus'
|
||||
ItemHeight = 0
|
||||
Mask = '*.gbk;*.GBK'
|
||||
OnClick = FileListBox1Click
|
||||
TabOrder = 2
|
||||
end
|
||||
object ResetBtn: TButton
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideBottom.Control = ExitBtn
|
||||
Left = 9
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 458
|
||||
Width = 77
|
||||
Top = 459
|
||||
Width = 54
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Bottom = 4
|
||||
Caption = 'Start New'
|
||||
Caption = 'Reset'
|
||||
OnClick = ResetBtnClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object ExitBtn: TButton
|
||||
@ -157,10 +162,10 @@ object GradebookFrm: TGradebookFrm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Panel1
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 9
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 487
|
||||
Width = 77
|
||||
Top = 488
|
||||
Width = 54
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
@ -170,39 +175,18 @@ object GradebookFrm: TGradebookFrm
|
||||
OnClick = ExitBtnClick
|
||||
TabOrder = 4
|
||||
end
|
||||
object RadioGroup1: TRadioGroup
|
||||
object NameProtectionChk: TCheckBox
|
||||
AnchorSideLeft.Control = ExitBtn
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideBottom.Control = Panel1
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 102
|
||||
Height = 51
|
||||
Top = 461
|
||||
Width = 157
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoFill = True
|
||||
AutoSize = True
|
||||
AnchorSideTop.Control = ResetBtn
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 78
|
||||
Height = 19
|
||||
Top = 462
|
||||
Width = 125
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Name Protection:'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.HorizontalSpacing = 8
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 2
|
||||
ClientHeight = 31
|
||||
ClientWidth = 153
|
||||
Columns = 2
|
||||
ItemIndex = 1
|
||||
Items.Strings = (
|
||||
'Turn ON'
|
||||
'Turn OFF'
|
||||
)
|
||||
OnClick = RadioGroup1Click
|
||||
Caption = 'Do not scroll names'
|
||||
OnChange = NameProtectionChkChange
|
||||
TabOrder = 5
|
||||
end
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -7,9 +7,9 @@ object GradingFrm: TGradingFrm
|
||||
ClientHeight = 441
|
||||
ClientWidth = 622
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poMainFormCenter
|
||||
ShowHint = True
|
||||
LCLVersion = '2.1.0.0'
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = ScoresGrid
|
||||
@ -131,7 +131,7 @@ object GradingFrm: TGradingFrm
|
||||
AnchorSideRight.Control = LoadBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 123
|
||||
Left = 136
|
||||
Height = 25
|
||||
Top = 408
|
||||
Width = 86
|
||||
@ -149,98 +149,80 @@ object GradingFrm: TGradingFrm
|
||||
AnchorSideRight.Control = ResetBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 221
|
||||
Left = 234
|
||||
Height = 25
|
||||
Top = 408
|
||||
Width = 88
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Load Specs.'
|
||||
OnClick = LoadBtnClick
|
||||
TabOrder = 5
|
||||
end
|
||||
object ResetBtn: TButton
|
||||
AnchorSideRight.Control = Cancelbtn
|
||||
AnchorSideRight.Control = ComputeBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 321
|
||||
Left = 330
|
||||
Height = 25
|
||||
Top = 408
|
||||
Width = 54
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Reset'
|
||||
OnClick = ResetBtnClick
|
||||
TabOrder = 6
|
||||
end
|
||||
object Cancelbtn: TButton
|
||||
AnchorSideRight.Control = ComputeBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 387
|
||||
Height = 25
|
||||
Top = 408
|
||||
Width = 62
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Cancel'
|
||||
ModalResult = 2
|
||||
TabOrder = 7
|
||||
end
|
||||
object ReturnBtn: TButton
|
||||
object CloseBtn: TButton
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 549
|
||||
Left = 559
|
||||
Height = 25
|
||||
Top = 408
|
||||
Width = 61
|
||||
Width = 55
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Return'
|
||||
Caption = 'Close'
|
||||
ModalResult = 1
|
||||
TabOrder = 9
|
||||
TabOrder = 8
|
||||
end
|
||||
object ComputeBtn: TButton
|
||||
AnchorSideRight.Control = ReturnBtn
|
||||
AnchorSideRight.Control = CancelBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 461
|
||||
Left = 392
|
||||
Height = 25
|
||||
Top = 408
|
||||
Width = 76
|
||||
Anchors = [akRight, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 12
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Compute'
|
||||
OnClick = ComputeBtnClick
|
||||
TabOrder = 8
|
||||
TabOrder = 7
|
||||
end
|
||||
object Bevel1: TBevel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ReturnBtn
|
||||
AnchorSideBottom.Control = CloseBtn
|
||||
Left = 0
|
||||
Height = 8
|
||||
Top = 392
|
||||
@ -439,9 +421,11 @@ object GradingFrm: TGradingFrm
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 245
|
||||
Hint = 'Enter low score value for the given grade. '#13#10'IMPORTANT: Press ENTER key.'
|
||||
Top = 17
|
||||
Width = 77
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
AutoAdvance = aaDown
|
||||
AutoFillColumns = True
|
||||
BorderSpacing.Top = 2
|
||||
ColCount = 1
|
||||
@ -501,6 +485,22 @@ object GradingFrm: TGradingFrm
|
||||
end
|
||||
end
|
||||
end
|
||||
object CancelBtn: TButton
|
||||
AnchorSideRight.Control = CloseBtn
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 476
|
||||
Height = 25
|
||||
Top = 408
|
||||
Width = 75
|
||||
Anchors = [akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Cancel'
|
||||
ModalResult = 2
|
||||
TabOrder = 9
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
left = 496
|
||||
top = 24
|
||||
|
@ -15,6 +15,7 @@ type
|
||||
|
||||
TGradingFrm = class(TForm)
|
||||
Bevel1: TBevel;
|
||||
CancelBtn: TButton;
|
||||
ComputeBtn: TButton;
|
||||
Label4: TLabel;
|
||||
AssignedGrid: TStringGrid;
|
||||
@ -30,8 +31,7 @@ type
|
||||
SaveBtn: TButton;
|
||||
LoadBtn: TButton;
|
||||
ResetBtn: TButton;
|
||||
Cancelbtn: TButton;
|
||||
ReturnBtn: TButton;
|
||||
CloseBtn: TButton;
|
||||
DistUseGroup: TRadioGroup;
|
||||
CategoriesGroup: TRadioGroup;
|
||||
Label1: TLabel;
|
||||
@ -48,7 +48,6 @@ type
|
||||
procedure ComputeBtnClick(Sender: TObject);
|
||||
procedure DistUseGroupClick(Sender: TObject);
|
||||
procedure FormActivate(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure LoadBtnClick(Sender: TObject);
|
||||
procedure LowScoreGridKeyDown(Sender: TObject; var Key: Word;
|
||||
@ -57,11 +56,11 @@ type
|
||||
procedure SaveBtnClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
nints : integer;
|
||||
ncases : integer;
|
||||
col : integer;
|
||||
ncats : integer;
|
||||
sorted : array[0..50] of double;
|
||||
NInts: integer;
|
||||
NCases: integer;
|
||||
Col: integer;
|
||||
NCats: integer;
|
||||
Sorted: array[0..50] of double;
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
@ -73,106 +72,94 @@ implementation
|
||||
|
||||
uses
|
||||
Math,
|
||||
gradebookunit;
|
||||
Utils, GradebookUnit;
|
||||
|
||||
{ TGradingFrm }
|
||||
|
||||
procedure TGradingFrm.DistUseGroupClick(Sender: TObject);
|
||||
VAR
|
||||
i, j, btn, nscores : integer;
|
||||
RawScores : array[0..50] of double;
|
||||
RawFreq : array[0..50] of double;
|
||||
temp, X, Y : double;
|
||||
var
|
||||
i, j, btn, nscores: integer;
|
||||
RawScores: array[0..50] of double;
|
||||
RawFreq: array[0..50] of double;
|
||||
temp, X, Y: double;
|
||||
begin
|
||||
if DistUseGroup.ItemIndex < 0 then exit;
|
||||
col := gradebookfrm.tno + 3; // column of raw scores for test number tno
|
||||
btn := DistUseGroup.ItemIndex;
|
||||
nscores := gradebookfrm.nints;
|
||||
ScoresGrid.RowCount := nscores;
|
||||
ncases := gradebookfrm.NoStudents;
|
||||
case btn of
|
||||
0 : TopScoreGrid.Cells[0,0] := IntToStr(gradebookfrm.nitems);
|
||||
1 : TopScoreGrid.Cells[0,0] := FloatToStr(3.0);
|
||||
2 : TopScoreGrid.Cells[0,0] := FloatToStr(90.0);
|
||||
3 : TopScoreGrid.Cells[0,0] := FloatToStr(100.0);
|
||||
end;
|
||||
if DistUseGroup.ItemIndex < 0 then
|
||||
exit;
|
||||
|
||||
case btn of
|
||||
0 : for i := 1 to ncases do RawScores[i-1] := StrToFloat(gradebookfrm.Grid.Cells[col,i]);
|
||||
1 : for i := 1 to ncases do RawScores[i-1] := StrToFloat(gradebookfrm.Grid.Cells[col+1,i]);
|
||||
2 : for i := 1 to ncases do RawScores[i-1] := StrToFloat(gradebookfrm.Grid.Cells[col+2,i]);
|
||||
3 : for i := 1 to ncases do RawScores[i-1] := StrToFloat(gradebookfrm.Grid.Cells[col+3,i]);
|
||||
end;
|
||||
col := GradebookFrm.tno + 3; // column of raw scores for test number tno
|
||||
btn := DistUseGroup.ItemIndex;
|
||||
nscores := GradebookFrm.nints;
|
||||
ScoresGrid.RowCount := nscores;
|
||||
ncases := GradebookFrm.NoStudents;
|
||||
case btn of
|
||||
0 : TopScoreGrid.Cells[0,0] := IntToStr(GradebookFrm.nitems);
|
||||
1 : TopScoreGrid.Cells[0,0] := FloatToStr(3.0);
|
||||
2 : TopScoreGrid.Cells[0,0] := FloatToStr(90.0);
|
||||
3 : TopScoreGrid.Cells[0,0] := FloatToStr(100.0);
|
||||
end;
|
||||
|
||||
// sort RawScores into ascending order
|
||||
for i := 1 to ncases - 1 do
|
||||
begin
|
||||
for j := i+1 to ncases do
|
||||
begin
|
||||
X := RawScores[i-1];
|
||||
Y := RawScores[j-1];
|
||||
if RawScores[i-1] < RawScores[j-1] then // switch
|
||||
begin
|
||||
temp := RawScores[i-1];
|
||||
RawScores[i-1] := RawScores[j-1];
|
||||
RawScores[j-1] := temp;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
for i := 1 to ncases do
|
||||
RawScores[i-1] := StrToFloat(GradeBookFrm.Grid.cells[col+btn, i]);
|
||||
|
||||
// get frequency of each score
|
||||
nints := 1;
|
||||
for i := 1 to ncases do RawFreq[i-1] := 0;
|
||||
X := RawScores[0];
|
||||
Sorted[0] := X;
|
||||
for i := 1 to ncases do
|
||||
// sort RawScores into ascending order
|
||||
for i := 1 to ncases - 1 do
|
||||
begin
|
||||
for j := i+1 to ncases do
|
||||
begin
|
||||
if (X = RawScores[i-1])then RawFreq[nints-1] := RawFreq[nints-1] + 1
|
||||
else // new value
|
||||
begin
|
||||
nints := nints + 1;
|
||||
RawFreq[nints-1] := RawFreq[nints-1] + 1;
|
||||
X := RawScores[i-1];
|
||||
Sorted[nints-1] := X;
|
||||
end;
|
||||
X := RawScores[i-1];
|
||||
Y := RawScores[j-1];
|
||||
if RawScores[i-1] < RawScores[j-1] then // switch
|
||||
Exchange(RawScores[i-1], RawScores[j-1]);
|
||||
end;
|
||||
end;
|
||||
|
||||
// put data in grid
|
||||
// AssignedGrid.RowCount := nints + 1;
|
||||
ScoresGrid.RowCount := nints+1;
|
||||
GradesGrid.RowCount := nints + 1;
|
||||
for i := 0 to nints-1 do
|
||||
// get frequency of each score
|
||||
nints := 1;
|
||||
for i := 1 to ncases do RawFreq[i-1] := 0;
|
||||
X := RawScores[0];
|
||||
Sorted[0] := X;
|
||||
for i := 1 to ncases do
|
||||
begin
|
||||
if (X = RawScores[i-1])then
|
||||
RawFreq[nints-1] := RawFreq[nints-1] + 1
|
||||
else // new value
|
||||
begin
|
||||
ScoresGrid.Cells[0,i] := FloatToStr(Sorted[i]);
|
||||
ScoresGrid.Cells[1,i] := FloatToStr(RawFreq[i]);
|
||||
nints := nints + 1;
|
||||
RawFreq[nints-1] := RawFreq[nints-1] + 1;
|
||||
X := RawScores[i-1];
|
||||
Sorted[nints-1] := X;
|
||||
end;
|
||||
end;
|
||||
|
||||
// put data in grid
|
||||
ScoresGrid.RowCount := nints+1;
|
||||
GradesGrid.RowCount := nints + 1;
|
||||
for i := 0 to nints-1 do
|
||||
begin
|
||||
ScoresGrid.Cells[0,i] := FloatToStr(Sorted[i]);
|
||||
ScoresGrid.Cells[1,i] := FloatToStr(RawFreq[i]);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGradingFrm.FormActivate(Sender: TObject);
|
||||
var
|
||||
w: Integer;
|
||||
begin
|
||||
w := MaxValue([ResetBtn.Width, CancelBtn.Width, ComputeBtn.Width, ReturnBtn.Width]);
|
||||
w := MaxValue([ResetBtn.Width, ComputeBtn.Width, CancelBtn.Width, CloseBtn.Width]);
|
||||
ResetBtn.Constraints.MinWidth := w;
|
||||
CancelBtn.Constraints.MinWidth := w;
|
||||
ComputeBtn.Constraints.MinWidth := w;
|
||||
ReturnBtn.Constraints.MinWidth := w;
|
||||
end;
|
||||
|
||||
procedure TGradingFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
if OutputFrm = nil then
|
||||
Application.CreateForm(TOutputFrm, OutputFrm);
|
||||
CancelBtn.Constraints.MinWidth := w;
|
||||
CloseBtn.Constraints.MinWidth := w;
|
||||
end;
|
||||
|
||||
procedure TGradingFrm.FormShow(Sender: TObject);
|
||||
VAR
|
||||
i, j : integer;
|
||||
var
|
||||
i, j: integer;
|
||||
begin
|
||||
DistUseGroup.ItemIndex := -1;
|
||||
CategoriesGroup.ItemIndex := -1;
|
||||
for i := 0 to ScoresGrid.RowCount-1 do
|
||||
for j := 0 to 1 do ScoresGrid.Cells[j,i] := '';
|
||||
for j := 0 to 1 do ScoresGrid.Cells[j,i] := '';
|
||||
ScoresGrid.RowCount := 5;
|
||||
for i := 0 to Grades.RowCount-1 do Grades.Cells[0,i] := '';
|
||||
Grades.RowCount := 5;
|
||||
@ -188,121 +175,119 @@ end;
|
||||
|
||||
procedure TGradingFrm.LoadBtnClick(Sender: TObject);
|
||||
var
|
||||
FName : string;
|
||||
Grading : textfile;
|
||||
i, j, choice : integer;
|
||||
cellstring, outline, valstr : string;
|
||||
FName: string;
|
||||
Grading: textfile;
|
||||
i, j, choice: integer;
|
||||
cellstring, outline: string;
|
||||
lReport: TStrings;
|
||||
begin
|
||||
OutputFrm.RichEdit.Clear;
|
||||
OpenDialog1.DefaultExt := '.GRD';
|
||||
OpenDialog1.Filter := 'ALL (*.*)|*.*|Test Grading (*.GRD)|*.GRD';
|
||||
OpenDialog1.FilterIndex := 2;
|
||||
if OpenDialog1.Execute then
|
||||
OpenDialog1.DefaultExt := '.grd';
|
||||
OpenDialog1.Filter := 'All (*.*)|*.*|Test Grading (*.grd)|*.grd;*.GRD';
|
||||
OpenDialog1.FilterIndex := 2;
|
||||
|
||||
if OpenDialog1.Execute then
|
||||
begin
|
||||
FName := OpenDialog1.FileName;
|
||||
|
||||
AssignFile(Grading, FName);
|
||||
Reset(Grading);
|
||||
|
||||
ReadLn(Grading, NCases);
|
||||
ReadLn(Grading, NInts);
|
||||
ReadLn(Grading, Col);
|
||||
ReadLn(Grading, choice);
|
||||
|
||||
lReport := TStringList.Create;
|
||||
try
|
||||
lReport.Add('Distribution used index = %2d', [choice]);
|
||||
ReadLn(Grading, choice);
|
||||
lReport.Add('Category index: %2d', [choice]);
|
||||
ReadLn(Grading, choice);
|
||||
lReport.Add('Top Score Low Score');
|
||||
lReport.Add('---------- ----------');
|
||||
if choice = 0 then
|
||||
begin
|
||||
for i := 0 to 4 do
|
||||
begin
|
||||
// GetNoRecords;
|
||||
FName := OpenDialog1.FileName;
|
||||
AssignFile(Grading,FName);
|
||||
Reset(Grading);
|
||||
readln(Grading,ncases);
|
||||
readln(Grading,nints);
|
||||
readln(Grading,col);
|
||||
readln(Grading,choice);
|
||||
cellstring := format('Distribution used index = %2d',[choice]);
|
||||
OutputFrm.RichEdit.Lines.Add(cellstring);
|
||||
// DistUseGroup.ItemIndex := choice;
|
||||
readln(Grading,choice);
|
||||
cellstring := format('Category index = %2d',[choice]);
|
||||
OutputFrm.RichEdit.Lines.Add(cellstring);
|
||||
// CategoriesGroup.ItemIndex := choice;
|
||||
readln(Grading,choice);
|
||||
OutputFrm.RichEdit.Lines.Add('Top Score Low Score');
|
||||
if choice = 0 then
|
||||
begin
|
||||
for i := 0 to 4 do
|
||||
begin
|
||||
readln(Grading,cellstring);
|
||||
outline := format('%10s ',[cellstring]);
|
||||
// TopScoreGrid.Cells[0,i] := cellstring;
|
||||
readln(Grading,cellstring);
|
||||
valstr := format('%10s',[cellstring]);
|
||||
outline := outline + valstr;
|
||||
// LowScoreGrid.Cells[0,i] := cellstring;
|
||||
OutputFrm.RichEdit.Lines.Add(outline);
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
for i := 0 to 11 do
|
||||
begin
|
||||
readln(Grading,cellstring);
|
||||
outline := format('%10s',[cellstring]);
|
||||
// TopScoreGrid.Cells[0,i] := cellstring;
|
||||
readln(Grading,cellstring);
|
||||
valstr := format('%10s',[cellstring]);
|
||||
outline := outline + valstr;
|
||||
// LowScoreGrid.Cells[0,i] := cellstring;
|
||||
OutputFrm.RichEdit.Lines.Add(outline);
|
||||
end;
|
||||
end;
|
||||
OutputFrm.RichEdit.Lines.Add('');
|
||||
OutputFrm.RichEdit.Lines.Add('Assigned Grid');
|
||||
for i := 0 to nints-1 do
|
||||
begin
|
||||
readln(Grading,cellstring);
|
||||
outline := cellstring;
|
||||
OutputFrm.RichEdit.Lines.Add(outline);
|
||||
// AssignedGrid.Cells[0,i] := cellstring;
|
||||
end;
|
||||
// readln(Grading,cellstring);
|
||||
OutputFrm.RichEdit.Lines.Add('Score Frequency');
|
||||
for i := 0 to nints - 1 do
|
||||
begin
|
||||
outline := '';
|
||||
for j := 0 to 1 do
|
||||
begin
|
||||
readln(Grading,cellstring);
|
||||
valstr := format('%10s ',[cellstring]);
|
||||
outline := outline + valstr;
|
||||
// ScoresGrid.Cells[j,i] := cellstring;
|
||||
end;
|
||||
OutputFrm.RichEdit.Lines.Add(outline);
|
||||
end;
|
||||
ReadLn(Grading, cellstring);
|
||||
outline := Format('%10s ',[cellstring]);
|
||||
Readln(Grading, cellstring);
|
||||
outline := outline + Format(' %10s', [cellstring]);
|
||||
lReport.Add(outline);
|
||||
end;
|
||||
OutputFrm.ShowModal;
|
||||
CloseFile(Grading);
|
||||
end else
|
||||
begin
|
||||
for i := 0 to 11 do
|
||||
begin
|
||||
ReadLn(Grading, cellstring);
|
||||
outline := Format('%10s', [cellstring]);
|
||||
Readln(Grading, cellstring);
|
||||
outline := outline + Format(' %10s', [cellstring]);
|
||||
lReport.Add(outline);
|
||||
end;
|
||||
end;
|
||||
lReport.Add('');
|
||||
|
||||
lReport.Add('Assigned Grid');
|
||||
for i := 0 to NInts-1 do
|
||||
begin
|
||||
ReadLn(Grading, cellstring);
|
||||
lReport.Add(cellString);
|
||||
end;
|
||||
lReport.Add('Score Frequency');
|
||||
lReport.Add('----------- -----------');
|
||||
for i := 0 to NInts - 1 do
|
||||
begin
|
||||
outline := '';
|
||||
for j := 0 to 1 do
|
||||
begin
|
||||
ReadLn(Grading, cellstring);
|
||||
outline := outline + Format('%11s ',[cellstring]);
|
||||
end;
|
||||
lReport.Add(outline);
|
||||
end;
|
||||
|
||||
DisplayReport(lReport);
|
||||
finally
|
||||
lReport.Free;
|
||||
end;
|
||||
|
||||
CloseFile(Grading);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGradingFrm.LowScoreGridKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
VAR
|
||||
i, row, freq, intervals: integer;
|
||||
lowval, hival, score1 : double;
|
||||
|
||||
var
|
||||
i, row, freq, intervals: integer;
|
||||
lowval, hival, score1: double;
|
||||
begin
|
||||
if Key = 13 then // enter key
|
||||
begin
|
||||
intervals := ScoresGrid.RowCount-1;
|
||||
row := LowScoreGrid.Row;
|
||||
freq := 0;
|
||||
lowval := StrToFloat(LowScoreGrid.Cells[0,row]);
|
||||
hival := StrToFloat(TopScoreGrid.Cells[0,row]);
|
||||
for i := 0 to intervals-1 do
|
||||
begin
|
||||
score1 := StrToFloat(ScoresGrid.Cells[0,i]);
|
||||
if (score1 >= lowval) and (score1 <= hival) then
|
||||
freq := freq + StrToInt(ScoresGrid.Cells[1,i]);
|
||||
end;
|
||||
AssignedGrid.Cells[0,row] := IntToStr(freq);
|
||||
if row < ncats-1 then
|
||||
begin
|
||||
if DistUseGroup.ItemIndex = 1 then // z score
|
||||
TopScoreGrid.Cells[0,row+1] := FloatToStr(lowval-0.001);
|
||||
if DistUseGroup.ItemIndex = 0 then // raw score
|
||||
TopScoreGrid.Cells[0,row+1] := FloatToStr(lowval-1);
|
||||
if DistUseGroup.ItemIndex = 2 then // T score
|
||||
TopScoreGrid.Cells[0,row+1] := FloatToStr(lowval-0.1);
|
||||
if DistUseGroup.ItemIndex = 3 then // Percentile rank
|
||||
TopScoreGrid.Cells[0,row+1] := FloatToStr(lowval-0.01);
|
||||
end;
|
||||
intervals := ScoresGrid.RowCount-1;
|
||||
row := LowScoreGrid.Row;
|
||||
freq := 0;
|
||||
lowval := StrToFloat(LowScoreGrid.Cells[0,row]);
|
||||
hival := StrToFloat(TopScoreGrid.Cells[0,row]);
|
||||
for i := 0 to intervals-1 do
|
||||
begin
|
||||
score1 := StrToFloat(ScoresGrid.Cells[0,i]);
|
||||
if (score1 >= lowval) and (score1 <= hival) then
|
||||
freq := freq + StrToInt(ScoresGrid.Cells[1,i]);
|
||||
end;
|
||||
|
||||
AssignedGrid.Cells[0,row] := IntToStr(freq);
|
||||
if row < NCats-1 then
|
||||
begin
|
||||
if DistUseGroup.ItemIndex = 1 then // z score
|
||||
TopScoreGrid.Cells[0,row+1] := FloatToStr(lowval-0.001);
|
||||
if DistUseGroup.ItemIndex = 0 then // raw score
|
||||
TopScoreGrid.Cells[0,row+1] := FloatToStr(lowval-1);
|
||||
if DistUseGroup.ItemIndex = 2 then // T score
|
||||
TopScoreGrid.Cells[0,row+1] := FloatToStr(lowval-0.1);
|
||||
if DistUseGroup.ItemIndex = 3 then // Percentile rank
|
||||
TopScoreGrid.Cells[0,row+1] := FloatToStr(lowval-0.01);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -313,110 +298,85 @@ end;
|
||||
|
||||
procedure TGradingFrm.SaveBtnClick(Sender: TObject);
|
||||
var
|
||||
FName : string;
|
||||
Grading : textfile;
|
||||
i, j : integer;
|
||||
FName: string;
|
||||
Grading: textfile;
|
||||
i, j, n : integer;
|
||||
begin
|
||||
SaveDialog1.DefaultExt := '.GRD';
|
||||
SaveDialog1.Filter := 'ALL (*.*)|*.*|Test Grading (*.GRD)|*.GRD';
|
||||
SaveDialog1.FilterIndex := 2;
|
||||
if SaveDialog1.Execute then
|
||||
begin
|
||||
FName := SaveDialog1.FileName;
|
||||
AssignFile(Grading,FName);
|
||||
Rewrite(Grading);
|
||||
writeln(Grading,ncases);
|
||||
writeln(Grading,nints);
|
||||
writeln(Grading,col);
|
||||
writeln(Grading,DistUseGroup.ItemIndex);
|
||||
writeln(Grading,CategoriesGroup.ItemIndex);
|
||||
if CategoriesGroup.ItemIndex = 0 then
|
||||
begin
|
||||
for i := 0 to 4 do
|
||||
begin
|
||||
writeln(Grading,TopScoreGrid.Cells[0,i]);
|
||||
writeln(Grading,LowScoreGrid.Cells[0,i]);
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
for i := 0 to 11 do
|
||||
begin
|
||||
writeln(Grading,TopScoreGrid.Cells[0,i]);
|
||||
writeln(Grading,LowScoreGrid.Cells[0,i]);
|
||||
end;
|
||||
end;
|
||||
for i := 0 to AssignedGrid.RowCount-1 do
|
||||
writeln(Grading,AssignedGrid.Cells[0,i]);
|
||||
for i := 0 to ScoresGrid.RowCount - 1 do
|
||||
begin
|
||||
for j := 0 to 1 do writeln(Grading,ScoresGrid.Cells[j,i]);
|
||||
end;
|
||||
end;
|
||||
CloseFile(Grading);
|
||||
SaveDialog1.DefaultExt := '.grd';
|
||||
SaveDialog1.Filter := 'All Files (*.*)|*.*|Test Grading Files(*.grd)|*.grd;*.GRD';
|
||||
SaveDialog1.FilterIndex := 2;
|
||||
if SaveDialog1.Execute then
|
||||
begin
|
||||
FName := SaveDialog1.FileName;
|
||||
AssignFile(Grading,FName);
|
||||
Rewrite(Grading);
|
||||
writeln(Grading,ncases);
|
||||
writeln(Grading,nints);
|
||||
writeln(Grading,col);
|
||||
writeln(Grading,DistUseGroup.ItemIndex);
|
||||
writeln(Grading,CategoriesGroup.ItemIndex);
|
||||
if CategoriesGroup.ItemIndex = 0 then n := 5 else n := 12;
|
||||
for i := 0 to n-1 do
|
||||
begin
|
||||
writeln(Grading,TopScoreGrid.Cells[0,i]);
|
||||
writeln(Grading,LowScoreGrid.Cells[0,i]);
|
||||
end;
|
||||
for i := 0 to AssignedGrid.RowCount-1 do
|
||||
writeln(Grading,AssignedGrid.Cells[0,i]);
|
||||
for i := 0 to ScoresGrid.RowCount - 1 do
|
||||
for j := 0 to 1 do writeln(Grading,ScoresGrid.Cells[j,i]);
|
||||
end;
|
||||
|
||||
CloseFile(Grading);
|
||||
end;
|
||||
|
||||
|
||||
procedure TGradingFrm.CategoriesGroupClick(Sender: TObject);
|
||||
VAR
|
||||
btn : integer;
|
||||
const
|
||||
CATS_COUNT: array[0..1] of Integer = (5, 12);
|
||||
GRADES_5: array[0..4] of Char = ('A', 'B', 'C', 'D', 'F');
|
||||
GRADES_12: array[0..11] of String[2] = ('A', 'A-', 'B+', 'B', 'B-', 'C+', 'C', 'C-', 'D+', 'D', 'D-', 'F');
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
btn := CategoriesGroup.ItemIndex;
|
||||
if btn = 0 then ncats := 5 else ncats := 12;
|
||||
if btn = 0 then Grades.RowCount := 5 else Grades.RowCount := 12;
|
||||
if btn = 0 then TopScoreGrid.RowCount := 5 else TopScoreGrid.RowCount := 12;
|
||||
if btn = 0 then LowScoreGrid.RowCount := 5 else LowScoreGrid.RowCount := 12;
|
||||
if btn = 0 then AssignedGrid.RowCount := 5 else AssignedGrid.RowCount := 12;
|
||||
if btn = 0 then
|
||||
begin
|
||||
Grades.Cells[0,0] := 'A';
|
||||
Grades.Cells[0,1] := 'B';
|
||||
Grades.Cells[0,2] := 'C';
|
||||
Grades.Cells[0,3] := 'D';
|
||||
Grades.Cells[0,4] := 'F';
|
||||
end;
|
||||
if btn = 1 then
|
||||
begin
|
||||
Grades.Cells[0,0] := 'A';
|
||||
Grades.Cells[0,1] := 'A-';
|
||||
Grades.Cells[0,2] := 'B+';
|
||||
Grades.Cells[0,3] := 'B';
|
||||
Grades.Cells[0,4] := 'B-';
|
||||
Grades.Cells[0,5] := 'C+';
|
||||
Grades.Cells[0,6] := 'C';
|
||||
Grades.Cells[0,7] := 'C-';
|
||||
Grades.Cells[0,8] := 'D+';
|
||||
Grades.Cells[0,9] := 'D';
|
||||
Grades.Cells[0,10] := 'D-';
|
||||
Grades.Cells[0,11] := 'F';
|
||||
end;
|
||||
NCats := CATS_COUNT[CategoriesGroup.ItemIndex];
|
||||
Grades.RowCount := NCats;
|
||||
TopScoreGrid.RowCount := NCats;
|
||||
LowScoreGrid.RowCount := Ncats;
|
||||
AssignedGrid.RowCount := NCats;
|
||||
for i := 0 to NCats - 1 do
|
||||
case CategoriesGroup.ItemIndex of
|
||||
0: Grades.Cells[0, i] := GRADES_5[i];
|
||||
1: Grades.Cells[0, i] := GRADES_12[i];
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TGradingFrm.ComputeBtnClick(Sender: TObject);
|
||||
VAR
|
||||
i, j: integer;
|
||||
X, Y, low, hi : double;
|
||||
var
|
||||
i, j: integer;
|
||||
X, Y, low, hi: double;
|
||||
begin
|
||||
// build AssignedGrid of grades for each Score in the ScoresGrid
|
||||
for i := 0 to ncats - 1 do
|
||||
for i := 0 to NCats - 1 do
|
||||
begin
|
||||
hi := StrToFloat(TopScoreGrid.Cells[0,i]);
|
||||
low := StrToFloat(LowScoreGrid.Cells[0,i]);
|
||||
for j := 0 to nints-1 do
|
||||
begin
|
||||
X := StrToFloat(ScoresGrid.Cells[0,j]);
|
||||
if (X >= low) and (X <= hi) then GradesGrid.cells[0,j] := Grades.cells[0,i];
|
||||
end;
|
||||
hi := StrToFloat(TopScoreGrid.Cells[0,i]);
|
||||
low := StrToFloat(LowScoreGrid.Cells[0,i]);
|
||||
for j := 0 to nints-1 do
|
||||
begin
|
||||
X := StrToFloat(ScoresGrid.Cells[0,j]);
|
||||
if (X >= low) and (X <= hi) then GradesGrid.cells[0,j] := Grades.cells[0,i];
|
||||
end;
|
||||
end;
|
||||
|
||||
// Now assign grades in the gradebook
|
||||
for i := 1 to ncases do // gradebook grade cells
|
||||
begin
|
||||
Y := StrToFloat(gradebookfrm.grid.Cells[col,i]);
|
||||
for j := 0 to nints - 1 do // Grade of values in the ScoreGrid
|
||||
begin
|
||||
X := StrToFloat(ScoresGrid.Cells[0,j]);
|
||||
if X = Y then gradebookfrm.Grid.Cells[col+4,i] := gradesGrid.Cells[0,j];
|
||||
end;
|
||||
Y := StrToFloat(GradeBookFrm.grid.Cells[col,i]);
|
||||
for j := 0 to nints - 1 do // Grade of values in the ScoreGrid
|
||||
begin
|
||||
X := StrToFloat(ScoresGrid.Cells[0,j]);
|
||||
if X = Y then GradeBookFrm.Grid.Cells[col+4,i] := GradesGrid.Cells[0,j];
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -311,7 +311,7 @@ var
|
||||
begin
|
||||
if Lowercase(ExtractFileExt(AFileName)) <> '.laz' then
|
||||
begin
|
||||
MessageDlg(Format('Incorrect file format ("%s")', [AFileName]), mtError, [mbOK], 0);
|
||||
MessageDlg(Format('"%s" is not a .laz file.', [AFileName]), mtError, [mbOK], 0);
|
||||
exit;
|
||||
end;
|
||||
|
||||
@ -1295,9 +1295,11 @@ begin
|
||||
OS3MainFrm.NoVarsEdit.Text := IntToStr(NCols);
|
||||
NoVariables := NCols;
|
||||
NoCases := NRows;
|
||||
for i := 0 to NRows do // note - labels in row 0
|
||||
// Labels in row 0
|
||||
for i := 0 to NRows do
|
||||
begin
|
||||
for j := 0 to NCols do // note - case no. in col. 0
|
||||
// case no. in col. 0
|
||||
for j := 0 to NCols do
|
||||
begin
|
||||
Readln(F,astr);
|
||||
OS3MainFrm.DataGrid.Cells[j,i] := astr;
|
||||
|
Reference in New Issue
Block a user