Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
cd377133
Commit
cd377133
authored
12 years ago
by
mcmlxxix
Browse files
Options
Downloads
Patches
Plain Diff
consensus_vote.js works, this.. doesnt
parent
cf931325
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/votelib.js
+0
-65
0 additions, 65 deletions
exec/load/votelib.js
with
0 additions
and
65 deletions
exec/load/votelib.js
deleted
100644 → 0
+
0
−
65
View file @
cf931325
/* generic vote */
function
Vote
(
name
,
vote
,
utc
)
{
this
.
name
=
name
;
this
.
vote
=
vote
;
this
.
time
=
utc
;
}
/* generic voting topic */
function
Issue
(
id
,
text
,
utc
)
{
var
status
=
0
;
this
.
id
=
id
;
this
.
text
=
text
;
this
.
time
=
utc
;
this
.
votes
=
{};
this
.
__defineGetter__
(
"
status
"
,
function
()
{
if
(
status
==
0
)
return
"
open
"
;
else
return
"
closed
"
;
});
this
.
open
=
function
()
{
status
=
0
;
}
this
.
close
=
function
()
{
status
=
1
;
}
this
.
vote
=
function
(
name
,
vote
){
if
(
status
==
0
)
{
this
.
votes
[
name
.
toUpperCase
()]
=
new
Vote
(
name
,
vote
,
Date
.
now
());
return
true
;
}
else
{
return
false
;
}
}
}
/* consolidate votes into an array */
function
crunchVotes
(
issue
)
{
var
votes
=
[];
for
each
(
var
v
in
issue
.
votes
)
{
votes
.
push
(
v
);
}
return
votes
;
}
/* count the number of votes on a topic */
function
countVotes
(
issue
)
{
return
crunchVotes
(
issue
).
length
;
}
/* push topic results into an array of sexy text */
function
showVotes
(
issue
)
{
var
votes
=
crunchVotes
(
issue
);
var
vlist
=
[
"
Issue #
"
+
issue
.
id
+
"
: (
"
+
issue
.
status
+
"
)
"
+
issue
.
text
];
for
each
(
var
v
in
votes
)
{
vlist
.
push
(
"
Name:
"
+
v
.
name
+
"
Vote:
"
+
v
.
vote
);
}
return
votes
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment